Let's Make Robots!

Wall Following RC car using 16F887

Here are two videos of my hobby level radio control car following the wall around a room.  This car uses channel 3 of the radio control system to toggle between RC control and autonomous control.

http://video.yahoo.com/watch/7184507/18716445

http://video.yahoo.com/watch/7169550/18673820

The idea is to hook middle school kids (USA grades 7th and 8th.  ages 11 - 14) into Science, Technology, Engineering and Math.  This offers the speed and excitement of RC car
 racing, the trial and error of RC race car design plus the clear thinking and discipline of computer programming.

 
 THE COMPETITION:  A car race.

 Build an oval race track on a polished wooden gymnasium floor defined on the inside by
 cardboard boxes large enough to echo back a SRF05 sonar proximity detector's signal.

 The race is to lap the track, say, six times;  three by radio control;  three by autonomous control.  Either time trials or multiple cars at the same time.  If the race has multiple cars on the track at one time, some more work must be done on the car to avoid collision.

  I will design and build a PIC kit that attaches to almost any RC car that has Electronic Speed Control (ESC) driving the wheels and a servo driven steering mechanism.  It will use the car's 7+ volt battery, knocked down to 5 volts by the ESC.  There must be a third channel on the RC system to tell the car who is boss.

 I need to borrow, steal, or design a microcontroller programming language that forces the students to think about the signals from the front and side facing sonars and create the corresponding commands to the wheels and the steering.  Presently the 16F887 compiler runs on a WINDOWS PC and communicates to the car via special hardware connected to the USB port.  (Available from MicroChip Inc.)

----------The post below seems to be way ahead of me----------

Author: bendjamin
| Title: I made some similar robots a

I made some similar robots a while ago.  I'll try and post a video of them.  They are designed to race around a track, in other words they are doing wall avoiding so when you make a track with walls on the inside and outside they will go around and around.  I made the robots myself, they are differential steering with a body made from laser cut polycarbonate.  I used the sharp IR rangefinders for navigation and have four on each robot, two forward facing and two side facing. They also have four bumber switches, one pair in front and the other at the rear.

| Link: http://letsmakerobots.com/node/696#comment-43464

What do you all think?

 Ken

 

Comment viewing options

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

I'm just messing with you kenjones1935. Your results were not bad. Personally, if I was going to test this car in a room like this I would get some thick black rubber foam tape and line the walls and then create an inner wall similar to what your doing with those boxes. This way if the cars momentum is great enough it would just bounce off the inner and outer walls and keep going instead of knocking into boxes that move and so high you can't even see the car. Your cars low to the ground so the foam tape might be a better guide on both sides than just the bare wall and boxes. Not to mention keeping the walls and your car safe from damage while your fine tuning it. This might take some money but I would go the distance. Also, if I remember I think your setup was designed so they could not see the car and run it autonomously until it's back in sight right? Keep working on it!

Excellent Job on your last video convincing that middle school kid. I think he's a Believer and will stick around for a couple more years of this...............

Here is a video of my car on my version of a race track.

It works some times and not other times.  It seems that as the speed increases something is becoming less sensitive.  Maybe the reactions are too slow, but that should be fixable.

http://www.youtube.com/watch?v=bx8KKDknAx0

I have the cover for the car, but I have not put it on because all my circuitry is in  the prototype stage.

Once I get a vehicle that really races I will purchase a different radio transmitter - one with a pistol grip that has three channels.  I will also select a new car or truck.  I need to neaten up my prototyping system so that it will fit on most any chassie.  That plus the PICkit 2 might do the trick.

Is there a cover for this car? Or did you bust it up already?

I now have the sonic ping devices (SRF05's) flashing continuously.  This means that there is no blockage in the PIC's processing.

Now the car is reacting too quickly. There is a bit of code that used to guarantee a 1/2 second backing up when backing up was necessary.  Now the count down for this delay is instantaeous.   While turning a corner the proximity sensor data gets confusing.  Both the side sensors and the forward sensors are hearing important echos.   I might need to adjust the positions of the two SRF05's.  I am not sure.....

 

Ken

Since the system is running so much faster now, maybe you can afford to add a delay between when the front and right SRF05's run their detection subroutine? It wouldn't have to be a 'dumb' delay where you just waste cycles, but instead you could for example run 'puls' in one iteration of the main loop and then run 'pulsf' in the next iteration, just to give the SRF05's a bit of breathing room so they don't interfere with each other.

Turns out that one of my problems has been the length of the trigger pulses that I have been sending the SRF05s.  They were too long using PAUSE 1 with the 4mhz oscillator.

I changed the technique to the following:

SYMBOL trigright PORTD.0

LOW trigright

HIGH trigright

HIGH trigright

LOW trigright

With this technique I can make positive pulses as short as 10usec and grow them in units of the HIGH command..

Ken

The Electronic Speed Control wants this PWM signal to arrive at 50 hz.

I was not clear in my last posting. The Electronic Speed Control PWM specification is for a single positive pulse no less than 1ms and no more than 2ms once per 20 ms, ie 50 pulses per second. The one to two millisecond pulse width is divided into 256 parts. 1.5 ms corresponds to 128 which corresponds to neutral in a servo.

Neutral is steering straight on a steering servo. Neutral is stopped on a wheel driving servo.

I discovered that using HPWM with the 4mhz default oscillator a pulse width of 100 to 110 gets the behavior of 'neutral' on my car. For example "HPWM 1, 100, 50" turns the front wheels of my car to straight. See the attached picture. Channel 2 is the HPWM version of neutral. Channel 3 is what the radio receiver sends.

Oscilloscope of real PWM vs PIC PWM

Not going well at all.

When I up the speed the car does not respond quickly enough.  At a corner Instead of seeing (hearing) ahead and turning, it crashes into the on coming wall, backs up, and tries again. Part of my problem is not  understanding the machine language code behind the PICBASIC PRO commands.  Another part is the PIC getting into little loops or resetting and thereby ignoring the real time signals.  Lastly I need to expand the distances to which the code reacts.  If the velocity is greater, it must start turning or braking sooner.

On the bench, the machine seems to behave as expected, but on the race track.  NOPE.

Ken