This robot was created with disposable bamboo chopsticks, Polymorph and an Arduino-compatible controller. I have tried to keep the sample code reasonably simple with no complex math and with detailed explanations on most lines.
Multi-limbed robots such as hexapods can be very complex and expensive. This is a relatively cheap and simple 8-legged robot made with chopsticks, Polymorph and an Arduino-compatible controller. Most of the servos cost under $8 if you shop around. I have seen the 12Kg/cm servos for as little as $13 at HobbyKing.
The construction is pretty easy but takes time as you often have to hold parts in position and wait for the Polymorph to cool. Patience is definitely a virtue. Cold weather will speed things up.
This project will show you how to make an 8-legged spider robot. As you need 3 servos for each leg the servos are the most expensive component. You can make fewer legs for a quadruped or hexapod if you wish to save money.
I used two pan/tilt kits fitted with IR compound eyes for close-range object tracking. These are relatively cheap and give your robot the ability to play with people which adds a lot to its personality. See the videos below.
A glass-top table is best when using Polymorph. You need a flat workspace that the Polymorph won't stick to. If you have a wood table then keep the top wet or put a sheet of glass on top.
You will need a rag, a constant supply of hot water, a bowl for the hot water (not plastic as the Polymorph may bond to it) and a cup of cold water (ice will speed things up) for cooling the Polymorph. Coffee is optional. :)
When you dip hot Polymorph in cold water for a few seconds the outside will cool rapidly forming a milky, flexible skin. This will prevent the Polymorph from bonding to your servos. The exact amount of time required will depend on how hot your Polymorph is and how cold the water is. A slightly milky appearance is your best indicator.
For each leg segment I used a 230mm chopstick cut in half, each segment being about 115mm in length. Cut 16 chopsticks in half with the side cutters now so they are on hand when the Polymorph is hot.
I have used pan-head self-tapping screws for this project. Polymorph is perfect for self-tapping screws and the pan heads eliminate the need for washers.
Polymorph is actually Polycaprolactone, a non-toxic, re-usable, biodegradeable plastic. You can read about it here.
Boiling water can be dangerous. This project should not be attempted by children without adult supervision.
Put in only as much Polymorph as you need. If you put in too much at once you can end up with a big lump that is slow to reheat.
When you put the Polymorph granules into the hot water they will quickly become transparent and sticky. Once all the granules are transparent use a chopstick (because the water is very hot) to remove some from the bowl. Squeeze it gently in your hands to remove water trapped inside.
The Polymorph is now a putty that can be easily shaped by hand. At this time it will also stick to objects so be careful where you put it. It can bond to the plastic servo housing if it is too hot. As it cools it will slowly harden and become white again. When completely cooled it is a plastic similar to nylon.
The first piece to make is a cradle for the thigh servo. This piece allows the thigh servo to be attached to the hip servo. As the robot can be quite heavy this part needs to be quite strong. The thigh servo clips into this piece tightly with 4 mounting screws ensuring the servo cannot unclip.
Roll up a ball of Polymorph about 30-35mm in diameter. Then roll the ball into a thick rod about 40mm long. Dip this in the cold water for a few seconds to ensure that the Polymorph does not bond to your servo.
Wrap this rod around your servo as shown in the photo making sure you have enough Polymorph around the servo mounting holes for the mounting screws.
Press your servo horn gently into the Polymorph making sure it is reasonably well centered. Do not press too hard as you need at least 3-4mm of Polymorph behind the servo horn for the mounting screws to go into.
As the Polymorph cools, remove the servo horn and poke a hole about 6mm in diameter in the center of the servo horn impression. This will allow you to insert the screw that holds the servo horn to the servo.
Once it has fully cooled you should be able to unclip the servo. If your Polymorph was too hot and bonded to the servo then use a flat-blade screwdriver or a knife and gently pry the Polymorph away from the servo.
Mount your servo horn with 2x6mm pan-head screws. Attach the servo cradle to the hip servo and align it so that when the hip servo is in the center position the thigh will be perpendicular to the body.
The next piece is the thigh. The chopsticks are usually tapered with a thick end to be held and a thin end for holding the food. Use two thick sections for the thigh. We will use the thinner sections for the legs. My chopsticks are square at the thick end and round at the thin end but the shape is not important.
Start with a small ball of Polymorph about 10-15mm in diameter and roll this into a thick rod about 40mm long. Press your chopsticks into the ends of the Polymorph rod while it is very hot so they bond. Press the Polymorph fully around the ends of the chopsticks so it covers about 10mm of the chopsticks.
Dip the Polymorph into the cold water for a few seconds and then place a 5Kg/cm knee servo between the chopsticks. Shape your Polymorph so that the servo is held firmly between the chopsticks with a solid section for the servo mounting screws to dig into.
Hold everything in place for a few minutes while the Polymorph cools and hardens. Once it is completely cool the servo should be a tight fit between the chopsticks but easily removed. Insert two 8x2mm mounting screws to hold the servo in place.
To make the small servo mount for the other end, get a small ball of Polymorph about 10-12mm in diameter and roll it into a thick rod about 20mm long. Dip this in cold water for a few seconds. Now press it into the other servo mount and make sure it goes around the chopsticks enough so that when cool it can slide along the length of them without falling out. This makes it easy to remove the servo if you need to replace it.
Once the Polymorph has hardened use two 8x2mm pan-head screws to fix the servo to the new servo mount.
Now get a big ball of Polymorph about 25mm in diameter. Squash it flat and wrap it around the other end of the chopsticks while the Polymorph is very hot. You should have a flat area big enough to mount another servo horn.
Dip the Polymorph in cold water for a few seconds and then gently press a servo horn into the Polymorph so it sits flat and makes an impression in the Polymorph. While the Polymorph is soft, create a 6mm-diameter hole in the center for the servo horn mounting screw to go through.
Once the Polymorph has cooled mount the servo horn using 2x6 pan-head screws. Make sure the hole for the servo horn mounting screw lines up with the center of the servo horn.
Your thigh segment is now complete and can be mounted on the thigh servo. Align your thigh so that when the thigh servo is in center position the thigh is parallel to the ground.
The leg is made using two of the thinner halves of the chopstick. Get a ball of Polymorph about 25mm in diameter and poke your two chopsticks into it, one on either side, while it is very hot. Knead the Polymorph around the chopsticks and hold the other ends of the chopsticks together to form a "V" shape.
Wet a spot on the table so that the Polymorph wont stick and then squash your ball into a thick disc on the table. Poke a 6mm-diameter hole in the center of the disc for your servo horn mounting screw.
While the Polymorph is still soft, gently press a servo horn into the Polymorph to leave an impression. Make sure the hole in the center lines up.
While the top of the leg is cooling get a small ball of hot Polymorph and squash it around the other end of the chopsticks to make a foot.
Once the leg has cooled, mount the servo horn with 2x6mm pan-head screws. Mount the leg so that when the knee servo is in its center position the leg is at 90 degrees to the thigh.
Repeat steps 3-6 until you have as many legs as required. Remember to make left and right legs in equal numbers.
Join your left and right legs together in pairs. Start by making another ball of Polymorph about 15-20mm in diameter. Roll it into a short rod about 40mm long.
While the Polymorph is very hot, press a thick section of chopstick into each end and knead the Polymorph so it covers about 10mm of each chopstick.
Dip the Polymorph in cold water for a few seconds and then place the chopsticks either side of a left hip servo. Note this time I've put the Polymorph on the other side of the servo mount. This allows my mounting screws to be inserted from the top of the robot instead of the bottom.
Make sure the chopsticks are pressed tight against the sides of the servo and there is plenty of Polymorph for the servo mounting screws to dig into. Also check your clearance so that the hip can swing freely.
Once the Polymorph has cooled, use 2x8mm pan-head screws to secure the hip servo. Repeat the process at the other end with the right hip servo.
There should be a gap between the left and right hip servos in the center of the frame you just made. Roll up a ball about 20mm in diameter and dip it in cold water for a few seconds. Press it into the center between the two servos.
While this center piece is cooling, make an impression in the center with your finger so the Polymorph is only about 4mm thick in the center. Use a skewer to poke a small hole about 3mm in diameter through the center for a mounting screw to go through.
A spine can be made from two whole chopsticks. Roll up a hot ball of Polymorph about 20-25mm in diameter and press your two chopsticks into it. Knead your Polymorph around the sticks so they are parallel with a gap of about 3-4mm in the center. Dip it in cold water for a few seconds and check that it fits between the servo pairs. Adjust your center gap for a neat fit.
Do the same at the other end so that your chopsticks remain parallel. Wet the table top slightly so the Polymorph doesn't stick and press your spine gently on the table top to ensure it is completely flat when the Polymorph hardens. You may wish to extend the ends slightly so you have a section of Polymorph where you can mount sensors, switches etc.
Now that the spine is flat and rigid you can add two more smaller balls of Polymorph at equadistant points along the spine.
Make sure each ball is hot so it bonds with the chopsticks and knead it evenly around them. Dip it in cold water and then check that it fits between the left and right hip servos.
Once again wet the table top and press the spine gently against the table top so that the spine sits completely flat on the table while the center pieces cool.
Use 2.3x12mm screws to fix your leg pairs to your spine.
Mount your battery in the center of the spine using 4 large cable ties. Make sure your battery cable goes to the back of the robot as this is the most convienient place to mount your power switch. Try to center the weight of the battery so that all legs support the weight equally.
If your battery will not fit neatly between the servos then you may need to make an additional bracket with Polymorph and chopsticks to mount your battery on.
Remember that your battery may get hot when fast-charging. If it is sitting on Polymorph then it might melt the Polymorph. Place small sections of chopstick between your battery and the Polymorph for thermal insulation.
Now you need to build a frame to mount your controller and other electronics on. Plan this stage carefully allowing for your choice of battery, charging circuitry, controller etc. If you do make a mistake the chopsticks are cheap. Just put the frame in hot water to reuse the Polymorph.
As the legs can fold up, your frame should hold your circuitry above the legs when they are folded. This makes the electronics easy to access at all times without limiting leg movement.
I've used two whole chopsticks for the long sections. The cross sections are 80mm, about 10mm wider than my controller. The vertical pieces making the "V" shape are my standard chopstick halves (115mm).
Wet a section of your table so the Polymorph won't stick and make a rectangular frame using two full-length chopsticks and 3 shorter lengths (80mm in my example). Start with the 4 outer corners and then the middle section allowing for the size of your controller board.
In the section where your controller will mount, squeeze out the Polymorph to make some mounting tabs in the corners. You can see in the second photo how this helps mount the controller. I've used some of the mounting equipment that came with the servos as spacers.
Before the Polymorph hardens, set your controller in its place. You can use the controller to make sure the frame is square and use the skewer to make indentations where the mounting screws will go. Let the frame harden while sitting flat on the table.
Now add your "V" sections made from chopstick halves. Choose your placement carefully allowing for the position of your battery. With your frame on the table, hold your "V" sections in place until the Polymorph sets.
Use more Polymorph to mount your frame onto the spine of the robot. You might choose to simply wrap Polymorph around the spine and tip of the "V" sections fusing it all into a single piece as I did or you might be clever and make it so your frame clips onto the spine and is then locked in place with some screws.
Now is a good time to run your power cables, mount your fuse, switch and any special recharging circuitry. As I am using a 4500mAH NiMH battery my recharge circuit is just a 2.5mm socket with a 6.8 Ohm 3W resistor in series. This limits my charging current to about 700mA when I plug the robot into a 12V 1A power supply.
If you use a LiPo battery then you must use the correct charger for that battery. LiPo batteries can catch fire or explode if not charged correctly. They cannot be "trickle charged".
Use good quality, heavy-duty cable (AWG 8 or 9) for your power cable. If your cable is too thin then it will cause your voltage to drop when your servos draw a lot of current which can cause your controller to reset.
I have used a solid-state high-powered switch from DAGU controlled by D12 of my controller. This allows my controller to power the servos after it initializes. The diagram shows the best way to connect your power.
I've made a small platform out of Polymorph at the back of my robot to mount my switch. I simply squashed some Polymorph between the flat table top and the bottom of a ceramic dinner plate to get a flat sheet about 3mm thick. I pressed my switch gently into the soft Polymorph to get an impression of the mounting holes. Use the skewer to poke holes for the screws. When the platform had hardened I cut it to shape using the side cutters.
By holding just the back of the platform in hot water I made it soft so it would bond easily with additional Polymorph I had wrapped around the "V" section of my frame. I then held it in place with a cable tie until it had fully hardened.
Mount your controller on the frame using 2x8mm screws. I used some of the servo mounting hardware as spacers to raise the board slightly.
The servos I used have a 6V rating so I have used diodes to drop 7.2V down to 6V. I have put 4x 3A diodes in parallel to make a 12A diode. I then put two of these diodes in series to give me a total voltage drop of 1.2V. I soldered my diodes together freeform and cable-tied them to the frame. This is not required for 7.2V servos.
You can make your own shield from standard prototype PCB if you wish. Unlike standard Arduino controllers the Spider uses standard pin spacing.
Connect your servos to your controller. Pay careful attention to the orientation of the plugs. In my sample code the legs are numbered the same way as a microchip. Front left is leg1, rear left is leg4, rear right is leg5 and front right is leg8.
The digital pins for the servos are: D26 thigh4, D27 thigh3, D28 thigh2, D29 thigh1 D30 knee 4, D31 knee 3, D32 knee 2, D33 knee 1 D34 hip 4, D35 hip 3, D36 hip 2, D37 hip 1 D38 hip 8, D39 hip 7, D40 hip 6, D41 hip 5 D42 knee 8, D43 knee 7, D44 knee 6, D45 knee 5 D46 thigh8, D47 thigh7, D48 thigh6, D49 thigh5
You can download a simple servo alignment program here. This program sets your servos to center position. With your leg servos plugged in to digital pins 26 to 49 your robot should be standing with all hips perpendicular to the body. Thighs should be parallel to the ground and all legs perpendicular. Adjust your servo horns as best as you can. The servo positions can be fine-tuned in the software.
Because all the legs are made by hand, each leg has slightly different dimensions. Each servo center position will need to be adjusted slightly to compensate.
It is possible to damage a servo by trying to driving it past its physical limit. This photo shows the motor from a new servo. The brushed are burned and deformed because the motor regularly stalled from being over-driven.
The servo library for the Arduino allows you to set minimum and maximum limits for your servos when you use the servo.attach() function. This is an important feature as it can prevent a bug in your code from destroying your servos.
A positive pulse 1500uS wide sent every 20mS should center your servos. Different brands will accept different ranges of signal. 1000uS - 2000uS is the standard but many servos can work beyond this range.
You should test your servos to determine the range of your input signal before the servo hits its limits. Use these values in the servo.attach() function to protect your servos.
From here on it depends on how many legs you made and what sensors you use as to how your robot will turn out.
I remounted my diodes onto the shield to neaten the appearance. Then I added two pan/tilt brackets from DAGU along with four IR compound eyes. Each pair of eyes is wired in parallel to work as a single eye. As each eye can independently track an object at close range the robot gets a bit confused about which direction to go in sometimes. Video of it playing can be seen here.
To use my sample code you will have to tweak the servo center positions for the 3 basic positions, Sit, Stand and Curl Up. Make return; the first command of the loop() function so that the robot holds its position after the servos initialize.
The variable pos must be initialized to the position you want the robot to stay in. 0=Sit, 28=Stand and 56=Curl Up.
You can now adjust the servo center positions at the beginning of the program until the robot's position is correct. When you are happy with the positions, remove the return; command from the loop() function and change pos back to 28.
You will also need to check which way your servos rotate. I changed knee servos recently and found they rotated in the opposite direction to the old servos. Fortunately the walk sequence code is easily modified.
If you are having problems with your robot and need help or want the latest code then go here. As well as myself, there are many people on LMR who are happy to help.
The Spider controller has a lot of I/O pins. Don't be afraid to experiment.
Adding an IR LED and phototransistor to each foot will let the robot determine if it has come to an edge such as the edge of a table or the top of a set of stairs.
The LED shines infrared light onto the floor beneath the foot. Some of that light will reflect back and be detected by the phototransitor. If the foot goes over an edge then no light will be reflected back and the robot will know it cannot place a foot there.
If you want you can use normal LEDs and an LDR (light dependent resistor). In both cases the sensor will plug directly into the 3-pin servo connector. For these sensors to work the 20K internal pullup resistor must be enabled. When light hits the sensor it will pull the pin low. To enable the internal pullup resistor you must set that pin to high while the pin is configured as an input.
These sensors should work with both analog and digital inputs. Using the analog inputs will allow you to adjust the sensitivity in the software.
If you use an analog input and connect the LED to a digital output instead of +5V then you can eliminate false readings due to ambient light.
Read your sensor with the LED on. This reading is ambient light + reflected light from the floor. Now read it again with the LED off. This is ambient light only. By subtracting the second reading from the first you will get a value that represents only light reflected from nearby objects such as the floor. Make sure your code allows time for the sensor to adjust when turning the LED on or off. 1mS should be plenty for phototransistors, LDRs will need at least 50mS.
This project shows a relatively easy and low-cost approach to building robots. The combination of Polymorph and chopsticks will allow fairly complex robot chassis to be constructed that are strong, lightweight and low in cost.