I designed a few little plastic parts to hold the servos together into a structure that can do something. The assembly is meant to resemble a single leg from a hexapod robot, but the current design is much too weak to support any weight. It works fine for playing with motor control software, though.
I designed the motor mounts by playing with SketchUp for a few hours. The first thing I did was grab a pair of calipers and model one of the mini servos. Then I just pushed the motor models around in SketchUp, and draw parts to connect them. This is what I came up with:
I exported these parts to STL and printed them out using my MakerBot Cupcake 3D printer:
I'm still working on tweaking the printer. After a bit of cleanup with a knife and a file, the parts work fine:
I like this 3D printer. It's so easy to go from a rough idea to an actual part!
I did have a lot of trouble getting from SketchUp to an STL file. In fact, the parts I printed out are actually mirrored compared to the design. They work fine that way, though. I've since discovered that getting an STL out of SketchUp is easy if you know the trick to making the STL export plugin work: the part to export has to be exploded for the plugin to find it.
The next step was to try control the arm (or leg, whatever it is.) I hooked the servos up to an Arduino, which has an extremely easy to use servo library. It took no time at all to get the servos responding to a simple test program.
I did have a occasional problem with the stepper motors, where all the motors would just start spasming. It looked like the arm was having a seizure. This turned out to be caused by my powering the 3 mini servos from a 1.5A regulated power supply, which was apparently insufficient. I hooked the servos up to 4 AA batteries instead, and the problem went away.
After demonstrating that servo control with Arduino was a trivial task, I wanted to control the servos from a computer program. To do this, I threw together a quick and dirty program in C#.
A side note here: I use Linux more often than Windows, and I like programming in Python. However, I've found that when I just want to get something with a GUI working quickly, Visual Studio and C# are hard to beat.
I modified the Arduino program to watch the serial port for commands which set the position of each servo motor, and threw 3 sliders onto a form as the UI. This worked as expected, and made it easy to set the angle of each servo. However, even with only 3 degrees of freedom, it's rather difficult to position a robotic arm by specifying the angle of each joint.
So, next part: inverse kinematics. Inverse kinematics is something I've found interesting for a while, but never tried to do anything with. Luckily, it turns out that the inverse kinematics equations for this particular configuration are relatively simple. It still took me quite a few hours to get everything working, though. This is the page I used as a reference: http://www.learnaboutrobots.com/inverseKinematics.htm
I ended up with a picture box which can be clicked on to set the XY position of the end of the arm, while the mouse wheel sets the Z position. It works well, and it's really neat to see all 3 motors moving in tandem to get to the designated position. I also used forward kinematics equations to draw the current estimated configuration of the robotic arm in the background of the picture box. Even without the physical thing hooked up, it's interesting to see the drawn arm and all the sliders move around as the picture box is clicked.
Here's a video showing the inverse kinematics in action:
This is the first time I've tried uploading an HD video. I was going to use Vimeo, but it's not accepting uploads as I write this. I guess I get to try YouTube.
This whole project took maybe 3 days. About 1 day of messing around with SketchUp and printing parts, 1 day to get the Arduino code and basic sliders working, and 1 final day to get all the inverse kinematics stuff working.