Raspberry Pi CM5 IoT In C - - PWM Using GPIO5 |
Written by Harry Fairhead | |||||||||
Monday, 12 May 2025 | |||||||||
Page 5 of 5
What Else Can You Use PWM For?PWM lines are incredibly versatile and it is always worth asking the question "could I use PWM?" when you are considering almost any problem. The LED example shows how you can use PWM as a power controller. You can extend this idea to a computer-controlled switch-mode power supply. All you need is a capacitor to smooth out the voltage and perhaps a transformer to change the voltage. You can also use PWM to control the speed of a DC motor and if you add a simple bridge circuit you can control its direction and speed.
The amount of power delivered to a device by a pulse train is proportional to the duty cycle. A pulse train that has a 50% duty cycle is delivering current to the load only 50% of the time and this is irrespective of the pulse repetition rate. So the duty cycle controls the power, but the period still matters in many situations because you want to avoid any flashing or other effects. A higher frequency smooths out the power flow at any duty cycle. With a sufficiently fast period you can also use PWM as a digital to analog converter. Simply add a low-pass filter to remove the pulsing and you have a steady voltage proportional to the duty cycle. This can be used to create an audio signal if the clock is fast enough. Finally, you can use a PWM signal as a modulated carrier for data communications. For example, most infrared controllers make use of a 38kHz carrier, which is roughly a 26µs pulse. This is switched on and off for 1ms and this is well within the range that the PWM can manage. So all you have to do is replace the red LED in the previous circuit with an infrared LED and you have the start of a remote control, or data transmission, link.
Summary
Raspberry Pi Compute Module 5
|
Parasoft Adds AI Assistant To C/C++ Test 30/06/2025 Parasoft has updated its C/C++ Test software with an AI-powered documentation assistant, along with complete support for MISRA C:2025 and auto-suppression of equivalent violations. C/C++ Test can be u [ ... ] |
AI-Powered Wearable Can Monitor Knee Joint Torque 13/07/2025 Knee-related conditions such as osteoarthritis and rheumatoid arthritis significantly impact mobility and also increase susceptibility to injuries, creating a cycle that leads to chronic pain, reduced [ ... ] |
More News
|
Comments
or email your comment to: comments@i-programmer.info