Skip to main content

10

Minor Versionm

by Joshua

Introduction

Build a simple obstacle avoiding robot using two 360 continuous rotation servos, a distance sensor, and a Crazy Circuits Robotics Board.

Video Overview

  1. A few notes before we get started... We also have a version of this project that works with our Robotics Board. Check out Obstacle Avoiding Robot (micro:bit). The only real difference is which board we use for controlling the robot. We found a small USB Power Bank that fit into our robot nicely. You may need to design your robot to fit the USB Power Bank you have on hand, or you can also use a your own battery pack. You should provide 5 volts or less to the Robotics Board. (3 AAA batteries will supply about 4.5 volts and should work.)
    • A few notes before we get started...

    • We also have a version of this project that works with our Robotics Board. Check out Obstacle Avoiding Robot (micro:bit). The only real difference is which board we use for controlling the robot.

    • We found a small USB Power Bank that fit into our robot nicely. You may need to design your robot to fit the USB Power Bank you have on hand, or you can also use a your own battery pack. You should provide 5 volts or less to the Robotics Board. (3 AAA batteries will supply about 4.5 volts and should work.)

    • We used a variety of LEGO parts but you should feel free to build yours however you see fit, using whatever parts you have on-hand. The important things you’ll need to do is have a way to mount the servos on the bottom, the ultrasonic sensor so it can point to the front, and some way to hold the Robotics Board and power source in place.

    • In a pinch you can use some tape or rubber bands to mount things where needed. We have provided links to each part on BrickOwl but you can find them anywhere LEGO or LEGO-compatible parts are sold.

  2. We started with a 6 x 12 LEGO Base, which was the smallest we were able to build with. You can go larger if desired but smaller may be a challenge.
    • We started with a 6 x 12 LEGO Base, which was the smallest we were able to build with. You can go larger if desired but smaller may be a challenge.

    • The width of our robot was determined by the USB Power Bank we had, since we needed to be able to slide it into place. A larger battery might require a larger robot.

    • Make your base tall enough to accommodate the battery and leave room above it to fit the Robotics Board.

  3. Each servo motor will need to get mounted to the bottom of your robot base. We ended up using these parts to do so: LEGO Axle 4 with End Stop (87083)
    • Each servo motor will need to get mounted to the bottom of your robot base.

    • We ended up using these parts to do so:

    • LEGO Axle 4 with End Stop (87083)

    • LEGO Half Bushing (32123 / 42136)

    • LEGO Brick 2 x 2 Round (3941 / 6143)

    • You'll need 4 of each part to mount the 2 servos.

    • Once mounted you can add the wheel, which is LEGO Wedge Belt Wheel (4185 / 49750).

  4. Push the servos flush up to the round LEGO pieces. Once you've got both wheels in place you're ready for the third wheel! Like other LEGO builds, there are many options! This servo/wheel mount is what worked for us, but you can try something different.
    • Push the servos flush up to the round LEGO pieces.

    • Once you've got both wheels in place you're ready for the third wheel!

    • Like other LEGO builds, there are many options! This servo/wheel mount is what worked for us, but you can try something different.

  5. Our caster wheel allows our robot to roll, powered by the two wheels attached to the servos, with the caster acting as the "third wheel" so our robot can pivot and move easily. These are the parts we used for our caster wheel attachment: LEGO EV3 Technic Ball Pivots Set 5003245
    • Our caster wheel allows our robot to roll, powered by the two wheels attached to the servos, with the caster acting as the "third wheel" so our robot can pivot and move easily.

    • These are the parts we used for our caster wheel attachment:

    • LEGO EV3 Technic Ball Pivots Set 5003245

    • LEGO Technic Cross Block Beam 3 with Four Pins (48989 / 65489)

    • LEGO Technic Brick 1 x 6 with Holes (3894)

  6. Attach caster wheel to back of robot adding any needed bricks.
    • Attach caster wheel to back of robot adding any needed bricks.

    • In an earlier version of our robot we just used a few round LEGO pieces as a "leg" and those work fine on a smooth surface like a table, but do not work well on carpeting or a non-smooth floor. If you don't have a caster wheel handy, consider the "leg" option.

  7. We'll want to mount the ultrasonic distance sensor on the front of the robot so it can "see" where it is going, and know when to stop before hitting an obstacle. We 3D printed a LEGO-compatible holder for the ultrasonic sensor. You can find the file on Thingiverse if you want to use it: https://www.thingiverse.com/thing:317100... If you do not have access to a 3D printer, you can fashion a way of holding the sensor in place using some LEGO pieces, tape, rubber bands, zip ties, or some other method. The important thing is that it should point towards where the robot is going when it is moving forward.
    • We'll want to mount the ultrasonic distance sensor on the front of the robot so it can "see" where it is going, and know when to stop before hitting an obstacle.

    • We 3D printed a LEGO-compatible holder for the ultrasonic sensor. You can find the file on Thingiverse if you want to use it: https://www.thingiverse.com/thing:317100...

    • If you do not have access to a 3D printer, you can fashion a way of holding the sensor in place using some LEGO pieces, tape, rubber bands, zip ties, or some other method. The important thing is that it should point towards where the robot is going when it is moving forward.

  8. The Robotics Board is the brains of this operation. It's meant to sit on top of LEGO bricks so mounting it is simple. Typically the Robotics Board is use with conductive tape to build circuits directly on top of LEGOs, but since we're just using two servos and a distance sensor, we can plug those directly into the header pins on the board. We'll want to orient the board so that you can easily plug in the USB cable for power. (We were lucky to find a very short USB cable in our "Giant Bin of Random Cables")
    • The Robotics Board is the brains of this operation. It's meant to sit on top of LEGO bricks so mounting it is simple.

    • Typically the Robotics Board is use with conductive tape to build circuits directly on top of LEGOs, but since we're just using two servos and a distance sensor, we can plug those directly into the header pins on the board.

    • We'll want to orient the board so that you can easily plug in the USB cable for power. (We were lucky to find a very short USB cable in our "Giant Bin of Random Cables")

    • You can now plug in the sensor and the servos!

    • 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.

    • Next you'll need to attach each servo connector. They are easy to plug in, just make sure that the brown wires connect to GND, the red wires connect to 5V, and the orange wires connect to pin D6 for for left servo, and D9 for the right servo.

  9. 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.
    • 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.

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

    • The code is simple, and has been commented heavily to help explain what everything does.

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

  10. Once you've got your robot built, and the code has been uploaded to the Robotics Board, you can test it out! The simplest way is by plugging in the USB Power Bank and letting your robot start to roll forward. If you put your hand in front of it, it should back up, turn, and then move forward again. (Don't let it roll off of a table!) We built a simple hexagonal cardboard "arena" for our robot to roll around in using an old cardboard box. Feel free to get creative with what you have on hand.
    • Once you've got your robot built, and the code has been uploaded to the Robotics Board, you can test it out!

    • The simplest way is by plugging in the USB Power Bank and letting your robot start to roll forward. If you put your hand in front of it, it should back up, turn, and then move forward again. (Don't let it roll off of a table!)

    • We built a simple hexagonal cardboard "arena" for our robot to roll around in using an old cardboard box. Feel free to get creative with what you have on hand.

  11. Below are some questions and an additional activity if you want to go a bit further with this project. What did you learn when building your robot? What determined your choices in LEGO parts used?
    • Below are some questions and an additional activity if you want to go a bit further with this project.

    • What did you learn when building your robot?

    • What determined your choices in LEGO parts used?

    • Would your robot roll faster or slower if it had larger wheels?

    • There are two variables in the code you can adjust that will change the amount of time the robot runs when it backs up and then turns to avoid a wall. Feel free to change the goBackwardTime and turnRightTime and see how it affects the actions of the robot. Don't forget to re-upload the code if you change it.

Finish Line

One other person completed this guide.

Pete Prodoehl

Member since: 03/04/2020

281 Reputation

278 Guides authored

0 Comments

Add Comment

View Statistics:

Past 24 Hours: 0

Past 7 Days: 2

Past 30 Days: 6

All Time: 506