Skip to main content

1.1

Major VersionM

by Pete Prodoehl

Introduction

Build a LEGO Tank that doesn't crash into walls thanks to an Ultrasonic Distance Sensor.

Video Overview

  1. Tank Steering works differently than steering for a car. Most cars have rear wheels that are fixed and cannot turn/pivot left or right, and front wheels that can turn/pivot left or right. The turning/pivoting of the front wheels allows the car to make left and right turns (while moving) in addition to just going forward and backward.
    • Tank Steering works differently than steering for a car. Most cars have rear wheels that are fixed and cannot turn/pivot left or right, and front wheels that can turn/pivot left or right. The turning/pivoting of the front wheels allows the car to make left and right turns (while moving) in addition to just going forward and backward.

    • For a tank the wheels do not turn/pivot left or right, but by spinning the "wheels" (which typically have a set of tracks attached to them) a tank can drive left or right, or even spin around clockwise or anticlockwise depending on if the wheels on opposite sides of the vehicle are turning the same direction or opposite directions.

    • Tank steering is similar to how a wheelchair works. If both wheels spin the same direction one of them rotating faster will allow for turning of the vehicle. If they are spinning opposite directions the vehicle will spin around.

    • Our Obstacle Avoiding Robot (Robotics Board) and WALL-E projects both use a form of tank steering.

  2. We're going to use a Crazy Circuits Robotics Board along with two LEGO Compatible 360 Degree Servos and an Ultrasonic Distance Sensor. (We'll power it all with a 3 AA Battery Pack.)
    • We're going to use a Crazy Circuits Robotics Board along with two LEGO Compatible 360 Degree Servos and an Ultrasonic Distance Sensor. (We'll power it all with a 3 AA Battery Pack.)

    • The electronics portion of this project will be fairly easy since we just need to plug the two servos and the sensor into the Robotics Board and then add the battery pack with a Screw Terminal Chip and a bit of Maker Tape.

  3. Gather all of the LEGO parts needed to build the tank chassis.
    • Gather all of the LEGO parts needed to build the tank chassis.

    • If you don't have these exact parts you can often make substitutions. For instance, if you have longer axles they can still work, or if you have half bushings instead of regular bushings they should work fine.

    • LEGO is about building what you want to build! Consider our guide a suggestion for your own build which should be based on the parts you have available.

  4. The frame will be built using 6 LEGO Beam Frame 5 x 7 parts. Connect them as shown using 10 LEGO Technic Pin with Friction Ridges and Slots Connect them as shown using 10 LEGO Technic Pin with Friction Ridges and Slots
    • The frame will be built using 6 LEGO Beam Frame 5 x 7 parts.

    • Connect them as shown using 10 LEGO Technic Pin with Friction Ridges and Slots

  5. Once your frame is complete you'll want to reinforce it using 4 LEGO Beam 15 parts. On the top we placed them centered between the front and rear of the vehicle. On the bottom we offset the beams by one hole on the LEGO frame, putting them closer to the rear of the vehicle.
    • Once your frame is complete you'll want to reinforce it using 4 LEGO Beam 15 parts.

    • On the top we placed them centered between the front and rear of the vehicle.

    • On the bottom we offset the beams by one hole on the LEGO frame, putting them closer to the rear of the vehicle.

    • You'll need to make sure you leave the center hole on the side of each frame piece open for the axles to go through,

  6. Next we'll add 4 of the  LEGO Axle 8 pieces. Use 12 LEGO Bushing to hold the axles in place.
    • Next we'll add 4 of the LEGO Axle 8 pieces.

    • Use 12 LEGO Bushing to hold the axles in place.

    • Each axle gets three bushings. Two on the outside, and one on the inside.

    • We need to use two separate axles for each "pair" of wheels because they need to spin independently of each other. One long axle won't work.

  7. The last two axles will be used to drive the vehicle, so we need to add a LEGO Gear with 16 Teeth Unreinforced  along with a  LEGO Half Bushing. Like the first four axles, there are two bushings on the outside, and then the gear and the half bushing go on the inside of the frame.
    • The last two axles will be used to drive the vehicle, so we need to add a LEGO Gear with 16 Teeth Unreinforced along with a LEGO Half Bushing.

    • Like the first four axles, there are two bushings on the outside, and then the gear and the half bushing go on the inside of the frame.

  8. Slide the 6 LEGO Technic Sprocket Wheel 40.4 parts onto the axles. At this point your vehicle could probably roll around!
    • Slide the 6 LEGO Technic Sprocket Wheel 40.4 parts onto the axles.

    • At this point your vehicle could probably roll around!

    • In the next step we'll add the treads so the drive sprockets can transmit motion to the other sprockets.

  9. You'll need 58 LEGO Large Tread Link to build your treads as each side uses 29 treads. Connect the treads together to form two sets of treads, but don't connect them into a loop yet!
    • You'll need 58 LEGO Large Tread Link to build your treads as each side uses 29 treads.

    • Connect the treads together to form two sets of treads, but don't connect them into a loop yet!

  10. Wrap the treads around the sprockets and attach into a loop by clicking the two end treads together on each set of treads. You should now have a full set of treads on each side of your tank!
    • Wrap the treads around the sprockets and attach into a loop by clicking the two end treads together on each set of treads.

    • You should now have a full set of treads on each side of your tank!

  11. We'll use the 4 LEGO Beam 7 parts to raise and mount the servos to the proper position. Use 2 LEGO Technic Pin with Friction Ridges and Slots for each beam and connect them to the frames as shown. Use 2 LEGO Technic Pin with Friction Ridges and Slots for each beam and connect them to the frames as shown.
    • We'll use the 4 LEGO Beam 7 parts to raise and mount the servos to the proper position.

    • Use 2 LEGO Technic Pin with Friction Ridges and Slots for each beam and connect them to the frames as shown.

  12. For each servo press a LEGO Gear with 24 Teeth into place on the servo shaft. For each servo use 2 LEGO Long Pin with Friction parts to attach the servo as shown, Make sure the servo wires are facing upward.
    • For each servo press a LEGO Gear with 24 Teeth into place on the servo shaft.

    • For each servo use 2 LEGO Long Pin with Friction parts to attach the servo as shown,

    • Make sure the servo wires are facing upward.

    • Make sure the gears line up when putting the servos in place.

  13. You should now have a complete tank chassis!
    • You should now have a complete tank chassis!

    • Fun fact: In vehicle building this is what would be referred to as a rolling chassis.

    • We still need to add power & control. Also known as batteries and a micro:bit

  14. Gather the LEGO parts shown so we can attach our Robotics Board to the tank chassis.
    • Gather the LEGO parts shown so we can attach our Robotics Board to the tank chassis.

    • We're basically making 4 "legs" for the Robotics Board so it can be fit into the frame pieces of the chassis.

    • As always, if you don't have these specific parts, others can work. Longer axles? No problem! Less bushings? You can probably still make it work.

  15. Slide 4 of the LEGO Bushing parts onto each LEGO Axle 8. Place the Robotics Board onto the "legs" and add one LEGO Bushing to the top of each axle. You should have a Robotics Board with 4 adjustable legs ready to mount to the tank chassis.
    • Slide 4 of the LEGO Bushing parts onto each LEGO Axle 8.

    • Place the Robotics Board onto the "legs" and add one LEGO Bushing to the top of each axle.

    • You should have a Robotics Board with 4 adjustable legs ready to mount to the tank chassis.

  16. Our Battery Pack has bare wires on the end. To connect it to our Robotics Board we'll attach a Crazy Circuits Screw Terminal Chip. You'll need a slotted ("flat tipped") screwdriver to tighten down the screws onto the wires.
    • Our Battery Pack has bare wires on the end. To connect it to our Robotics Board we'll attach a Crazy Circuits Screw Terminal Chip.

    • You'll need a slotted ("flat tipped") screwdriver to tighten down the screws onto the wires.

    • Make sure you get the polarity correct for how the orientation of the Screw Terminal Chip will connect to the Robotics Board.

  17. We chose a very simple method of adding the 3 AA Battery Pack. It sits below the Robotics Board and we just taped it to the servos to keep from moving around too much. (The "legs" we added to our Robotics Board will also help keep it in place.) Alternately, you can find a way to mount it to the tank chassis beneath the Robotics Board using LEGO parts, but we thought this method was simple.
    • We chose a very simple method of adding the 3 AA Battery Pack. It sits below the Robotics Board and we just taped it to the servos to keep from moving around too much. (The "legs" we added to our Robotics Board will also help keep it in place.)

    • Alternately, you can find a way to mount it to the tank chassis beneath the Robotics Board using LEGO parts, but we thought this method was simple.

    • Once the battery pack is in place you can slide the Robotics Board "legs" into holes of the frame.

  18. We're going to mount the Distance Sensor to a LEGO Beam 11 and add 2 LEGO Cross Block Beam Bent 90 Degrees with 4 Pins . One at the end and one spaced one hole from the other end. (This will match the 10 hole wide frame of the Tank.) Once again we chose to use the most advanced mounting device we could find. A rubber band! We rubber banded the sensor to the beam with the Jumper Wires facing up. We love to build with LEGO and we also like 3D printed parts, but sometimes tape or a rubber band is a "good enough" solution that just works.
    • We're going to mount the Distance Sensor to a LEGO Beam 11 and add 2 LEGO Cross Block Beam Bent 90 Degrees with 4 Pins . One at the end and one spaced one hole from the other end. (This will match the 10 hole wide frame of the Tank.)

    • Once again we chose to use the most advanced mounting device we could find. A rubber band! We rubber banded the sensor to the beam with the Jumper Wires facing up.

    • We love to build with LEGO and we also like 3D printed parts, but sometimes tape or a rubber band is a "good enough" solution that just works.

    • Once you've got the Distance Sensor assembly put together you can attach it to the front of the tank.

  19. With the Robotics Board mounted onto the tank chassis we can now connect each of the components. For the sensor you'll need to connect the echo pin to Pin 3 on the Robotics board, then connect the trigger pin to Pin 5, then VCC to 5V and Gnd to GND. This will power the sensor and allow it to talk to the Robotics Board. For the servo connectors the orange wire is the signal wire, and goes into the labeled pin. (For the Front Servo that is Pin D6, and for the Rear Servo it is D9.) The red wire then goes to the 5V row, and the brown wire goes to the GND row.
    • With the Robotics Board mounted onto the tank chassis we can now connect each of the components.

    • For the sensor you'll need to connect the echo pin to Pin 3 on the Robotics board, then connect the trigger pin to Pin 5, then VCC to 5V and Gnd to GND. This will power the sensor and allow it to talk to the Robotics Board.

    • For the servo connectors the orange wire is the signal wire, and goes into the labeled pin. (For the Front Servo that is Pin D6, and for the Rear Servo it is D9.) The red wire then goes to the 5V row, and the brown wire goes to the GND row.

  20. To power everything we'll use a 3 AA Battery Pack along with a Crazy Circuits Screw Terminal Chip and a LEGO Brick 2 x 4 (3001 / 15589) The LEGO brick should stay in place under the Robotics Board once two small pieces of 1/8" Maker Tape are put in place. The positive (red) wire from the battery pack should align with the 5V Pin on the Robotics Board. The black (negative) wire from the battery pack should align with the GND Pin on the Robotics Board.
    • To power everything we'll use a 3 AA Battery Pack along with a Crazy Circuits Screw Terminal Chip and a LEGO Brick 2 x 4 (3001 / 15589)

    • The LEGO brick should stay in place under the Robotics Board once two small pieces of 1/8" Maker Tape are put in place.

    • The positive (red) wire from the battery pack should align with the 5V Pin on the Robotics Board. The black (negative) wire from the battery pack should align with the GND Pin on the Robotics Board.

    • Note that the GND pin on the Robotics Board has a white circle around it.

    • Tip! You can use the Screw Terminal Chip as an "on/off" switch by just popping it on or off of the LEGO brick to complete or break the connection to the battery pack.

    • Leave the power disconnected for now. If you have no code on your Robotics Board the tank will do nothing, but if you have old code it may do something unexpected!

    • In the next step we'll upload the code to the Robotics Board.

  21. Before our robot will work you'll need to upload code to the Robotics Board. If you've not done so already, make sure you have the latest version of the free Arduino IDE software installed on your computer. If you've never used the Robotics Board before, start with this guide: Robotics Board Setup and Use Our code is found at our GitHub repo, which you can find here: https://github.com/BrownDogGadgets/Crazy...
    • Before our robot will work you'll need to upload code to the Robotics Board. If you've not done so already, make sure you have the latest version of the free Arduino IDE software installed on your computer.

    • If you've never used the Robotics Board before, start with this guide: Robotics Board Setup and Use

    • Our code is found at our GitHub repo, which you can find here: https://github.com/BrownDogGadgets/Crazy...

    • The code has been commented to help explain what everything does.

    • You will also need the NewPing library, which can be found here: https://bitbucket.org/teckel12/arduino-n...

    • Once you upload the code your tank will start running! (After a five second delay.) Be prepared! It may try to run away. Remove the USB cable once the code has been uploaded.

  22. Okay, you've got your tank assembled and the code is loaded. We're almost ready to test. If you've still got the USB cable connected you can remove it now. If the tank is on a table you might want to put it on the floor.
    • Okay, you've got your tank assembled and the code is loaded. We're almost ready to test.

    • If you've still got the USB cable connected you can remove it now.

    • If the tank is on a table you might want to put it on the floor.

    • You'll need to connect power by placing the Screw Terminal Chip onto the LEGO brick.

    • One more thing! Make sure the wires running from the servos and the battery pack are not in danger of getting hit by the treads! Secure them away from the treads using LEGO, tape, or rubber bands.

    • Okay, we're ready for testing!

    • When you put the Screw Terminal Chip in place on the LEGO with Maker Tape an LED on the Robotics Board will start to blink. It will do this for five seconds, and then your tank will start moving forward.

    • Your tank should go forward until the sensor "sees" something in front of it, and then it will go in reverse, turn, and try to go forward again.

    • If you need to power off your tank just remove the Screw Terminal Chip from the LEGO brick.

    • Did it work? If not, re-check all the previous steps. If everything did work properly, we can keep going!

  23. There's no doubt our LEGO Avoidance Tank is pretty cool... but what would make it more cool? You could build a bunch of LEGO obstacles! You could change the code to affect how the tank moves or how close it get to objects before reversing.
    • There's no doubt our LEGO Avoidance Tank is pretty cool... but what would make it more cool?

    • You could build a bunch of LEGO obstacles! You could change the code to affect how the tank moves or how close it get to objects before reversing.

    • You could make your tank (or other vehicle) completely different, and as long as you're still using two servos and a distance sensor you can use the same code.

    • Whatever you do, have fun and experiment! That's how you learn new things.

Finish Line

One other person completed this guide.

Pete Prodoehl

Member since: 03/04/2020

281 Reputation

159 Guides authored

0 Comments

Add Comment

View Statistics:

Past 24 Hours: 0

Past 7 Days: 2

Past 30 Days: 8

All Time: 61