Tuesday, June 19, 2012

Tiny Tank Bot

I decided to build TTB after losing two helicopters at the beginning of my tiny UAV project. Making a flying robot as a first foray into robotics is a lofty goal. After my initial UAV failures, I decided that I needed to prove I could actually build a robot that actually worked and didn’t flee from me, before I was allowed to try a third time on the UAV. Somewhere along the line I had the idea that it would be really cool to make a small tank-like vehicle that used bike chain for the treads, so these things were combined into Tiny Tank Bot. The goals for TTB were simple: make it actually move on bike chain treads, and just run a simple obstacle-avoidance algorithm. 

The processor is a PIC16F1824. I used infrared for obstacle avoidance, using the same technique from my initial helicopter attempts. I don’t like the hacked servo technique for doing bidirectional drive, so I made my own H-bridges on the PCB. I also added an indicator LED, connections for switches (bump sensors), and I threw a 38kHz infrared receiver on there in case I wanted to do remote control.

I had originally bought some tiny gear motors but they turned out to be underpowered. As it turns out, making tiny tank treads out of bike chain IS A TERRIBLE IDEA. A series of factors such as: 1. Chain pitch too large 2. Sprockets made by hand with a Dremel 3. “Journal bearings” that are really just holes in an aluminum block and 4. No room for real tensioners,  all lead to an enormous torque requirement just to move the treads. Instead of addressing any of these problems, I just used MORE TORQUE. I ordered some fairly cheap Tower Pro metal-geared servos, removed the control boards and pots, and wired the motors directly into my PCB.
My axles were made from #6-32 screws with some unthreaded length to go through the bearing blocks. I made couplers out of some F-F standoffs by drilling and tapping a radial hole for a #2-56 set screw to contact the axle (which was filed to a D profile where it went into the coupler) and drilling radial hole through all to put a shear pin into the servo shaft. The short, splined servo output shaft thing is terrible for interfacing to anything that’s not a servo horn, so I drilled a 1/16th hole straight through it radially. A put a small pin of something soft (copper wire) through my coupler and through this hole, and hope that it will shear off before destroying the gears in the servo.

The frame is a 4” square of 3/16ths aluminum, and the bearing blocks are chunks of ¼” aluminum with the axle holes and tapped #4-40 mounting holes orthogonal to each other. Tensioning the chains was a pain, but I just kept messing with these little arms made from music wire until the chains stayed on. It also provided a cool-looking kind of suspension, and raised up the front of the vehicle to help climb over stuff.

For obstacle avoidance, I used a technique with an IR LED and a phototransistor that I had developed previously. I read in a voltage level from the IR sensor, then turn on the IR LED and read again. Measurements are subtracted and then a bunch of samples are averaged, and I know if an object is there reflecting the light back to me. I never ended up implementing the bump sensors or remote control (mostly because the mechanics turned out so bad that I didn’t want to pursue the project any further). The motors are able to be PWMed (very slowly (about 1Hz), as I found this is the only way to make geared-down motors run slower without killing the torque) by two identical interrupt routines that run off two identical timers. The routine can also run them in either direction. The main loop just updates two variables, one for the speed of each motor. 127 is stop, 0 is full speed backwards, and 255 is full speed forwards.
The software has the tank drive along until its reflected IR number goes over a threshold. Then it stops, backs up, and turns by running one motor forward and the other backward. It keeps turning and measuring IR until the obstacle is no longer visible, then continues driving along. After 5 turns, it toggles a flag and will then turn the other direction for the next 5. I found that this number gets it out of most situations without getting stuck in a loop in a confined space.

And TTB works! Barely. The tank treads are awful. I originally wanted to do tank treads so it could drive outside, but the mechanics are so bad that anything but smooth, flat ground just stalls it out. I did accomplish my goal of making a working ground-based robot, so I’m allowed to continue on with helicopters now, but I won’t be continuing to develop TTB any further. The PCB and the code for it seem to be pretty good though, and easily transferrable to other kinds of robots. I think I’ll end up leaving the frame and treads intact as a paperweight, but remove all the electronics and put them on something that works a bit better mechanically. I have some ideas which I’ll try out after I make some UAV progress.
TTB 1.0.asm

1 comment:

  1. You are cool and you have cool hobbies. Keep building!