2009-11-11

Playing with servo motors

I bought some cheap mini servos from DealExtreme to play with.  They're less than $4 each (in quantities of 3 or more.)

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. 


2009-11-05

3D printer: now working better

I've been getting a little frustrated with the 3D printer.  The past couple days, it has continually been failing to get through a printed object.  It starts out well, but after a few layers the extruder starts slipping on the filament.  It digs a nice little notch in the side of the filament instead of extruding it.

I tried extruding hotter and colder, tried with the idler wheel tighter and with it looser.  I even tried taking the insulation off of the heater barrel in case the filament was melting too far up into the barrel.  Some changes made it work worse, but none made it work better.  I've been seeing a lot of this:

These are supposed to be dodecahedrons.

I did finally figure out the problem late tonight.  I completely disassembled the extruder barrel assembly.  It turns out that the PTFE thermal barrier was too tight towards the bottom, and greatly restricting movement of the filament.  I cleaned it out using a 1/8" drill bit (held by hand, not in a drill) until the filament could move through it with no resistance.  I had to remove some more material from the inside of the thermal barrier after screwing it back in to the heater barrel.  Now it works quite a bit better:


See that in the back?  It's a complete dodecahedron!  Here's a closeup:

The one on the right is sitting on top of a green laser pointer.  It glows nicely.

It was exciting to see this part completed.  I was surprised at how well bridging the top material over the hollow inside of the shape worked.

I just realized that I don't have any pictures of the completed 3D printer up here yet, so here are a couple.  The wire routing still needs some work!








2009-11-04

More printed objects

I tried printing a couple more objects today.

I managed to get a complete MakerBot coin printed.  It looks pretty good.  After that, I tried to print a dodecahedron.  Unfortunately, the machine stopped extruding part way through the print each time I tried.

I think the extruder motor keeps going, but the pulley digs a notch into the filament instead of moving it.  I might try tightening the idler wheel a bit, but I'm wary of breaking it.  Maybe I should check that the extruder is still hot when it stops extruding; if for some reason it's cooling off, that would certainly make the filament too hard to extrude.

Here's the completed MakerBot coin, and a partial dodecahedron:

 

2009-11-03

3D printer first partial print

Again I didn't have a lot lot of time to work on the 3D printer today.  I did get a little bit done though, including the first partial print!

I hooked everything up and tried extruding some plastic.  The first time, the plastic filament got hung up somewhere before reaching the nozzle, and the pinch wheel dug an indentation into the side.  After that, I started sharpening the end of the filament before feeding it in, and that seems to work better.  The extruder barrel seems to be slightly crooked in the PTFE thermal barrier (maybe the drilled and tapped portion wasn't drilled quite straight?), and I'm wondering if the un-sharpened filament was hanging up at the top of the metal barrel.

The first few attempts to print something resulted in a mess of spaghetti rather than a coherent part.  After messing with Skeinforge settings for a while, I managed to get a MakerBot Coin partially printed out:


This came loose and got pushed around the build platform before the last couple layers were done.  Still, it's exciting to see the first solid object out of this thing I put together!

These are the Skeinforge adjustments I made to get this far:
  • Thicker raft
  • Hotter printing temperatures
  • Slower printing speed (to get thicker strands)
  • Thinner layers (to make layers stick together better)

2009-11-01

3rd day of 3D printer assembly

Unfortunately, I was only able to spend about 1 hour working on the 3D printer today, so I don't have much more done.

I got the extruder barrel assembled.  I should be ready to attach the barrel to the extruder, the extruder to the printer, then try printing something!

I spent some time trying to diagnose the non-functional optical end stop.  I had already tried a different cable and a different stepper controller yesterday.  Today I visually inspected the board, re-soldered all the joints, and verified that the LED is working and in the right way.  I then powered up the both the bad end stop and a good one to compare voltages.  I measured every joint on the board, and everything appears identical between the good and bad end stops.  The only difference is that if I block the sensor on the good end stop, the LED turns on and the signal line goes low.  On the bad end stop, nothing at all happens when I block the sensor.  I'm thinking that the sensor must be bad.

I sent a message to MakerBot.  I hope they'll send me a replacement.

In the mean time, this will not stop me from getting the printer up and running.  I understand that it's possible to run the bot with no end stops at all, or to run with just 3 (for homing.)

2nd day of 3D printer assembly

I spent another 10 or 11 hours working on assembling the CupCake CNC Kit today.  I've made some progress, but it's not done yet.

The external case assembled:



All 3 axes installed:




Electronics and end stops installed:


Extruder partly assembled:



Even though I don't have the extruder done yet, I tried running the 3 axes once I got the electronics installed.  It actually moves!  I did discover that 1 of the 6 end stops does not work.  I haven't figured out why yet.  The X and Y axes are louder than I expected; I'm not sure if I'd want this sitting on my desk printing away while I was trying to work on something else.

I continue to be impressed with the design of this kit, with the exception of the end stop triggers.  The end stop triggers are popsicle sticks hot glued in place.  The slots which hold the sticks and the optical end stops don't even all line up well, so the popsicle sticks end up angled or offset.  It looks quite messy, especially compared to the quality of the rest of the machine.

There have been a couple times while assembling this that I get something put together,  only to take it apart again a few minutes later when I realize that it could be aligned better.  This isn't really a fault of the instructions; it's more that I don't realize the entire function of each part until I see it all together.

Hopefully tomorrow I'll get the extruder finished.  Maybe I'll take a look at the non-functional end stop as well, and see if I can figure out what's wrong.