Saturday, February 23, 2013

Arduino autonomous tracked robot build Part 1

So I am finally taking time to write about this one. I created the monster some time ago but I haven't have the chance to talk about it. This is a simple (yet it took me a bloody long time to complete) Arduino Uno, motor shield, Ping sensor, infrared sensor, autonomous robot.
My arduino autonomous tracked robot
So there it is, that picture explains everything, my job is done here :)

Arduino autonomous tracked robot build Part 1
Arduino autonomous tracked robot build Part 2
Arduino autonomous tracked robot build Part 3
Arduino autonomous tracked robot (visual post)

Let me start from the beginning.
First think I tried to make and somewhat succeeded is the infrared distance sensor. Starting with this instructable I built a small perfboard with 3 infrared LEDs and 1 38KHz infrared remote receiver; small simple cheap parts.

Looking at the setup in the instructable I got the impression that you can actually have each LED controled separately, meaning that I didn't have to buy one of those expensive Ping sensors. That's the point I understood that this is a lot more difficult than expected. So the way that this sensor works is by pulsing the LED at close to as possible to 38KHz so that the remote sensor will see it. Following the instructions, I managed to use the center LED with the sensor just fine (when adding the straw piece over the diode). I then figured it would be equally easy to make use of the other 2 diodes independently so that I can have vision directly in front, to the left and to the right.

'It doesn't work' is the short version. The long version... I don't really understand it but it goes something like this: the IR library, in order to pulse the LED that fast modifies one of the timers of the Arduino and thus makes certain pins unusable in the normal fashion. The timer are directly related to the PWM functions as in pin 3 can be used to drive the LED that way and that's it, that is a single timer/function.
Now the Arduino has 3 timers, I assumed I can use these and all will be good. Again, it doesn't work. After failing horribly I found out that I can use one of the other 2 timers to drive another LED but I wouldn't be able to use the Arduino to also drive a motor shield because Timer1 controls the pins used by all motor shields, pins 9 and 10, and Timer0 is a general purpose timer that is used by all of the pins and internal workings (it will screw with analog to digital conversion and other stuff).

I abandoned this idea and linked all the LEDs together and decided to use this just as a reverse sensor.
Front of the 38KHz IR sensor bar
Back of the 38KHz IR sensor bar

As you can see on the back there are only 4 wires, a common ground, +V for the sensor, another +V for the LEDs and a SIGNAL wire that reads the values of the sensor.
Left side of 38KHz IR sensor bar
Right side of the 38KHz IR sensor bar

This was just the beginning.

Continue to Part 2

No comments:

Post a Comment