Simple IR sensors

Hi All,

I am building a simple Arduino based robot for our clubs upcoming competition. The robot has to navigate a very simple maze, just a series of left and right turns, through the "4 elements". Each section of the maze will feature an element, ie. water, fire, wind, and earth.

What I would like to do is use a simple IR sensor schematic like this one:

I would like to be able to center the robot between the maze walls, and detect when to turn. I know there are ready made distance measuring sensors (sharp, ping, etc.) but I want to do this as simply as possible. This is my first complete robot.

1. Does anyone have ideas on how to center the robot between the walls?
2. Do you have a better schematic or idea for the IR sensors (but still simple and inexpensive)?



How far away will the walls be from your robot when it's centered. The IR sensor to which you linked is a reflectance sensor, and it will only give you useful readings over very short distances (you probably won't be able to see things much past an inch). We sell a version of this circuit that relies on timing of a capacitor discharge to optain a reflectance measurement, and we've found that you can get useful analog readings out to much larger distances than the version that outputs an analog voltage (i.e. the circuit you linked to). Since these sensors would presumably be on the sides of your robot rather than the bottom (which is the more typical installation location), IR in ambient lighting could pose a significant problem. You might be able to get around this by shielding your sensor.

  • Ben

The path down the maze is 12". The robot is about 4 inches wide, so a sensor that could read from 0" to 8" would work. If I could get some kind of reading from each side mounted sensor, I could probably manage a way to compare those readings and center the bot.

Are you saying the maze segment is 12" wide or 12" long?

Here is a link to a sketch of the maze…

The maze is actually built on a 4’x8’ plywood base, so the sketch is not to scale.

Assuming the maze isn't painted black, you could probably get sufficient readings from a circuit like:

I'll do some quick tests and see what kind of results I get between 2" and 8".

  • Ben

Wow, thanks for the effort! There has been a lot of buzz in our club over the video you posted with the Orangutans doing the line following competition. I am doing my best to get other people, especially the newbies, to consider the Arduino. After seeing that video, some of the more experienced guys are interested now.

I'll go ahead and put a link to Pololu on our website.

Well I did some tests with a series of QTR-RC sensors and I could reliably detect distances out to about 10" when looking at a white wall inside the office (note that the area was lit with fluorescent lights, which don't create a lot of ambient IR). When I tried the same thing on a wall near a window, I got no meaningful results as the ambient IR coming in through the window was completely dominating the signal. Perhaps with the right shielding you could somewhat compensate for this, but I'm not sure how well that would work.

And thank you for putting a link to Pololu on your robot club's website. We definitely appreciate it!

  • Ben

Hi Ben...I have had no luck with the circuit. No reliable output at all.

I could not find a 10nf cap at the local store, but they had 9nf ones. Maybe that is not close enough. Also, I'm using the Radio Shack IR xmt/rcv pair.

The transmitter is nice and bright (viewed through digicam) so I think the prob is my receiver. I'm going to get some of those Panasonic IR receivers like I have in my Sumovore.


Are you actually using the circuit right? Note that you need to charge the capacitor yourself and then time the discharge to get a measure of reflectance. If you're using your own IR emitter and phototransistor you might need to tweak resistor values.

  • Ben