I paid our local second-hand store a visit and found a few toys which I thought could be made into some autonomous robot. I paid special attention to the tank because I thought it would be really easy to control with the tracks.
It took me a while to get it going because I am still learning the basics about robotics and Arduino.
This is my first instructable so it will be pretty brief and to the point. I do not have a bunch of pictures because I decided to make this instructable after the fact.
Some of the tools I used.
- Wire cutter and stripper.
- Hot glue gun
The Electric components I added.
- H-Bridge = L298N Dual H Bridge DC Stepper Motor Drive. $3 on eBay.
- Ping Sensor = Arduino Ultrasonic Module HC-SR04. $2 on eBay. (I used one with 4 pins)
- Arduino Uno = You can buy a genuine Arduino Uno or you can get cheaper ones on ebay = UNO R3 Board ATmega328P. Can range from $30 to $6. The cheaper ones work just as well....
- Male to Female breadboard jumper wires. $2 will get you lots of these on eBay.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Disassemble
The fun part. I took the tank apart and was impressed to find two motors with the wires in plain view. I removed the PCB board which was in the robot in the first place. Im sure if I would have really played with this, I could have used the PCB that was in the robot, but I decided to get rid of it. I removed the turret and put it aside and thought I could use for something else later...
On the underside of the robot there was a battery pack were I could add 4 AA batteries. It had some wires coming up to the PCB from the pack. I used these wires later on as my power supply to the H-bridge.
Step 2: Adding Ping Sensor and H-Bridge
I basically needed a H-bridge, a Arduino Uno, and Ping sensor.
The first thing I did was mount the Ping sensor on the top of the tank. I just used a piece of foam and hot glued it to the top of the tank. I also had to drill a hole in the top of the tank to get the 4 wires from to the sensor to the Arduino inside the tank. I was going to mount the sensor on a servo and have it sweep back and forth, but the 4 pin sensor seemed to have a pretty wide angle of coverage so I didnt need to.
Note: You can also use a 3 pin Ultrasonic Ping sensor, but I found it had a much narrower field of view in front of the tank. I ended up using a 4 pin sensor.
The H-Bridge is pretty simple to connect as well. There are 2 terminals for each motor. So I just connected the left motor to the left side of the H-Bridge. And the right motor to the right side. There are 3 terminals which is were power is supplied; and also a 5v output. I connected the battery pack (which was part of the bottom of the tank) to the H-bridge. The red wire was connected to the + terminal on the H-bridge and the black wire was connected to the ground ( - ). If you are not sure which wire is positive and which is negative on your battery pack just take a tester and test the voltage. The tester will show a - value if you are holding the leads on the tester backwards.
Step 3: Arduino Uno
I just placed the Arduino into the tank. I didn't bother with screwing or taping it down.
I will just list my pin configuration so you can get it to work with my code. In the picture of the wire strip you can see what used to connect the H-bridge, and the Ping sensor to the Arduino. It would be best if you had male to female breadboard jumper wires. I only had female to female so I inserted a pin into one end of the wire so I could attach the jumper to the Arduino.
This is how I connected the Arduino to the H-Bridge. From Arduino - H-bridge.
- Pin4 - Connected to IN4
- Pin5 - Connected to IN3
- Pin6 - Connected to IN2
- Pin7 - Connected to IN1
This is how I connected the Ping sensor. From Arduino to the Ping sensor.
- Pin11 - Echo
- Pin12 - Trig
- Gnd - Gnd
- The VCC on the Ping sensor is connected to the 5v terminal on the H-Bridge. So it is not connected to the Arduino 5v.
The way I supply power to the Arduino is with the 5v coming off of the H-bridge. Connect the 5v pin on Arduino to the 5v terminal. You will have to strip off one end of the wire to connect it to the 5v terminal.
Step 4: Final Step.
The physical/wiring part of this tank is pretty simple. You can go ahead and tie down the wires and the other parts, but I had lots of room inside the cab of the tank so I just left it.
The final step is to upload the code to the Arduino.
Have fun and please share pics of any toys you manage to get moving autonomously.