04 April 2010

Arduino Tamiya Tank


Although the three Tamiya tank parts (universal plate set, track and wheel set, and gearbox) came as three separate parts, they are designed to be used together. It took me about 4 complete rebuilds of the tank before I got all of the parts to fit together in the best way possible. Here are some things that I found as I worked my way through this.

The gearbox should be built in C-mode which is the slower 204:1 gear ratio. If not done this way, the tank will not likely have enough torque for the motors it uses. It is best if you build the gearbox this way in the first place so that you don't have to take it apart and rebuild it when it doesn't work.

It is very tricky to get tank treads just the right length in conjunction with the spacing of the axels and the placement of the parts on the universal plate. This accounted for the majority of the time spent rebuilding. For each tread I used all of the pieces except a single short piece on each side.

It is also important to make sure that the treads fit very snuggly otherwise they will slide off of the wheels when the tank is turning in place.

The basic schematic and code I used for controlling the H-Bridge and motors were taken from the blog of Didier Stevens.

Here is the schematic used for connecting the H-Bridge to the Arduino and the motors.

This schematic doesn't show how to hook up the other pins of the H-Bridge. Here is a link to the datasheet on the SN754400 so that you can see the pinouts. I wired the two enable pins and VCC1 directly to 5V. VCC2 is meant to be wired to the motor power source. I wired this pin directly to the Vin pin on the Arduino. Although this will put a lot more voltage through the motors which really are only designed for 3V each, it prevents the motors from causing excessive noise in the 5V regulated power source that is used to power the Arduino board. If you try to use the 5V source for VCC2, the Arduino will be unstable and will reset due to the noise on the power source.

You will see that my pins are not connected exactly the same as above. You may have to change the pin connections in the code to suit the wiring that you do.

I used 6 Energizer AA Rechargeable NiMH 2500mAh batteries to power the tank and they worked great.

I happened to have an old 8-ohm speaker that I had harvested from some old device in the past. It was rated for 0.5W so I wired it directly up to the Arduino and used the example code for the Tone() function provided with the Arduino IDE.

I connected the mini push button to an interrupt and debounced it. In my code, the button handler is setup to increment through the four different tank movements in order to allow manual testing of the tank without having to be connected to the computer. I also setup use of the serial connection via USB to control the tank using the keyboard.

My code can be found here.

No comments:

Post a Comment