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

180        Making Things Move





                     Created 2010.06.01
                     By Ben Leduc-Mills and Dustyn Roberts
                     */
                     #include <Stepper.h>   //import stepper library

                     #define STEPS 200   //this should equal the number of steps our
                                         //motor is rated for
                     Stepper stepper(STEPS, 8, 9); //goes to Arduino digital pins 8
                                                    //(DIR) and 9 (STEP)
                     void setup()
                     {
                     stepper.setSpeed(200);   //set speed of stepper in RPM
                     }

                     void loop()
                     {
                       stepper.step(6400);   //turn one full rotation
                       delay(100);   //wait 1/10th of a second
                       stepper.step(-6400);   //turn one full rotation the other way
                       delay(100);   //wait 1/10th of a second
                     }

                10. Your motor should now rotate back and forth! Try putting a little flag of tape
                     on the motor to help you see what’s going on.

               Linear Motor Control

               Linear motors are essentially DC motors that interact with a power screw assembly to
               make a plunger go in and out, so you can control them in the same way that you
               control DC motors. Just apply a voltage across the two wires within the stated
               operating range, and you’re set.

               The total distance the plunger travels from out to in (or in to out) is called the stroke
               distance. You may want to use the Arduino and/or switches to limit the stroke
               distance to create whatever movement you want. Most linear motors come with
               integrated switches and/or a potentiometer to help you control the speed and
               position.

               Solenoid Control
               A solenoid is controlled like a DC toy or gearhead motor, in that all you need to do is
               apply the correct voltage with enough current across the two connections, and it will
               move. Pull-type solenoids pull the plunger into the housing, and push-type solenoids
               push the plunger out.
   197   198   199   200   201   202   203   204   205   206   207