Article Preview
Buy Now
FEATURE
Motor Control
How to Use Soft PWM On Raspberry Pi
Issue: 16.2 (March/April 2018)
Author: Eugene Dakin
Author Bio: Eugene works as a Senior Oilfield Technical Specialist. He has university degrees in the disciplines of Engineering, Chemistry, Biology, Business, and a Ph.D. in Chemical Engineering. He is the author of dozens of books on Xojo available on the xdevlibrary.com website.
Article Description: No description available.
Article Length (in bytes): 11,636
Starting Page Number: 13
Article Number: 16203
Resource File(s):
project 16203.zip Updated: 2018-02-28 18:43:31
Related Web Link(s):
http://forums.realsoftware.com/viewtopic.php?f=1&
Excerpt of article text...
Pulse Wave Modulation (PWM) has the ability to change the speed of a motor without modifying the voltage that is sent to the motor. This is important because pulsing the same voltage provides little to no heat, and changing the speed of a motor by lowering the voltage creates heat. This heat is damaging to both the motor and wires. Another benefit of using PWM when lowering the speed of a motor is that the motor has more torque at these lower speeds. If the motor is used as a cooling fan then the extra generated heat is usually not an issue. This example shows how to use soft PWM for controlling the power that goes to a Direct Current (DC) motor.
The way that PWM works to change the speed of a motor is that the signal is a square wave (either its on or off) and the amount of time that the same voltage is turned on or off changes. Figure 1 is a diagram of two different PWMs, one with 10% power, and the other with 90% power.
The voltage is either 1.5 volts or zero volts, and the time for the current to flow changes. True to its name, the 1.5-volt pulse wave changes (modulates) with time. The PWM control allows the motor speed to change without changing the voltage to the motor.
There are many digital outputs in the Raspberry Pi board, and the soft PWM can be used so all of these digital ports can be used to output a PWM signal. The soft portion of the name means that the signal is generated by software instead of hardware on the Raspberry Pi board.
A wiring diagram of this project is shown in Figure 2.
Since the Raspberry Pi cannot supply all of the current and voltage for the motor, a 1.5-volt battery is added to energize the motor and an NPN transistor is added to act as a solid-state-switch. Pin #4 on the Raspberry Pi is connected to the base (1) of the transistor, the NPN collector (3) is connected to the positive terminal of the 1.5-volt battery, and the NPN emitter (2) is connected to ground. Ground is connected to the Raspberry Pi ground.
...End of Excerpt. Please purchase the magazine to read the full article.