The Lab has started a weekly Arduino session here in the studio where we can share knowledge and explore technologies together.
So far we’ve had a few sessions:
Week 1: Intro to Arduino
Week 2: Potentiometers and sensors for variable resistance
Week 3: Accelerometers and physical menu show and tell
We thought we’d share our notes from Week 4, where the topic was motors and motor control with Arduino:
Smart Arduino session Feb. 28, 2012
Topic: DC, servo and stepper motors
Motors aren’t really polarity dependent, but the direction will change based on how you have the polarity.
You don’t really have a lot of control over how fast it goes, but to control it you can use a potentiometer and tune it so that it’s not running at full speed.
Can also use PWM instead of the potentiometer to set the speed of the motor, allows you to get slower than your cutoff voltage.
To get your motor to go bidirectional, you use an H-bridge – you can switch the positive and the negative.
H-bridge unit off the shelf: SIMPLE BRIDGE solutions cubed board (http://www.solutions-cubed.com/solutions%20cubed/SB1.htm)
Also good because you can provide more voltage than the micro-controller (arduino) can provide. You want to keep the voltage separate so you don’t fry your arduino. Can use a voltage regulator (7805) to give the Arduino just 5 V. Capacitor (22 microF also smooths out the spikes).
You can also use an H-bridge chip with software programming: http://tigoe.net/pcomp/labs/lab-motors.shtml
Has a limited range of motion. You send it a PWM signal which corresponds to a specific position. You can use a pot to control the position you want the servo to be in. http://www.sparkfun.com/products/9347
Can easily hack a servo to make it like a regular motor with speed control instead of position control by just taking the cover off.
Here’s a GREAT link for info about servos: http://makeprojects.com/Wiki/Servos
You can also hack a servo to get feedback about its position: http://www.instructables.com/id/Servo-Feedback-Hack-free/
Gives you really precise degrees and speed (e.g. Turn 35 degrees in 100 steps)
Unipolar versus bipolar. Bipolar 8 wire gives you more control
Sparkfun actually sells a 4-wire stepper motor (http://www.sparkfun.com/products/9238)
Ben recommends getting the motor controller that sparkfun sells to work with the stepper because otherwise it’s a headache to time your pulses. (http://www.sparkfun.com/products/10267)
Some applications are like printers, CNC machine, places where you need very precise control.
General tip: it’s a good idea to use diodes with motors so that the current doesn’t shoot back. Good idea to not run the motor from the same power source as the micro-controller.
Special thanks to Ben Chao for sharing his motor know-how.