Show All 7 Items
After I got comfortable programming and building with an Arduino, I decided to build a robot. I did not have any particular type in mind, so I wracked my brain (and the internet) for cool robot ideas. Eventually, somehow the idea popped into my head to build a robot that could climb trees. At first I dismissed the idea as beyond my skill level, but after further thought, and some time in Sketchup, I decided to take a shot at the challenge. This is the result of my efforts.
Step 1: Design
I started out by creating a basic design in Sketchup. The robot was to consist of two segments, joined by a spine which could be extended or retracted. Each segment would have four legs with very sharp points as feet. To climb, the legs on the top segment would pinch together and the sharp feet would dig into the bark, securing the robot. Then the spine would be retracted, pulling up the bottom segment. The legs on the bottom segment would then grip the tree, and the top segment would release. Finally, the spine would extend, pushing the top segment upwards, and the process would repeat. The climbing sequence is somewhat similar to the way an inchworm climbs.
In my original design (show in the images above), all four legs in each segment were controlled by one highly geared down motor. I decided to ditch this idea for a few reasons. Firstly, I could not find the type of spur gear needed to mesh the legs together. Also, with all the legs linked together, the robot would have a hard time gripping uneven surfaces. Finally, I decided that the robot would be much easier to build if the motors drove the legs directly.
The other significant change I made from my original design was the way the spine worked. In my model, I used a rack and pinion type gearing system to extend and contract the spine. However, I could not find the necessary parts to build such a system, so I ended up using a threaded rod coupled to a motor to actuate the spine.
Step 2: Tools and Materials
Step 3: Motor Controller
Show All 12 Items
The motor controller I built for this robot is based off the L298HN Dual Full Bridge chip. To use the chip, I followed the guide here. To start out, I placed all the components on a piece of perf board, to figure out the layout. With this chip, each motor requires three inputs to work: an enable signal and two input signals. The enable signal is used to control the motor speed with PWM, but since I did not need to control PWM, I just wired all the enable pins in parallel to a 5V line when I hooked the controller up to the Arduino. Once I figured out the layout, I soldered all the components in place, and made connections with 22AWG solid core wire. Finally, I spread some thermal paste on the back of the L298's, and screwed on the heatsinks. The particular heatsinks I used were made by cutting in half a northbridge heatsink from a computer motherboard, and drilling and tapping a hole for the screw. They are probably much larger than needed, but there is no harm in having over sized heatsinks. A higher resolution image of the labeled board can be found here.
When finished, this motor controller should be able to bidirectionally control 4 DC motors at up to 2A each (probably 2A continuously, because of the size of the heatsinks). As you may notice, this leaves me one motor short. My original design used a servo to actuate the spine, but I had to change my design to using a DC motor. To power it, I wired my third L298 chip to a molex connector (so I can disconnect the motor) and soldered on wires for all the connections. It does not look as pretty as my controller on a circuit board, but it works.
Step 4: Power
Show All 7 Items
The robot's power is supplied by two different sources. The Arduino and the motor controller logic circuitry are powered by a 9V battery, while the motors are powered by an approximately 12V Li-Ion battery pack.
I wanted to avoid having to buy an expensive LiPo/Li-Ion battery pack and charger, so I searched through my piles of electronic junk for a device with an appropriate battery. I settled on the battery from a 12" iBook laptop. The battery was 10.8V and 50Wh, but it was a little large and heavy for my needs. To fix this, I tore it open and had a look at the internals. I found that the battery was comprised of six 3.7 volt cells. These cells were organized in pairs of two wired in paralleled. The three pairs were then wired in a series, making a total 11.1V. To shrink the pack but keep the voltage, I simply removed one cell from each pair. The final battery pack had only half the capacity and half the discharge rate of the original (now only 2C), but the full voltage. I then wrapped the cells together with electrical tape so they would hold their shape, and soldered a quick-disconnect connector to the battery leads.
Step 5: Power, cont.
The Arduino and the logic circuitry for the motor controller are both powered by a 9V battery. While the Arduino can take 9V input, the logic circuitry requires 5V, so I wired a 5V regulator in paralleled to the 9V going to the Arduino. Now, why did I not just take advantage of the Arduino's internal 5V regulator? Well, basically I ran out of pins, and I did not want to overdraw the Arduino. In addition to the regulator, I soldered a barrel power connector to the 9V end of the circuit, to fit into the Arduino. Finally, I added a DPDT toggle switch to break the 12V battery circuit as well as the 9V battery circuit.
Step 6: Legs
The legs are some of the most important parts of this robot, because their design determines whether or not the robot can grip onto trees. I decided to have four pairs of legs, each pair controlled by one motor.
To make the legs, I cut four 8.5" lengths of the aluminum bar. I marked the segments 2.5" from each end. At those marks, I bent the aluminum at a right angle, to make a "U" shape. If you do not have a bending brace (which I don't) you can get a clean bend by clamping the aluminum with a c-clamp right on the mark, and pushing the unclamped end against a solid surface, like a work bench.
Step 7: Feet
To grip the tree, the robot has very sharp feet at the end of its legs (where else?). The feet are made from jumbo-sized T pins, which you can get at your local fabric store. To fasten them to the legs, I made some clamps out of aluminum. I cut 8 3/8" or so lengths of aluminum, and filed a thin groove lengthwise into each of them, for the pins to fit into. Then I drilled a pair of holes into the aluminum, and corresponding holes into the ends of the legs. The clamps were then bolted down to the legs, with the pins inserted in the grooves. I left about 3/8" of an inch of the pins extending form the legs, but the length can be adjusted by loosening the bolts.
Step 8: Motor Hubs
Show All 7 Items
The next step is to couple the legs to the motors. I found these handy 5mm mounting hubs, which were perfect for the job. I drilled four holes in a square on one side of each pair of legs, and screwed the hub to the legs with 4/40 screws. To fix the motors to the legs, you simply line up the flat side of the motor shaft with the screw in the hub, and tighten the screw.
Step 9: Building the Frame
Show All 7 Items
With the legs finished, the next step was to build a frame to hold the motors and legs together and in place. I started the frame by making a plate out of aluminum to hold the motors together. I drilled the plate to fit the screw holes of the motors and the gearbox shaft. The motors are held in place by 3/32 screws.
Next, I made a matching plate for the opposite side of the leg assembly. This plate holds the legs straight while they turn. I drilled holes through the legs, opposite to the motor hubs. Then I bolted the legs through the plate with washers and a locknut to hold them in place and let them spin freely on the bolt.
Step 10: Frame, cont.
Next, I made a piece out of aluminum to fix the two opposite plate together. This piece sits between the pair of legs on each assembly, and is the primary structural support of each segment. As well as holding the robot together, it provides a place to mount the electronics and other components later on.
I bent the aluminum at right angles using a c-clamp, and drilled four holes in each end. I drilled matching holes in the motor plate and the opposite plate in each leg assembly, and then bolted everything together with 4/40 screws.
Once both segments of the robot were built and structurally sound, I could test their tree-gripping ability by hooking the motors up directly to a battery. Fortunately, they worked quite well, or I would have had nothing else to share.
Step 11: Electronics Platform
To hold the electronics, I cut an approximately 6" x 3" piece of acrylic. I drilled six holes in it and screwed standoffs into the holes, to support the Arduino and the motor controller. Then I drilled four holes in the top of the leg assembly, and bolted the acrylic to the assembly, with spacers to lift it up above the motors. Finally, I screwed the Arduino and motor controller into the standoffs.
Step 12: Rotation Sensors
Show All 8 Items
Rotation sensors are key to the operation of this robot. It has one rotation sensor per motor, so the robot knows the exact position of each leg at all times, allowing for precise control of the legs. For my rotation sensors, I used four very thin trimpots I had lying around. Pots are extremely easy to interface with the microcontroller, and are plenty precise for my purposes. They were not, however, very easy to interface with the hardware of my robot.
While designing and building the leg assemblies, I neglected to build in an easy way to connect the potentiometers to the legs. In the solution I came up with, one side of the pot is fixed to the inside of the leg by the protruding screw heads. The other side of the pot is fixed to the locknut on the end of the bolt that holds the leg in place. When the leg turns, the side of the pot fixed to the leg turns, while the side fixed to the locknut is held in place.
To interface the pots and the legs, I first sanded the plastic side of the pots flat. I took four squares of acrylic, approximately 3/4" on each side, and drilled four holes in each, corresponding to the four screw heads in each leg. Then I glued a potentiometer to the center of each acrylic square.
To fix the opposite side of the pots to the locknut I had to get even more creative. First, I glued metal standoffs scavenged from a PowerMac G5 case to the metal side of the pots. Then I glued the plastic shaft from a Bic pen to the metal side of the pots. The other ends of each pen were cut to fit within the metal legs. Then the pen shaft was forced over the square locknut and epoxied to it.
Step 13: Backbone Motor
To move up and down a tree, the robot extends and contracts by spinning a threaded rod that is fixed to the top segment. When the rod is spun clockwise, the two segments are pulled together, and the are pushed apart when it spins counter clockwise. To spin the rod, I needed a relatively high-torque low-speed motor that would run at 12V, and I happened to find just such a motor in my box of parts. This particular motor came fitted with a brass gear. To assist with coupling the motor to the threaded shaft, I filed two sides of the gear flat.
To mount the motor to the robot, I bent a short length of aluminum to an "L" shape. I drilled a large hole out of the center of one of the faces (for the motor shaft and gear) and two small holes in both faces for bolting the motor to the metal and bolting the metal to the robot. I drilled corresponding holes into the back of one end of the segment of the robot without the electronics, so that the motor was positioned between the two legs.
Step 14: Mounting the Spine
There are a couple problems with getting a threaded spine to spin smoothly. First, it must be coupled to the motor well, and second it must have some sort of bearing fixed to it on which it can spin. One of the first things I found while trying to couple the motor shaft to the threaded rod was that the connection should be flexible for smooth operation. I made my coupling out of two segments of clear nylon tubing. A wider diameter segment fits tightly over the gear attached to the motor shaft, while a thinner segment fits into the larger tubing and tightly over the outside of the threaded shaft. The coupling is secured with a zip tie.
With only the coupling, the threaded shaft still can not bear any load, because it would just pull off the motor. To support load, I made a bearing for the shaft out of an old hard drive read/write head bearing. I drilled out the center so that the threaded rod could pass through it. I then fed the rod through it, and fastened a nut on each side of the bearing, to hold the threaded rod in place. I then bolted the bearing down to the back of the robot's frame.
Step 15: Mounting the Spine, cont.
For the spine to work, it must pass through a nut that is fixed to the other segment of the robot. For ease of mounting, I used a large 1/2" long nut. To fix it to the segment of the robot, I cut two ~4" lengths of aluminum, drilled them to match the bolts that hold the acrylic piece, and mounted them through the screw holes, across the frame. These will later become supports for linear slides. I then drilled four more holes around the center of the back of the robot, with enough space between them for the nut to fit. I cut a piece of aluminum to run along the back of the robot, and drilled it to match the holes. I then placed the nut on the back of the robot, placed the bar of aluminum on top of it, and bolted through the bar, to sandwiched the nut between the two pieces of aluminum. Finally, I threaded the rod through the nut.
Step 16: Linear Slides
Show All 8 Items
Without something holding the two segments of the robot in the same plane, the top segment would turn when the threaded rod turned, instead of moving up or down. To keep the two halves of the robot in the same plane, I built linear slides out of two steel rods and brass tubing.
First, I added a pair of aluminum bars to the segment of the robot without the electronics, to match the pair on the other segment. To mount the steel rods and the brass tubing to these, I made a clamp system similar to the clamps holding the feet in place. To do this for the large diameter rods, I first clamped two 3/4" squares of aluminum together. I then drilled a 1/8" hole down the intersection of the squares, and then took them apart. I drilled two holes in each square, and corresponding holes in each supporting arm. Then I repeated the process four times. To get the slides perfectly parallel to the threaded rod, I had to bend up the supporting arms on the non-electronics segment of the robot.
Step 17: Wiring the Robot
Show All 8 Items
The next step is to wire all the electrical components of the robot together. I started out by soldering long wires to the contacts on the motors. I twisted the wires together by chucking one end in an electric drill and holding the other end with pliers (a trick I learned from the Ben Heck show). Next, I wired together the pots on the legs. I did this using segments of ribbon cable from an old IDE cable. I wired the pots so that they all had a common ground and input voltage. The input voltage was connected to the +5V pin on the Arduino, and the four signal wires were soldered to headers and then connected to analog inputs A0 - A3 on the Arduino.
Because this robot is autonomous, I needed a method for controlling the robot's actions so that I could get it to release from the tree. For this, I just used a simple slide switch connected to a digital input on the Arduino
Next, I wired the digital output pins on the Arduino to the inputs on the motor controller. First, I connected all the motor enabling pins on the motor controller to eachother. The rest of the wiring went as follows:
I collected the umbilical cord of wires running between the two segments of the robot into a bundle, and fastened them together with zip ties and electrical tape, to keep them organized.
Step 18: Limit Switches
Because I used a regular DC motor instead of a servo or a stepper to spin the threaded rod that is the spine, the robot can not know the degree of extension of the spine at all times. Therefore, limit switches must be used to prevent it from extending or contracting too much.
The spine has two limit switches. One is pressed in when the two segments of the robot are pulled close together, and the other becomes un-pressed when the threaded rod retracts past it. The latter is a switch like this glued parrallel to the threaded rod, on the segment of the robot with the electronics. When the spine retracts, it pushes down the lever of the switch, and when it retracts, the switch opens.
The second limit switch is a push button switch that requires very little force to actuate. I mounted it on a strip of aluminum from the front of the electronics segment.
Both the switches are connected to the same 5V and ground lines as the potentiometers on the legs, and their signals go to inputs A4 and A5, which the Arduino is set to read as digital inputs rather than analog.
Step 19: Battery Holders
Show All 8 Items
The last mechanical part of this project was to create a way to hold the batteries, while making sure that they are easy to remove for replacement or charging.
The perfect place for mounting the 9V battery was right above the Arduino, so I created a mounting system for it out of some scrap metal. A piece of metal (with an electrical tape insulated bottom) screws on above the Arduino through one of the standoffs. On top of the metal is a bit of stick-on velcro. A piece of metal bent into a "U" shape clips onto the 9V battery, and then sticks to the velcro above the Arduino board, holding the battery in place.
To hold the larger battery pack, I cut two brackets out of some soft plastic angle bar I had lying around. These brackets screw into the arms that hold the linear slides. The battery stays in mostly by friction, but a bit of velcro on one side helps to stop it from slipping out.
Step 20: ProgrammingTo climb up a tree, the robot goes through a simple series of motions. First, the top segment grips the tree and the bottom segment releases form the tree (if necessary). Then the spine contracts, pulling the bottom segment up towards the top segment. Next the bottom segment grips the tree, and afterwards the top segment releases from the tree. Finally, the spine extends, pushing the top segment upwards, and the cycle can start over again. For ease of programming, I wrote a function corresponding to each basic motion. These are as follows:
Opening the legs is very simple. The legs turn outwards from the tree until their rotation sensors reach a point set in the program. Then power is cut off to the motors. Closing the legs on the tree, however, is a little bit more complex. Since trees vary in diameter, the legs need to be able to grip a wide variety of diameters without reprogramming the robot for each size. To figure out when to cut off power to the motors, the controller first calculates the speed at which the legs are moving towards the tree. It does this by sampling the position of the legs' potentiometers every .05 seconds. It subtracts the previous value of the potentiometer from the current value to find the distance traveled by the legs over the time period. When the distance travels becomes close to zero (I used 1 in my program), it means that the legs have gripped into the tree and are beginning to slow down. Then the controller cuts of power to the motors, to prevent them from stalling out, or damaging themselves, the motor controller or the gearboxes.
The last piece to the programming puzzle is the method of controlling the robot's actions. If you look at the above movement cycle, you will notice that the robot is gripping the tree at all times. This makes it difficult to remove the robot, so I programmed the control switch to manually control the behavior of the robot. While the switch is off (circuit open), the robot keeps its legs open. Once the switch is turned on, the robot begins its climbing cycle. To remove the robot from the tree, the switch is turned back to the off position, and both sets of legs release.
If you liked this project, please vote for me in the Epilog contest! What would I do with a laser cutter? Well, I could use it to make parts for even more robots and machines (after I finished etching every electronic device I own, of course). Not having to manually cut, file, bend, and grind every component of my robots would let me significantly increase the complexity and variety of what I can build, and would also significantly cut down on construction time, so that I would be able to build even more interesting things.
This project was featured on Hack A Day! Thanks for the great article.