Friday, July 24, 2015

Cheap Hexapod Mechanics

I worked to redesign the hexapod using a more robust set of servos. I concluded plastic gear servos would all fail, so I went with the cheapest full metal gear servos I could find online.

I bought a number of servos to test. Most of the metal gear servos had one plastic gear inside. I could generally strip the single plastic gear after rapidly back driving these servos by hand. I only managed to find one all metal gear servo in the size I wanted. These came out significantly more expensive than the older plastic gear servos at around $8 each. Even with the increased cost, the hexapod is still significantly cheaper than typical kits.

Since I got new servos I had to redesign the legs. The original leg design wasn't very elegant, and it didn't take advantage of my 3d printer enough. I redesigned the legs with a more compact collapsing design. In addition, each leg was designed to be fully modular. This gave me more room for an electronics compartment. I also got black resin for my printer. I figured the parts would look more professional if they weren't clear.

 The black resin is very hard to photograph on my white table. The new leg hides the servos much better than the last one. I also through through some of the cable management this time. I even added special conduit in some of the frame parts to keep each wire organized.

I decided to make the main body a single piece. This ended up being my largest print to date. I'm lucky it finished without any major problems. The surface finish on the parts was starting to degrade at this point. I later (after calling Formlabs support) found a single piece of dust on one of the galvo mirrors (the mirrors that sweep the laser to draw the part) will create a very rough and improperly cured surface.

The supports had to extend into the part. this made cleanup a pretty big pain. I integrated all nut holders as well as strengthening ribs into the frame. This part was really complex to draw up. I also made sure to fillet as many corners as possible to reduce the likelihood of shattering the parts.

The first test fit of the parts. It looks like there is a massive amount of room inside the body, however the center hole is the location for the battery and battery cover. I plan to use a small 3 cell (11.1V) LiPo battery. The new body is much shorter than the last hexapod design. The legs also fold up much nicer.

I printed the top cover (raspberry pi mounts to this) and sealed up the body for the first time. I also added some cable sleeves to the servo wires. Unfortunately these are a pretty big pain to deal with. I decided to skip out on them for the final assembly.

I finally ordered all of the servos after finishing the full design and checking to make sure the leg was durable and cleanly implemented. The servos have a blue anodized body. The branding is held on my stickers, so I removed them all to make a very clean looking build.

I also bulk printed the rest of the leg parts. I used a huge amount of printer resin for this project. My desk ended up an unusable mess again...

 After too many hours of assembly I finally completed the mechanics. This thing is pretty massive given the size of my printer. I also love how it is radially symmetric on the outside, unlike the last hexapod design.

 The legs fold up nicely to make a compact frame. The servo wires are left unshielded, but they don't really detract from the aesthetics and shouldn't have any wear issues from rubbing on joints.

 The hexapod gets even bigger when I expand out the legs. It is somewhat hard to make it balance properly without any power on the servos. There is enough gearing to prevent backdriving of the legs if all of the legs are touching the ground.

 The ground clearance is pretty large too. The legs have significantly more range than what is shown. I think I will be able to give this some very life-like animation once I get around to finishing the code.
 The wiring ended up extremely clean. Each servo driver board could handle 16 servos. I only had 18 total, so I split the servos evenly between the two driver boards. This is one of my first projects where I attempted to design for cable management. It really paid off and made the overall build much cleaner.

 I still haven't purchased any batteries for the hexapod, so I run it from a 12V power supply. Everything is controlled and programmed over wifi because the hexpod runs on a raspberry pi. I simply SSH into the os and run everything from the command line. Eventually when I finish the code I'll add in joystick control, but for now I can just enter simple commands.

 Calibration of the legs and most of the testing was done upside down. This prevented the same disaster I had before with the improper walking algorithm. Slamming the entire body weight on one servo due to bad code might break a servo or leg joint. The body weighs enough that it doesn't tip over.

Here is the first test I ran after calibrating all of the leg servos. I found the end points for each servos travel and matched them between all of the legs. The code now knows the angle a leg points when given a particular PWM signal to a servo. Not every servo responded the same, so I had to do each joint individually. This video shows the full range of each joint.

The first (and only) walking test I made was a turn in place. My inverse kinematic models seem to work. I will need to make a generalized walking algorithm in the future.

Overall the new mechanics are leagues ahead of the old design. The newer servos are much more powerful and durable than the old ones, which really justifies the slightly higher cost. I told myself I wouldn't start any new projects until finishing this one. I guess I'm kind of cheating because I made it walk in a circle and I'm calling it "done". I have plans to create a generalized walking algorithm in the future, one that doesn't have predefined gaits. I want the hexapod to walk more like a living creature than a robot.