Let's Make Robots!

Arduino Avoider


Update for http://letsmakerobots.com/node/25837

Stops and reverses for a millisecond when it comes within 30 cm of an object for effective braking when it picks up speed. Looks left and right and chooses the direction with the most space. PWM to about 1/4 of the speed.

Issues corrected.

     To drive the motors properly I ended up having to stack 4 sn754410 chips on top of one another to handle the current. Works great.


Remaining issues.

There is about a half sec lag between the response time of the right wheel after the left wheel. Not sure theres anything that can be done about this though. *Corrected this issue with a few tweaks to the code*


The speed is still an issue. Because of the gear ratio on the car itself it is a speed demon. If I alter the code to slow it down it won't be able to move properly. If I speed it up, it picks up speed quickly and moves faster than It can react to detected objects, which causes it to occasionally rams into things. Increased the distance to keep from objects to 30 cm from 20 cm to allow it more reaction time. Still experimenting on findind a suitable speed and distance. I added a huge bumper so it can ram into whatever it likes now without damaging itself.

Would like to add white led headlights to the front which turn on while it is moving forward, red led headlights to the rear which turn on as it backs up, and maybe green or blue leds somewhere which light as it turns.

Any ideas, suggestions, inputs or comments are welcome! nothing wrong with learning

UPDATE: Changed the code so it now looks left and right and makes the best choice where to go when it comes to an object. Added Brake Lights and headlights. PWM the speed to about 1/4 of what its capable of. Reverses for 1 millisec when it detects something for more effective braking... not bad for my first robot huh. Last Video Shows The Final Product


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

1) That is one cool looking bot. Show me pictures of the large wheels. They look awsome

2) Isn't it way to fast to follow anything? I'd love to see it drive, but I wonder if it will be able to avoid crashing into any object it sees.

3) dont post your code on the page like that. Add it as an attachment. That makes for a much nicer read of your pages.


It actually works pretty well b/c as it approaches an object it slows itself down and backs up if it gets inside 30 cm. It does occasianally bump into things though and then begin to reverse. I can adjust the maxspeed in the program. Ill upload a video of it roaming around as soon as I can.

Here are some more pics of the wheels.


nice that it works now. with the motor controller IC. good work.
I'm not familiar with arduino code but:

that half-sec delay is logical because you first need to turn the servo to the left. (which is time consuming) and then changed the left motor direction. Then turn the servo to the right (which also takes time) and then the right engine to change direction.

you could it do that you first look to the left and right. and then the motors simultaneously change direction.


True. I'm still gettin familiar with arduino code myself. Will look into that suggestion. Thanks!


Hey Elijah, the bot looks great!   it reminds of the rigs you see in the tractor-pull competitions.

the code looks good too.  good structure and commenting always pays off.

Stacking those motor drivers looks like a great solution to the current issue you had earlier. The robot looks much better in this video. Good job!


I'm anxious to see it running on the floor!

Funny!  Found your project while searching for better h bridge for my makey robot.  I wanted something faster than what is in the Makey plan so I used an old RC tyco fast traxx (which is same kind of design - two motors but with tracks).  TB6612FNG melted. Tried one L293D and that chips output to the motors was too weak.  I might try your chip stack. It's just wrong and I like it.

Have you thought about using two ping detectors and no servo?  More cycles spent detecting objects while traveling fast than waiting for the servo. 

   Yea I saw your page on Makey seemed like a cool idea. I commented about the servo not panning on the avoidance code. Also had an issue finding the right motor driver. One L293d is just not powerful enough and overheats, but stack them and the current splits so each one handles less current but the voltage doesnt change. Easy fix! I used sn754410 chip b/c it can handle twice the current as the L293d.

   I have thought about using two ping sensors. That would take care of the delay having to wait for the servo to turn and allow the one ping to detect left and right. Those tyco RC cars are really fast. Have to PWM them. In your code I just adjust the MAXSPEED to slow it down

Yeah, the stacking of chips was a great idea. A true example how to think differently in a critical situation. Welcome to LMR.