I decided to do this Tamiya tankbot as a blog as there's been a few similar posts lately and It is probably one of the most common platforms about the net so I will see if I can do something different with it. But for starters I have built it like a start here robot although I will not call it that.
At the moment it is controlled by a pic16F690 but I intend to build different configurations using other micros as well.
I have built a board holding the micro and l293d motor driver similar to the picaxe project board. I did the circuit in eagle but just built it on a perf board.
The program as it stands for now has basically three functions. The servo for the rangefinder is controlled by timer1 and pin RC0 on the pic. The motors are connected through the l293D on PortB which consists of pins RB4-7.
And the analog sharp is on pin RC1 and uses the ADC module.
The functions for now have been kept simple to get a quick and dirty working example. The limitations which I may expand upon later are:
1. The servo only has 5 fixed positions which I have named Left,midleft,forward,midright and right. This simplified the code for timer1 in that I only need to change tmr1H to change to one of the 5 positions. It would be nice to be able to scan all 180 degrees so I may work on this later. Or implement it on another micro.
2. At the moment the sharp only reads a set distance. It would be nice to use the full range of sensitivity in some way. I have not yet thought out all the possibilities.
Underneath not so pretty with all the solder and wires
Left over mounting block for washing machine pump made good mounting for sharp to servo. Damn sharp for not supplying the plug with their socket.
It's hard to find a cr123 holder so I just soldered some wires to the charger. Heheh.
The tracks are very tight as I originally set the gearbox up with the lowest ratio 344:1 but got bored with the speed so I re-assembled it with 115:1 ratio but untfortunately the axle is mounted different between the ratios. I was able to mount the front axle back one hole but the tracks are still very tight. Also I didn't know their were 2 different dual motor\gearboxes. Needless to say I got the wrong one for the plateset.
Close to takeoff. I have the majority of the code done. All I have to do is come up with a good obstacle avoidance algorithm. Which is no simple task given only one sensor that does not cover the full width of the chassis, the inaccuracy of turns and my lack of skills with planning.
I added some diesel engine sound effects. Actually the noise is the servo cycling through the 5 positions faster than it can move.
: - )
Ok I'm a little lost when it comes to writing obstacle avoidance code. There's just so much uncertainty in a house. For starters I've just coded it to turn left always to avoid a detected surface. The second video shows the results. It runs for a while until it traps itself where it cannot turn left.
Power pack update 16/1/11
Ok I've had some fun with the power supply in the last week. I was using one of pololu's boost regulators to up the 3v supply to 6v for the motors but it failed after stalling the tank a few times. The stall current on those bloody tamiya motors exceeded the rating on the reg. It was supposed to have thermal protection but it didn't work too well I guess.
So I've since changed to a new pack of lithiums I made up to equal 7.4v and 2000mah. Which would be a fairly hefty supply if it wasn't for the fact these were 99 cent cells and their discharge rate is appalling. I thought with the 1000mah rating per cell they'd easily power the tankbot but I found I had to parallel 2 of them to have enough power. Then series connect 2 pairs for my 7.4v.
I also had to configure them in a way I could easily access each cell individually for recharging as I only have a single cell charger. It is so important to have a good supply for your robot because it is amazing the odd behaviour that can occur when batteries run flat. And you also need good runtime between charges to experiment with code or circuits.
As a result I have not got any further in creating a robust obstacle avoidance program. Maybe this week will be more fortunate.
Just fitted the better quality solarbotics 6v motors to the tamiya gearbox. I can see why they're highly recommended. Just on a quick test I noticed two things. They are quieter and smoother and they are more evenly matched in running speeds. After another quick test and I can see they are kinder to the regulator too. It's not heating up as much.