Sep 09, 2022
If you have ever worked with anything involving motor control you're probably familiar with PWM or Pulse Width Modulation. This is a principle that allows us to essentially break a signal down into a bunch of tiny pulses that allow for everything from motor speed control to adjusting the brightness of an LED.
In this case we are utilizing a PWM signal to try and control the speed of the motors for this little go cart. But as is often the case when working with electrical control systems its not quite as simple as plug it in and poof it works. In this case when I attempted to alter the duty cycle for 0 to 99, 75, 50, or 25% the motor was not changing its speed. It was treating the system almost like a on or off switch when there should have been a noticeable change in motor speed between the duty cycles.
My first thought was that something was wrong in the pinout and the system was treating it as a high low signal instead of PWM. Now due to the nature of electricity and high frequency you can’t see what the system is doing with your naked eye, which is where an oscilloscope comes in. An oscilloscope is a piece of precision electronic equipment that allows you to view the signal being output by a device. So to start troubleshooting the pin in question on the raspberry pi was hooked up to the oscilloscope and the results were as follows.
From these figures we can see pretty clearly that the PWM is being output from the raspberry pi, it’s a
little noisy but should be clean enough to show a difference. This tells us that its not an issue directly with
the board and it’s probably a problem with noise down the line. After a little probing my suspicions where
confirmed as shown in Figure 6.