Introduction: Yet Another Line Following / Obstacle Avoidance 2WD Car

Picture of Yet Another Line Following / Obstacle Avoidance 2WD Car

This robot car is nothing new. Instructables and Youtube are peppered with a robot car similar to this one and honestly those postings inspired me to put together this affordable robotics kit that I could handout at my Robotics workshop (level 1) for grades 6-12. As far as what it does, the title says it all (or see the video) so I won’t bore you with details. This robot isn’t going to win any competitions or awards for being best of _whatever_ but it is an affordable kit which is perfect for educational purposes.

(Update: I made a line-following billboard bot with this platform)

Step 1: Parts

This is a standard kit for my Robotics workshop (Level 1) and you can find parts on-line (except bumper). However, if you like to support my mission* of teaching youth Robotics, you may be able to order the same kit in the future. (*I only assess materials fee for the workshop.)

The kit contains:

  • 2WD car chassis w/ 2 motors, caster, and 6v battery holder (added extra holes for custom mods)
  • custom-made bumper to attach sensors (I couldn't find anyone selling this so I made it out of corner protector you can buy at Home Depot)
  • 9V battery holder
  • Arduino Uno compatible board
  • Motor shield
  • Ultrasonic sensor
  • 2 x infrared sensor
  • Mini breadboard
  • 20 x wire tie
  • 8 x 1in square foam tape
  • 20 x MF 20cm Dupont connector
  • 10 x MM 20cm Dupont connector
  • USB to mini USB cable
  • 4 x AA battery
  • 1 x 9v battery
  • Velcro strap for 6v battery holder (batteries pop out from time to time)
  • Additional flathead M3 7mm and 10mm screws for the bumper and the 9v battery holder.
  • Precision screwdriver set

While motor connectors are pre-soldered with Dupont connectors, soldering is still required for the switch. The plan for the next release is to have all Dupont connections. No soldering! Also, all the flathead screw holes have been counter-sink.

Step 2: Assemble the Car

See the presentation below for assembling the car.

Part 1: Chassis, Motor, Motor Shield, and Arduino (or compatible) board

https://docs.google.com/presentation/d/14f_G5VRUoQ...

Part 2: Sensors

https://docs.google.com/presentation/d/1AxMY8jMx56...

Step 3: Compile and Upload

Download following codes into your Arduino IDE, compile, and upload based on your scenario.

1) Obstacle Avoidance Bot

https://drive.google.com/file/d/0B2KyCJ0WKOzSRURKV...

2) Line Following Bot

https://drive.google.com/file/d/0B2KyCJ0WKOzSbFR2Q...

Step 4: Run

If you have followed my wire connections and pin assignment, the 2 codes for obstacle avoidance and line follower should run out of box. Through my Robotics workshop, my aim is to inspire younger generations to love science and engineering by making something with their hand and learn from doing it...rather than just playing games on smartphones.

If you enjoyed my tutorial and video, please vote for this Instructables for the "Full Spectrum Laser" contest. The laser-cutter would allow me and the kids to fabricate additional parts for future workshops - robot laser tag, self balacing bot, drone, etc.

Comments

16119088 (author)2017-08-02

mình thay bằng mạch cầu H L298N được không

AnaV50 (author)2017-02-21

Can i use adafruit motor shield instead of your motor shield and how that changes the code?

botdemy (author)AnaV502017-02-22

I'm not sure what type of Adafruit motor shields you have but I believe adafruit has a good tutorial on how to use their products. Adafruit may even have a library so you could use the library and their functions in your code.

Basically you have 6 pins to control: left +, left -, left pwm/ena, right +, right -, and right pwm/ena. If you're not going to use PWM, set PWM/ENA pins to always high. (Mine came with jumpers to set them always high). If you do that, you now have 4 pins to control - 2 for each motors. Just play with the code until it works. That's the best way to learn.

AnaV50 (author)botdemy2017-02-28

Thanks

TharindaSL (author)2016-10-10

can you please tell me how to combined these two coads?

botdemy (author)TharindaSL2016-10-11

You will have to figure out on your own. That shouldn't be too difficult. Basically, your main loop has to check 3 sensors (2 IR and 1 Ultransonic) for their values and decide what you want to do. For example, below is another version I have worked on. It checks for all 3 sensors.

bcornu (author)2016-06-24

Hello, thank you for the tuto.

I would like to make the line follower, but it doesn't work and i try to know why.
I use a L293D motor Driver expansion instead of your motor shield. How that changes the code ?

Thanks for the help

botdemy (author)bcornu2016-06-24

I am not sure but for two wheel configuration, you just need to control 6 input - 2 for motor and one pwm per wheel.

wold630 (author)2016-02-26

This is great! What would you estimate the total cost to be to build it?

botdemy (author)wold6302016-02-26

I buy 10 pcs at a time and total cost of each comes out less than $40 including the plastic container. If you're buying for just one, the cost would be slightly higher.

About This Instructable

4,293views

33favorites

License:

Bio: My goal is to captivate, inspire and engage young engineers through intriguing robotics projects. I use Arduino at my robotics workshops since it is the ... More »
More by botdemy:MicroPython IoT Rover Based on WEMOS D1 (ESP-8266EX)Pet Bot (no Coding)Billboard Bot
Add instructable to: