Monday, October 10, 2011

[Arduino] Bi-Directional DC Motor Control With Arduino Only.

This is probably not the best way to get it done. Nonetheless, we could use Arduino Digital I/O pins configured for PWM to control a small little motor that is meant for solar use. The reason being, the current requirement for solar motors are much lower compared to tamiya motors etc etc at the toy scale.
The risk of frying the Arduino is much lower, but doesn't mean that it will not fry the arduino!

BEWARE of the risk involved as I am not responsible for your own doings.
Programming it is pretty straightforward but with a little twist on the understanding of PWM. Standard PWM outputs are used to the DC motor. If both PWM are arrive timely and "synchronized" i.e LHS is logic low and RHS logic high, the SMALL DC motor would see a complete circuit all the time. The small DC motor is tricked on seeing a +5v applied to RHS and gnd at LHS. To reverse the rotation from CCW to CW or vice-versa, just reverse the PWM outputs.

The goodness of having PWM output to the DC motor, the rotations could be control instead of just rotating at constant speed. Giving the users acceleration if needed instead of just velocity.

Now the mind boggling part. How to use the limited number of PWMs on arduino to control 2 small DC motors effectively ??  Try it but at your own risk!!

enjoy the 1 side motor


code here

2 comments:

F.T said...
This comment has been removed by the author.
F.T said...

Great work, and very helpful instruction?

what is arduino