Obstacle avoidance robot (made from drift car)

Navigate around via ultrasound

Hello again everybody my name is chickenparmi, and I like robots.

Today I would like to show you my obstacle avoidance bot, with a difference. The difference with this bot is that it has been build onto an RC drift car, meaning it goes very fast and is very dangerous.

Not to long ago I purchased 5 HC-SR04's with the intention to build a robot made out of a butter tub using 360o servos for driving and the U.S sensors for avoidance. After I burnt out the servos due to a colour mismatch on the battery pack that idea was also burnt until I get some replacements. After the anger of wasting $32 settled down I remembered my RC drift car that had been sitting on top of my cupboard for a few months now and decided it was time to make it awesome again.

The first thing I had to do was check to see wether the electronics in the car were going to be easy to interface with the arduino, luckily they were. There was a servo for steering and a brushless motor for throttle, the brushless motor was connected to an electronic speed controller which had some leads going to the battery and three wires branching off to a JST connector.

ze car

 

 

 

 

 

 

 

 

 

 

 

 

Some googling taught me that the ESC can take the same signals sent to control servos and convert them into signals to control the speed of the brushless motor. The hardest part for me was trying to figure out exactly how to wire up the ESC because power was coming out of the VCC line and that confussed me. The ESC did this to power the reciever that came with the car and the steering servo, I figured this out eventually and after some playing around figured out how to wire it up. The battery goes into the ESC, the VCC and ground from the brushless motor go into the ESC, the three wires coming out of the ESC have the standard servo cable look, the ground goes to the arduino ground, the VCC goes to the VCC of the steering servo and the steering servos ground is connected to the arduino's ground.

After all the wiring I uploaded a basic sketch and found the ESC to be non-responsive, at first I thought it was a trouble in my wiring but everything looked alright and nothing was burning so I had a better look at the code. The code seemed fine but some crucial info itch was at the back of my head. I replugged the ESC into the remote control reciever and found that it worked, but I noticed that it beeped in a nice melodic pattern when the controller was on, else, it acted like it was trying to run for its life. I thought about how the radio control sent the signals and wondered if there was a special signal that was sent to turn the ESC on. Atleast now I had a rough idea what I was looking for and could begin to work out what to google for. Some googling found that a idle throttle signal must be sent to the ESC for two seconds to turn the ESC on, apparently its some kind of failsafe. After making some modifications to the code the car would now move forward, but only forward, for some reason it doesn't like going backwards, still have no idea why, please eleborate.

After I was happy with the wiring and mechanical state of the car it was time to put the 'eyes' onto the car to allow it to 'see'. I wanted to make some mounts for the ultrasonic sensors so that they would sit well on the car and be good enough to stay in place at high speeds, I happened to have some styrofoam around so it seemed like a good candidate. Next step came lots of measurements, I had to make sure that everything would fit nice and that there was sufficient holes in the styrofoam to allow the ultrasonic 'eyes' to see through.

ze plans

 

 

 

 

 

 

 

 

 

 

 

 

I took most of the measurements using my new toy that I got from a Uni open day the week before, it's really handy.

ze tool

 

 

 

 

 

 

 

 

 

 

 

 

After all the plans were drawn up I drew these marks on the styrofoam and began to cut them out, making quite the mess.

ze mount 

 

 

 

 

 

 

 

 

 

 

 

I used a big drill bit and manually drilled out the holes for the 'eyes', again making lots of mess.

ze mess

 

 

 

 

 

 

 

 

 

 

 

 

After all the of this was done I made sure that if fit.

ze eyes

 

 

 

 

 

 

 

 

 

 

 

 

I repeated this process until it had three sets of 'eyes' so that it could see infront, left and right.

The next step was the programming. Now because this isn't a two sheel setup where only two wheels control both the speed and direction of the robot I knew this was going to be a little more difficult to setup, so I took to the paper and brainstormed. Instead of the wheels simply turning full left or full right depending on wether there is an object either side of the car I decided to use a dependant approach, depending on how far away that object is determines how sharp the wheels turn. If there is something far away to the right, it turns slightly to the left, it there is something very close to the left, it turns sharply right. I achieved this by using the map function in arduino, depending on if there is any objects near it, and if there is which side is closest, it will map that distance to an angle for the wheels to turn to. This was very effective and once implemented worked exactly how I wanted it to. The front ultrasonic sensor is just to cover the blind spot, if there is something infront of the car it will turn right always, then the side facing sensors can do the rest, this saves some extra programming. 

On the first test I let it loose on the kitchen, I left scuff marks on the edge of the walls, it needed tweaking. After tweaking the values for the maximum distance it could ping and what distance it should take action I let it loose again, this time only crashing once every 15 seconds, good enough for me.

I took it out onto the road for a while and chased it up and down the street. It detected the gutters really well and only crashed a few times, I didn't get video of this because it was its first and final run. The last crash it had was very hard and broke the supports, I haven't fixed it because I feel like I accomplished what I wanted and I was happy with the outcome. 

There is a bad demonstration of the cars turning code in the video but because it was indoors there was always something on each end so it got really claustrophobic.

Comment viewing options

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

Hi mate, welcome to the site. As soon as I saw your profile name i knew you were from Aus. Ha ha parmi's are the best! Have fun bro, I'm a hack with no training but i haven't been active for a while... should get back into it :-D

Thanks for having me :) Haha ofcourse!!! I think I have had a parmi at every pub I have been to! The more the merrier, especially another parmi lover!

if you wont to go in revers you need to hold the signal in the revers position for some time before the ECS will change to revers. when you first set it in revers the ESC goes into brake mode for a moment then reverses, this is to save your gear box . you may also be able to trigger revers by going revers twice ,first time is for a very short time then neutral position then a second for the revers to kick in depends on the ESC's set up 

as you have discovered most RC ESC have the fail safe fetcher/ set up . when i use RC gear with Arduino i have a section in the setup void that sets the Servo command to a 90 or neutral position ,some ESC also need to see a full forward and full revers signal for them to set up correctly this may be some thing you also put in the setup . i found the best way to wright setup code for RC gear is to use the manual ,wile coding for a flycam i would refer to the manual for the timing of each mode (vidio,still,ect)     

is that motor Brush less? i don"t think so, brush less have 3 wires, i think that motor is just a normal DC motor    

 

Ok I will try that out. Yes I found that my ESC needs a neutral signal (90) for one second to boot up, I also put a delay just before it to make sure that everything is booted up etc. Im not sure if this is needed but just incase.

delay(3000);

throttle.write(90);

delay(1000);

Not it isn't brushless, to be honest I didn't actually know what a brushless motor was, I had only seen them in things, I presumed it was brushless because of its size and how fast its RPM was, my mistake and I know now exactly what an brushless motor is.

If you fix it then you should do an elaborate code that will make the car drift and do a perfect nearmiss of the objects in the way. :D

I have an old electric car as well, and a spare IR distance sensor. Hmmmmm... I might do this with my spare PICAXE 28X2.

Anyway, nice robot mate, I can see you are using the holidays to make some robots. I am too.

Oh, and btw, did you do Robocup Junior Australia when you were in school? <http://www.robocupjunior.org.au/>

That would be so awesome to do! Already thinking of how to do it.

Yep just finished Year12 and am waiting to start University next year, nice big holidays ahead.

No sadly my school didn't do anything related to robots. It was a small school (around 300) and so the interest of 1-5 students didn't mean much to them. Hopefully I will be able to do stuff like that at Uni.

Nice job.  I do think you should fix it, though.  Could be a LOT of fun.

Maybe I might make some ultrasonic holders out of acrylic, and improve on the code, I'll have to see.