My family and I had visited Ocean Beach in San Francisco on numerous occasions throughout the spring and summer months of 2015. Each time we were there we noticed dozens and dozens of empty crab shells all over the beach. Some were very tiny, less than a few inches. Most where mid-size, about 4-6 inches wide. A few were much bigger. Nearly all of them were missing their legs and underbelly. The only thing that seemed to survive was the outer top shell. I decided to bring a variety of them home and create some kind of project with them.
After considering numerous ideas, the one that stuck with me was to create a cast of crab robots. I loosely followed appytechie's Instructable for building an insect robot. The reason I say loosely is because I knew upfront that the bots I wanted to build would be less insect-y and more crab-y. I wanted the beauty of the shell and the essence of the crab to be the prominent features of the bot. So I used only the movements from the insect bot. In addition, this project was not an attempt to simulate the realistic and complex movement of a crab. Instead it was to create something unusual and fun and somewhat creepy.
Step 1: Parts
These parts are to build a CrabBot with a crab shell that is 6" wide x 4.5" deep x 1.5" tall. For different sized crab shells, different sized parts will be needed particularly if the shell is smaller. The hardest problem I faced was finding room for the power supply, 2x 9v batteries. If you choose a different power source, you may have an easier time fitting everything together, or not.
- 6" x 4.5" x 1.5" crab shell
- Ultra-Glo polymer coating
- small plastic cups
- small brush
- popsicle sticks or stirrers
Crab Shell Stand
- long nails
- wooden block or platform
- aluminum foil or drip mat
- Arduino Nano without headers
- Short pin female headers
- 9g servo (x2)
- DPDT slide switch
- 9v batteries (x2)
- Variety of color wire
- Coat hanger wire
- Fishing line or thin wire
Since the crab shell has limited space a small microcontroller is necessary. The ideal Arduino is one that is small and without headers. Most Nanos have male headers soldered on the underside. This creates a profile that is too tall. I happen to have Nanos that have no headers and I happen to have an extra set of female headers. Putting these together I can have a Nano that is smaller in profile but still have the pluggability for experiments.
Step 2: De-Stinkify the Shell (aka Clean the Shell)
After a few days the crab shell will smell pretty rotten, pun intended. Scrap off any of the dead tissue and remove all loose sand. If there's a shell with a barnacle, like one that I found, remove the inhabitant, if any, and clean out the hole. Now boil the shell. This should kill anything that may still be still living on the shell.
Step 3: Modding the Shell
Trim off any excess shell along the inside bottom edge. The goal is to make sure all the components fit inside.
If the shell is big enough, one mod to make is to replace the eyes with lasers. Use a sharp knife or something to pry the eyes out. Clean out the sockets. Drill holes big enough to fit the lasers. The holes may need to be made bigger so that the lasers are parallel with each other or so that they point straightforward. Just be careful not to drill too much away. Do not yet permanently attach the lasers.
If the shell has a barnacle and it is big enough, another mod can be to put an LED inside it. Drill a small hole through the shell just large enough to get the LED leads through. Permanently attach the LED with hot glue.
Step 4: Hardening the Shell
The crab shell is quite delicate. It seems to deteriorate over time. As is, it would be impossible to mount electronics inside the shell without the shell cracking after a few bumps and jolts and falls. So the shell has to be hardened.
TAP Plastics suggested I use Ultra-Glo. It is a polymer coating that is easy to apply - just pour. Be careful. It can get very messy and very sticky.
Build the Crab Shell Stand
UG has the consistency of syrup. Once the application begins, handling the crab gets very messy. Once it begins to set, it becomes very, very sticky and nearly impossible to handle. A stand is needed as a way to hold the crab securely while applying the UG and then letting it cure for 24 hours.
I built something very simple: nails in a block of wood with an aluminum foil drip pan. The nails are positioned to accommodate a variety of shell sizes. The drip pan is made from 2 layers of aluminium foil just to be safe.
Apply the Ultra-Glo
The Ultra-Glo kit has detailed instructions how it should be applied. They should be referenced before continuing. In essence, measure equal amounts of the two chemicals into a plastic cup and mix together very thoroughly.
The application of the UG happens one side at a time. It has to completely hardened on one side before applying the other side. Since it takes about 24 hours to harden, this entire process of covering a crab shell takes about 2 days to complete. Keep this in mind when finding a place to let the UG harden. For me, I had to find a place where my cats would not rub up against the shells. Lastly, be sure to completely cover the shell with the polymer for it will mask all of the rotten smell that may have remained after the cleaning.
Start with the shell upright. Liberally pour the solution all over the crab. Let it drip off naturally onto the foil. Use a brush to scoop up the fallen solution and drip it back onto the top of the crab. Keep doing this until all of the crab is covered. Wait for some minutes and do this again. Keep doing this for a few layers. If the solution thickens too much, just stop.
After 24 hours or so and the coating has hardened, turn the shell over and do the same thing on the inside. Since the inside of the shell is concave, the solution will pool in the center. Use a brush to push the solution to all corners of the inside of the shell. Be sure to coat the inside of the eye socket area. Every few minutes keep pushing the solution to the corners. Do this until the solution thickens too much.
Step 5: Installing the Components
This is probably the hard part of the build. It is quite difficult to work in a small confined space, to get everything inside the shell such that the power can be charged or replaced in the future. Also because the shell is not flat, one has to find a way to mount the servos such that the angle is not too extreme.
Layout The Components
Layout the components inside the shell trying to find a way to get everything to fit. If there is not enough room, either a bigger shell is needed or the components need to be smaller. The rest of the instructions assume that the components will fit.
Place the lasers inside the eye socket. Try to point in a parallel direction and straight ahead. Hot glue them into place on the inside of the shell. The sockets may need to be drilled out again if the Ultra-Glo filled in some of the space.
The servos need their own power supply separate from the Arduino. Since I'm using 9v batteries, which drain fairly fast, they need to be placed in the shell such that they can easily be replaceable. The easiest layout seemed to be dead center, laid out left to right with the terminals towards the outer edge of the shell and held to the shell with Velcro.
Make sure that the front and back servos have room sit and maneuver.
Front and Back Servos and Mounts
The servos will most likely not be able to mount directly into the shell and still move the servo arms properly or fit between the batteries and the edge of the shell. If this happens, they have to be lifted. I used my son's Lego pieces to create mounts. This made it easy to build up the mount height so that it was well above the batteries while allowing for rotational clearance of the servo arms. The only thing to keep in mind when hot gluing down the mounts is to keep the mount angle flat with respect to the bottom of the shell. Don't let servo mount take on the concave angle inside the shell.
The front servo is mounted on its side. This will lift the crab side to side. The back servo is mounted on its bottom. This will push the crab forward with its left and right legs.
On/Off Slide Switch
Mount the on/off switch somewhere convenient. I put mine behind the back servo.
Cut two 12" lengths of coat hanger wire. Create a bend dead center. Bend them to the point where it can be wired to the servo arms (see picture). I double wrapped the wire onto the arms with fishing line. I also tacked them down with hot glue. Use whatever works to keep them down, from breaking, and from moving.
The easiest place to put the microcontroller is right on top of the batteries. The Velcro to hold it in place should be long enough to act as an insulator between the battery metal and the controller. Put half the Velcro on one battery and the other half on the other battery. Solder female headers on the topside of the controller. This makes it easy to attach and remove wires based on experimentation.
Step 6: Wiring and Programming and Adjusting
The wiring is pretty simple. Connect one power source to the two servos, connect the servo signal wires to the Arduino, connect the lasers to the Arduino, and finally connect the other power source to the Arduino. Leave opportunities to add additional components such as sensors.
The programming is also very simple -- it just walks forward. It is written to figure out the wire angles and the coordination of the legs. Once walking has been perfected, sensors will be added and the programming will change.
For this Instructable, this part of the project I've kept it simple, stupid on purpose. There are a variety of walking methods in the attached file. Deciding on the exact method to use (or defining the perfect method to use) is really based on the attributes of the bot. The angles of the legs are based on the weight of the bot, its height, the position of the servos, and their power. Sometimes small moves seem to work better than large moves. Sometimes it is the opposite. It takes a lot of experimentation.
Step 7: Lessons Learned
Don't Buy Cheap Servos
It is very frustrating when a servo can't find its home anymore or it does so every so often. It's hard enough to debug the Arduino code without the servos freaking out.
The weight of the bot adversely affects the ability of the servos. I could have used larger servos but they would not have had a slim crab-like profile. LiPo batteries are probably a better choice of weight to power ratio than 9v batters, but I didn't want to wait for an order to arrive.
If I had to do it all over again, I would have chosen stronger, more reliable 9g servos and a 11v LiPo battery to power everything.
I underestimated the versatility of Lego. It can be used as a building block possibly for all situations. And once it is in the necessary form, hot glue (or Kragle) keeps it together very well.