Step 20: Programming

To 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:
  • closeTop
  • closeBottom
  • openTop
  • openBottom
  • Lift
  • Push
By combining these functions in the proper order, the robot can be made to ascend or descend trees.  

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.

<p>I wonder if you could take this one step further and make a coconut harvestor?</p>
Hi, very nice inspiring project. I would like to discuss few things that would include commercial interest. Please respond to my email umnmurthy@gmail.com
I'm sorry, I couldn't locate where you stated how much all the materials were to make this project or robot.
<p>Extremely well thought out. Fantastic work. What is the cost for all the materials to make this robot? </p>
<p>Very COOL! Nice engineering dude!</p>
<p>seriously cool</p>
<p>can you/anyone explain me about the connections btwn motor,motor driver,rotation sensor and arudino pl..??</p>
<p>by what mechanisam the legs pich together i mean using any motor or other means</p>
<p>That's a great idea, but it's only the very beginning, if the goal is to make something useful, with much larger trees (a standard chestnut tree is regularly about 50cm diameter)... I'm looking forward to seeing how you have this project evolve...</p>
wow!!!!!!!!!!!nice job dude......i need one help!!!i cannot understand from where the wires connected to the sensors linked???and how the wires from the motor driver is connecting another h-bridge??and how the motor driver and motor controller is connected to the battery???please help me........sir
arduino uno is very popular among students and hobbyist from robotics and it's very clear why this little board is used in so many applications. It can be connected to the internet as we can see in this <a href="http://www.intorobotics.com/arduino-uno-setup-and-programming-tutorials/" rel="nofollow">arduino uno tutorials</a> or it can be used to <a href="https://www.instructables.com/id/20-Unbelievable-Arduino-Projects/" rel="nofollow">interface a lot of electronic parts</a>&nbsp;
hello ben..can u share to me the arduino coding about the threaded rod?=)
nice concept
Why not go with servos?
Handy if you have to get a cat down. :)
Ok this is the most amazing thing! Great Job!
It nearly has potential for a tree stand for hunting! Or a real wild Sci-fi spider!! <br />
I'm going to build a much larger scale version of this to climb a tree of much bigger diameter. I will have it haul up a throw line [pun intended] as it goes, have a servo arm deploy it in a crotch (where branch meets trunk), and then the robot can lower it (and possibly self-rappel down that line). I will then use the throw line to anchor a <a href="http://www.wesspur.com/images/treegear/cli205-500.gif" rel="nofollow">friction saver</a>&nbsp;so that I climb the tree myself. &nbsp;<br> <br> At least, so I plan. &nbsp;I'll CAD it in Autodesk Inventor and see where that goes.<br> <br> Great Instructable!&nbsp;
if anyone wants 2 sell; I will buy a pre-programmed PIC that controls 3 servo's giving them random or psuedo-random movement. speed can be slow since i am planning to use it in a prop. if anyone willing to sell this i need 5 pcs of the same. i will pay thru paypal. some people do not trust overseas buyes, so 2 make u feel safe, u can list it on EBAY and I will buy it thru EBAY, which will guaratntee u get payed. More orders I would place if 1st order went well...I am a serious prop maker and look forward to source my needs thru this website while I concentrate on the mechanical aspects of my props. I m not offering to sell my props or anythng on the website, just buy parts.....please advise if anyone interested to sell. Thanks
u can use transistors to control the L298HN like the L293D ?
You can control the L298 directly from the arduino, without extra transistors.
i was asking can it work im making a EAGLE PCB atm i have it done on the proto but i messed it up wired it wrong i have 3 and 1 is im use to control two Honda AC cooler door servos for a solar sun tracking
I'm not sure why you would want to use a transistor to drive it. Rather than using a transistor, why not drive the l298 with whatever source you were going to use to drive the transistor? If it can output enough current to drive a transistor, it can definitely directly drive the signal for the l298. I suppose it would work though (although I am not sure what part you want to control with the transistors)
it feels saver with the resistor controlling the 5 volts to CHIP KIT MAX32 the 5 volt gonna be regulated to power the chip kit and the transistor im just wanted to set it up like it make me feel saver theres another 1 to it a 2 pin and leave me with extra pin to control more stuff if u nee to
well done good innovation <br>
beautiful robot !! I and one of my friend had made a similar project using helical climb mechanism !! it is much easier bt bulkier ......... one recommendation those legs could be attched to the body using brake wire which could be spring loaded such that it can each stay in itz place when no movement is taking place
I'm not sure what you mean about the brake wire. The legs already do stay in place by themselves. <br><br>Your robot sounds really interesting. Do you have any pictures of it?
Bicycle brake wire...I think...
Really well done - Can it climb back down?
Yes, it can. Basically, to go down it reverses the cycle of lifting and pushing it uses to go up.
epic!! nice work man!
It seemed like you were waiting for it to fall and catch it.<br>I wonder if you could test the grip by doing a tug on the just clamped section and measure the current draw or force or something to be sure it is tightly attached. Then you would know it is safe to release the other half and climb.
The software on the Arduino figures out how hard it is clamped much more simply using potentiometers. The process is described in the last step.
Way to cool man<br>
That's a pretty clever setup-- the long pen allows some side-to-side movement during rotation, so the mounting doesn't have to be perfect.
What a fantastic project! Perhaps way down the road to extend the idea to a tree trimmer that could trim tree branches at the tops of trees in urban areas to reduce the amount of 'sail' to prevent trees from falling and prevent considerable property damage? Keep honing your considerable skills.
Excellent project indeed. As an engineer myself, I can appreciate the not only the project you tackled, but also how comprehensively you documented the build process. Keep doing what you&rsquo;re doing, I have a feeling that one day engineering might be paying your bills, if it isn&rsquo;t already.
Thanks! It's not paying my bills yet, but I'll be heading off to college next year, definitely to study engineering.
Don't forget McMaster-Carr for gears, including rack and pinion:<br><br>http://www.mcmaster.com/#gears/=drutfr
I looked at those, but found that it would be too expensive to get the parts I needed.
That's really cool! If you do ever want to do a rack and pinion setup Servocity sells cheap nylon gear racks and servo mount gears- I use a similar setup with a low profile linear slide for making animatronic Predator gauntlet blades.
A most excellent project. Great design, implementation and documentation.
AWESOME JOB!! ... now i just need to talk you into making one strong enough to attach a tree stand to :)
rofl why, is a climber stand too much for you?
naaaah ... i just wanna be the first kid on my block with the tree stand that climbs up the tree for me hehehe<br><br>on top of that i get to pretend i'm running my own elevator ...<br><br>first floor rabbits and chipmunks *ding*<br><br>second floor squirrels and the neighbor's cat *ding*<br><br>top floor deer and moose and bears oh my *ding*
This is the most epic robot ever! Perfect for getting cats out of trees!
Great Job dude, what a great first robot, very impressive.
You da man! This is the best &quot;first robot&quot; project I've ever seen. Great job!

About This Instructable




More by ben_k:Electric Tricycle All-Terrain Electric Scooter Retro Rechargeable USB Booster 
Add instructable to: