Let's Make Robots!

Light Seeking Car (Moth Car)

Navigate around according to ambient light

Let me introduce you to my Moth Car! The Moth Car is made from the chassis of an old RC car I found out in the shed. Forgotten and deteriorating away I decided to give it a new life.

I carefully de-soldered the wires from the battery pack and DC motors and kept the receiver for another day. Using the Adafruit motor shield for the Arduino Uno I connected the cables. Making sure that everything was connected properly and operational I uploaded some test code and thankfully it all worked.

The next step was assembling the the photo-resistors onto the breadboard and then connecting them to the Arduino also, again I uploaded some test code to print the values of the photo-resistors to the serial monitor. Once the assembly was complete I took about working out how the car was going to respond to the light. In the first version of the code the car simply drove forward continuously and only the steering was affected by changes in light, in the first part of the video you can see this and also see how it kept trying to commit suicide on walls.

My mum saw the thing driving around into walls and asked if i could make it stop, replying with a no I thought why not? I plugged the car up to the computer again and brainstormed ideas how to control the acceleration. Looking at how the beam of a torch acted on the ground it occurred to me that I could use the difference between the photo-resistors to control the forward movement. It took more wall marking to find a suitable difference value but eventually it worked! If there is hardly any difference between the two photo-resistors the car will stop otherwise it will accelerate, this method of control was very effective with a torch indoors but not so much in pure sunlight. This version of the code is seen in the latter half of the video as it goes down the corridor.

I'm very happy with how it turned out and it works quite well! I took this out on our street at night and the car would gravitate towards the street lights. This light method of control is also much easier for younger kids to use and probably also more fun!

Comment viewing options

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

As LMR is experiencing difficulties currently displaying videos here is the video link: http://www.youtube.com/watch?v=KzJaYn5pm4Y&feature=plcp

This is awesome. By the way, which photo sensors did you use? I am trying to make something similar and am using this http://www.cutedigi.com/robotics/irdirection-ir-breakout-with-uart.html but it doesn't seem to be working.

- Prash.

Thanks! I used two of these photoresistors: http://www.basicxandrobotics.com/tutorials/equipment/components/photoresistor.jpg. That device looks really clever, it looks as if it does the same thing but with infra red light instead of light intensity. By the looks of it that sample code they have with those libraries returns which direction the IR light it coming from and prints that value to the serial monitor .Ok, so what exactly seems to be your problem?

I think I will check out the photo resistors you mentioned. The problem with the IR receivers is that it doesn't seem to be returning the right values back. I tried the exact same sample code with the libraries provided but I still get nothing back.

I emailed the support and waiting for them to get back. Looks like another person is having a similar issue. We are discussing it here http://arduino.cc/forum/index.php?topic=122336.new;topicseen 

The photoresistors that I have used are very cheap: http://www.ebay.com.au/itm/LDR-Light-Dependent-Resistor-Lot-of-5-/120343782559?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item1c050c649f&_uhb=1. Sorry about your problems and I hope the issue gets resolved, it probably is an error in the library, I hear other devices similar to the one you have have timing issues in the libraries. If you do happen to get the photoresistors let me know and I'll help you get started.


I greatly appreciate your comments. You may be right about the library errors. I am going through the library to figure out where things are breaking. Unfortunately, I know nothing about C++ and electronics. So, it could take a while for me to get this fixed.

I decided on this IR sensor as I wanted a solderless setup to test something out. If this doesn't work, I will certainly consider your approach.



lol cool and wecome to rbb