Sunday, July 5, 2015

Arduino driving Brushed DC Motor using PWM




It may not be brushless but the concept is the same. The Arduino receives a signal via the potentiometer into an analog pin, converts is to a digital value from 0 to 1023 which represents 0 to 5V. It does this using the analogRead() function. The PWM is implemented using the analogWrite function which takes values from 0 to 255 uses this information to adjust the duty cycle of the PWM.

The C/Arduino code is so simple I probably won't be bothered to post it.



From there is just pulses a transistor acts as a switch that drives the motor. The analogWrite() function on some of the pins, uses a frequency of 980 Hz. This equates to 1/980 = 0.0010204 sec or 1.02 ms period. so a 40% duty cycle would be 0.000408 sec or 0.408 ms high and 0.000612 sec or 0.612 ms low.

Next, I may try to drive a BLDC motor using an Arduino and back EMF or Hall Effect Sensors. Although 980 Hz may not be high enough to drive it at a fast speed.