Impatient? Here's the short take.
- Provide suitable power to your servos See Hardware Interface..
- Download and install the Sweeper Library.
- Start with the example sketches provided, experiment and learn. See the video to see them in action.
- Read more when you need to know more.
- Servos need independent power! Initially, I used a 6V, 1A wall wart. Ran 6 SG-5010 and 2 SG90 servos simultaneously for a few minutes and the wall wart was just barely warm. I didn't try to find the limits of this setup. It worked for testing. Servos are really happiest (most of them) with 5V, not 6V. So I'm now using a 5V, 2A switching supply. If you use a lot of motors (more than 4 to 6 or so?) you may need a beefier supply. YMMV. If your motors are loaded heavily, obviously you'll need more power. Test your system by running a single motor, then add more one at a time. If the motors stop moving reliably, then you should increase the power available. The worst case is likely to be when several motors all need to move rapidly at the same time.
- I built a simple board to connect power and the control signals. The schematic and a picture of it are attached. (See ServoIntrf.png and ServoInterface.pdf.) Doesn't get much simpler. The two big caps are there to smooth out surges during servo motion. But if you aren't into building hardware, simply search Ebay for "Sensor Shield Digital Analog Module Servo Motor for Arduino UNO R3". The file ServoBoard.jpg shows a picture. For about five bucks with shipping, this is a good way to go.
Installing the Sweeper Library
Sweeper.zip is the zipped Sweeper library. To install library, download the zip, open the Arduino IDE, go to Sketch > Include Library > Add .ZIP Library, and then select the Sweeper zip file that you just downloaded. No need to restart Arduino, the Sweeper Library will now be available. Note that you must also install the Servo library, if it's not already done, to use the Sweeper library. The elapsedMillis library must be installed to run the demos. These can be installed with the Library Manager.Read more »