Let's Make Robots!

Ebay-bot (now with WiiCamera)

Avoid obstacles, crash, follow my Rover 5

Update 2: Added a WiiCamera sensor :)

I put a tilt/pan kit and WiiCamera on the little bot. Bought both from Rocket brand studios (CtC). The sensor is super cool :) It did not take me long to make a sketch so the robot would follow an IR light source (I used an IR led). I then put an IR led on my Rover 5 (which is remote controlled) and started driving around the house with the little bot following the Rover. Awesome fun :) Added a couple of videos of my results.

Update 1: Turned it in to a crash robot:

Obstacle avoiding was becoming to boring. So I decided to make a crash robot :) I removed the ultrasonic sensor and servo and added an ADXL345 accelerometer. The accelerometer detects when the robot has crashed in to something and then backs up and turns around. The ADXL345 works at 3.3V and uses the I2C bus. I removed the Bajduino 3A and used my new Bajduino mega 1284. This board has a ATmega1284P-PU micro controller, a 3A 5V LM2596 vreg and a LD1117 3.3V vreg. The board also has an I2C logic level converter on board. Ideal for this little robot :)  See video to see it work, code is on my website :)

Original post:

This is my version of the "start here" robot. For me this was a programming exercise. I had written an obstacle avoiding sketch for my Rover 5. It worked but I was never really happy with it. Most code that I've seen online uses lots of delays in the code. Some time ago I swore to myself to never use the delay function in void loop ever again. There are various reasons for it, once you start writing more advanced code the delay function can cause lots of trouble. I also use a library (RF24network) in another project where I can not use the delay function. I built this robot in less then an hour but spent countless hours fine tuning my sketch. The sketch is really simple. It read the value of the SR04 ultrasonic sensor which is mounted on a servo. And depending on the values of the sensor the robot goes forward or left/right/backward.

For the chassis of the robot I used a small plastic box. I have a couple of this boxes lying around. I've made a line following robot with the same box some time ago. I made a hole in the box with my dremel to run the wires to the motor controller.

I bought some cheap wheels and motors on Ebay and attached them to the chassis with double sided tape.

I also bought a small caster wheel on Ebay and attached it the same way.

I had bought a couple of L293D H bridge chips on Ebay. I found a schematic here on LMR posted by DanM of a L293D controlled by 2 transistors. So I soldered the L293D, 2 transistors, 4 resistors and some pins and terminals to a piece of perfboard.

I did some testing with it and it worked first time :)

I then added an SG90 servo with the SR04 ultrasonic sensor mounted on it. Chris from Rocket brand studios supplied me the nice sensor bracket :) I have a dozen Arduinos/clones in various forms. I used my power duino, the Bajduino 3A (ATmega328 with 3A 5V switch mode regulator). I hooked everything up to my Bajduino and I could start programming it. I also added 4 leds to the back of the sensor bracket. I always add some leds to my robots, they are very handy while testing/programming a robot.

I used a small 2S Lipo to power the robot but this caused a small problem. The voltage of a 2S Lipo is to high for these motors. So I tried running it at a very low pwm duty cycle. This was a bad choice, the motors have very little torque and the robot would never drive in a straight line. I solved it by powering the L293D from the 5V of my Bajduino. It has a 3A regulator so it's powerful enough for the motors. It's not the best idea to power a mcu and motors from the same vreg but it worked in this case.

I then spent quite a bit of time perfecting my code and I now have a decent obstacle avoiding sketch that doesn't use the delay function. You can see the code on my website: http://www.bajdi.com/obstacle-avoiding-robot-made-from-cheap-parts.


Comment viewing options

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

...oh wait... but only tomorrow or after :P