• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Stop wasting time looking for files and revisions. Connect your Gmail, DriveDropbox, and Slack accounts and in less than 2 minutes, Dokkio will automatically organize all your file attachments. Learn more and claim your free account.



Page history last edited by PBworks 12 years, 5 months ago

Making things move

In this series of examples, we'll look at actuation - moving things around in the world.

Standard Servo

Standard servo motors have a 180 degree range of motion. They cannot move continuously but you can position them precisely.

Servo connectors have three wires: power (red), ground (black), and a signal line for position control (white or yellow). To position the servo, the Arduino board uses a version of pulse width modulation similar to the one we used to dim the LED earlier on. This means that you can only attach servos to pins 9 or 10. Also, servo motors draw more current than sensors or LEDs. To make sure your USB hub does not get overloaded (it may be turned off by the operating system for protection in that case), power any project using motors from the 9V battery: take the shield off, move the power jumper to the left, put the shield back on. Stick a three pin .1" header onto the breadboard, then connect the servo to it.

One useful application of servo motors is to create a physical gauge.

Cut out an arrow or indicator needle shape out of a post-it note and stick it onto the servo:


Now open example servo_01. Run it.

The mouse's X position in the canvas is now linked to the servo position: as you move the mouse, the servo follows.The slider widget is linked to the servo position: drag it with the mouse and the servo will follow.



  • Revisit the thumb wrestling machine and add a physical gauge that points towards the person who is pushing harder.
  • Use the gauge to show how many characters per second you are typing on the keyboard, or how many mouse miles you have accumulated.


Continuous Servo

The continuous servo is a modification of the standard servo - you can control whether it moves forward or backwards, and how fast it should rotate. You cannot position it precisely. Just swap out the servo keeping the other connections intact from the previous example. Run again.



  • Use the accelerometer to move continuous servo fwd/backwd


Vibration Motor

Finally, an example for DC motor control. This simple circuit, courtesy of Tom Igoe, can only switch the motor on or off - there is no speed or direction control. This circuit is adequate for controlling vibration motors such as those found in pagers and cell phones.


The component in the middle is a transistor that can switch larger loads. Pins on the Arduino board itself can only source or sink ~20mA - not enough for most motor or solenoid applications. The three pins on a transistor and the gate, base, and collector. In your kit, you have a TIP120 transistor. Here is the mapping from the transistor symbol in the circuit to pins on the TIP120:


In the circuit, note the direction of the diode - if your motor is permanently on, you probably have the diode reversed.


Also note that the small pager motor in your kit should be driven off 3V, not 5V.

The code to control the motor is identical to the code we used at the beginning of this tutorial to switch LEDs on and off (example vibra_control_01).

Here's the complete circuit on a breadboard:





Comments (0)

You don't have permission to comment on this page.