This week, we’ll finally be using the Arduino to control some motors! First up, we’ll control a standard DC motor running off a 9V battery with the help of an NPN transistor and a PWM (Pulse Width Modulated) signal from the Arduino.
Next, it’s onto 180 degree servo motors, which we will power on an independent 5V rail using a voltage regulator. We’ll control the servo using a PWM signal from the arduino, and I’ll show you how you can turn analog distance readings into precise angles for the servo to turn to!
I mention in the video that you can control DC motor direction using an H-Bridge. If you want to wire that up, take a look through this Wikipedia article, and read through this tutorial.
If you want to learn more about analog input filtering in software, check out this example code.
The Arduino Contest has been extended! So don’t forget to submit your project.
You can download the files associated with this episode here:
1. Arduino Uno: http://us.element-14.com/arduino/a000046/arduino-uno -board/dp/13T9285
2. USB Cable: http://us .element – 14.com/jsp/search/productdetail.jsp?SKU=73H0884
3. Arduino Software: http://arduino.cc/en/Main/Software
4. Breadboard: h ttp://us.element -14.com/jsp/search/productdetail.jsp?SKU=17C6965
5. .1uF capacitor: http://us.element-14.com/nichicon/uvz1h0r1mdd1td/capacitor-alum- elec -0- 1%C2%B5f-50v-radial/dp/65R3169
6. 22uF capacitor: http://us.element-14.com/rubycon/50yk22m5x11/capacitor-alum- elect -22uf -50v-radial/dp/38M6812
7. 5V Regulator: http://us.element-14.com/jsp/search/productdetail.jsp?SKU=89K0746
8. 9V Battery Clip: http://us.element-14.com/bud-industries/hh -3449/battery-clip- 9v -wire -lead/dp/34M2183
9. NPN Transistor: http://us.element-14.com/jsp/search/productdetail.jsp?SKU=18C9246
10. 1k ohm Resistor: http://us.element-14.com/multicomp/mcf -0 -25w -1k/resistor-carbon – film -1kohm -250mw/dp/38K0327
11. 1uF Capacitor: http://us.element-14.com/vishay -bc -components/ k105z205ve5th5/capacitor -ceramic-1uf-25v5v-radial/dp/95C0982
12. 1N4004 Diode: http://us.element-14.com/vishay -general- semiconductor/1 n4004 – e3- 54/standard-diode-1a -400v -do-204al/dp/78K2126
13. IR Distance Sensor: http://us.element- 14.com/sharp/gp20a41sk0f/dp/14N9318
14. Geared DC Motor: http://solarbotics.com/products/gm8/
15. Servo Motor: http://www.sparkfun.com/products/9064
16. Jumper Kit: http://us.element-14.com/3m/923351-i/pcb-accessories/dp/65F2290
For more detail: Arduino Motors and Transistors