We have tried Servo and DC motors already. (Here I’m gonna concentrate a little more on DC motor, since servo is already described in Mika’s course note. ) The difference between the two is:
* You can control the orientation and the angle of movement quite precisely. Normally the angle varies within 0 & 180 degrees, but there are other kinds out there that allow different angle and speed control.
* The directions of the servo motor are declared by default.
*Servo motors have three wires: power, ground, and signal. The power wire is typically red, and should be connected to the 5V pin on the Arduino board. The ground wire is typically black or brown and should be connected to a ground pin on the Arduino board. The signal pin is typically yellow, orange or white and should be connected to a digital pin on the Arduino board.
*You can connect max 2 servos to Arudino’s power. For further voltage, you may need additional power sources (please note: always connect the additional ground to that of Arduino’s).
* Arduino has a library that supports the use of up to 12 motors simultaneously – it is called “Servo”.
*Direction of movement depends on the way you connect it to the circle. As soon as the electrons flow the other
way around, your motor changes the turning direction as well. That presumes that it doesn’t have plus or minus legs by default. You can reverse the direction of movement by reversing the flow of current, which you can do the easiest using an H-bridge.
*It needs more than 5V, so we wanna use some extra
batteries. The batteries and Arduino should share the
same ground (-).
*In order to be able to control a higher voltage , we need
to use a transistor switch as well.
*to reverse the direction you might need an H-bridge.
Finally, let’s test it… (code)