Let's Make Robots!

How to recognise dark places?


We're trying to create a robot that can "see" dark places and drive to it for our final project for school... One of the things it must be able to do is of course finding the dark places. Since we have nearly no experience with building robots we hope there are some people in here that could help us with some (easy?) questions.

One of our questions is how to recognise dark places. Our first idea was to use LDRs for it. But what do you guys think is the best to do, place 1 LDR on each side of the robot, or use a servo with LDRs mounted on it? Or perhaps there is another way to recognise dark places? Please mention.

We are thinking about buying a PICAXE 28X to make it all work because it looks like it's quite easy to program, it's cheap and that we can find a lot of feedback on the www.

Another thing the robot must be able to is to avoid objects. After looking around we think the best way is to use a Sharp GP2D120 IR Sensor.

Please let us know what you think about our ideas or if there are better ways to do it.

Thanks in advance,



Comment viewing options

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

this might be abit overkill, but it will work.

Use 2 webcams on the bot, one that is infrared and one standard, then compare the images, since the IR camera can see in the dark (using IR LEDS) the IR image will show you everything, and the normal cameras will show darkness. The biggest difference in the images will be the darkness.

Since the cameras are at 2 different places on the robot you can use edge dectection to overlay the first image on top of the other

Be forewarned though, this takes some hardcore high level programming, there are some examples all over the web though

This is a little overkill yeah :D
Anyway thanks for your replies! But can you tell me why you think LDRs won't work. A lack of sensitivity or something else?

An LDR cannot look into a corner and see if it is dark or not. It can only detect light levels at its own location. That's what an LDR is. It is a resistor that has more resistance when it is receiving more light. It is not a camera. It has no brain to recognize what is out there.

However, some simple robots, with only half a brain and two or more LDRs will be able to find a dark place. Just by keeping on the move until it finds a place that is dark enough. Deciding whether to go left or right as they roll around the room. Those kind of robots rely heavily on happenstance. Which does exist!


Wrap a black paper tube around the LDR and it should work fine, if there is no shroud around it light from everywhere will hit it, but stick a thin tube on and you`re limiting where the light comes from. It`s far from perfect but it should give you a little bit of range and a good idea in what direction to go. You could easily have a bunch of them pointing at different angles and compare them.

The use of a couple of LDRs sounds good to both seek and measure a dark place. The Sharp sensor could use the panning servo to avoid things if you only have one, similar to the behavior of the Start Here robot. Guibot made good use of LDRs but with an Arduino. A couple of terms that might give more help, would be phototropic and photophobic. Sounds like a very doable project, to get a robot to seek dark (photophobic) while avoiding obstacles.

I don't think LDR will work.

You must distinguish between "recognizing if the robot is in a dark place" and "find a dark place nearby to reach". LDR can be used for the first case, but i think you need the latter, ie finding a suitable dark place around the room (maybe for the robot to hide?).

You cannot just point the LDR to a direction and expect to know how much light is there in that direction.

I think there's no easy way to do it.. Maybe you could hack something with a camera but i think the performances would be quite low.

If you just need to know if the robot is currently in the dark or not, then LDR are ok, and placing two will make you able to try and move the robot more on the dark  (by running in the direction of the one that reads more dark).

given that the robot goes around the room of course (given...well..by me :D)

a servo with an LDR on it would only make it more expensive. I'd go for the "one LDR per side" solution, that is unless you need pinpoint precision

If you are planning to let the robot choose between the two "areas" it sees on its left and on its right (that is if you place the LDRs on the side) then you could use  a resistive divider setup, as BOA suggested long ago. You basically have an LRD connected to V+ while the other lead is connected both to the input and to the lead of another LDR. The other lead of the last LDR i mentioned goes to 0V. This way you can effectively compare the two results and it only takes 1 input pin. (it must be ADC)

As for rangefinders, i don't know much but i think sonic ones work better but are more expensive.