Page 192 - Making things move_ DIY mechanisms for inventors, hobbyists, and artists
P. 192

170        Making Things Move




               the motor to a position proportionally  FIGURE 6-32 A PPM signal
               between 0° and 180°. If you want
               the motor to stay put, you just keep
               sending the same pulse width.

               A potentiometer meshes with the
               gears in the servo to tell you exactly
               where the shaft is at all times. This is
               called closed-loop feedback. You can
               generate this pulse in hardware or
               software, or use a radio-controlled
               (RC) transmitter (like the ones found
               in model airplane kits) to send the
               signal to a receiver that talks to the motor.


               P   roject 6-8: Control a Standard Hobby Servo


               We’ll use the Arduino in this example to generate the pulse, as we did in Project 6-7.
               However, instead of using the pulse to control the speed of a DC toy motor, it will
                                                       9
               control the pointing direction of a servo motor. This time, we’ll use a code library
               (which is just a bunch of code that’s already written for you).

                 NOTE     You can also take the long way and not use the servo code library.
                 It’s more involved but also gives you more control. For details, see Section 4.1,
                 “Using the pulse method,” at http://itp.nyu.edu/physcomp/Labs/Servo.

               Shopping List:

                   • Arduino Duemilanove with USB cable
                   • Servo motor (Hobbico CS-60 used here)

                   • Breadboard (like All Electronics PB-400)
                   • Jumper wires (like SparkFun PRT-00124) or hook-up wire to make your own
                     (see Project 6-4)
                   • Male header pins (SparkFun PRT-00116)
   187   188   189   190   191   192   193   194   195   196   197