I’m going to revisit, and expand previous posts on this blog, by breaking down a speed control project into modules. This post describes the project, then following posts will document each module as we expand the concept, and add more features.
The first item we want to build is to give the Arduino input on what we want the motor to do. This is done with a potentiometer and the analogRead() command.
The analogRead() reads the position of the wiper on a variable resistor (potentiometer) as 0-1023.
Become the Maker you were born to be. Try Arduino Academy for FREE!
Now we want to use that information to control the brightness of a light, and eventually, the speed of a motor. This will be done with a command called analogWrite(). The AnalogWrite() command sends a Pulse Width Modulation (PWM) signal to the output pin, controlling the on and off times (duty cycle) of the attached device, unlike a rheostat which would reduce the voltage to the device.
An example of analogRead() and analogWrite() is shown here in our previous PWM LED Brightness Control project.
The Arduino is limited in it’s voltage and current handling, so if we want to control the speed of a 12v motor pulling an amp of current (or a high current string of lights), we will have to use an intermediate device called a MOSFET. This is a type of transistor, and we are using it as a switch, that can handle high currents and fast switching speeds.
Finally, we want to know the actual rpm of the motor we are controlling, and be able to maintain under load (electronic governor). This function will use a Hall Effect Sensor to read the rpm, and we will implement a feedback loop in software to speed the motor up or slow it down based on the desired rpm set by the potentiometer.
So that’s the project, stay tuned for code, images, and video.
hi, im very interesting in this project. do you finish it? do you write the code? thanks
Got sidetracked with other projects, but now have a motor here that I can the pwm / mosfet piece. I'll put this together in a couple of days.