Light sensor switch

Hello, this is my first thread so I hope this is clear enough for you!

I am in the process of making my first Mini-Sumo 'bot and is in need of a circuit that would allow it to tell the difference of light and dark colored floor. it needs to be as minimal as possible and have the ability to, when it is dark, have full resistance and when it is light, it will have no resistance. Kinda like if you were to have a normal switch with purely on and off but it will sense the color.

Thanks for any help!

Hello. If the sensor is going to be underneath your bot looking down, you probably also will need your own light source paired with the detector (otherwise the detector will see “dark” independent of the floor color). Have you considered using a reflectance sensor like the QTR-1A or QTR-1RC? This is precisely the kind of application that these sensors were designed for.

- Ben

This does look like what I was needing. I do have a couple of questions, though, before I buy it.

Can it handle 9V or should I hook up a resitor first?

Which model would be best for what I am doing?

Thank you if you can answer these remaining questions!


The QTR sensors are designed for use at 5V. Anything more that that may damage the LED. Also, if you apply a 9V input, the output could be has high as 9V, which would probably damage any kind of digital electronics that you are connecting it to.

As for which one is best for your application, that depends on what kind of controller you are using to run your sumo. The QTR-1A has an analog output, which makes it the simplest version to use on a controller (like the Orangutans) that has analog inputs. The QTR-1RC is designed for use with more limited controllers like the BASIC Stamp, but it turns out to also have better performance (faster, lower noise) than the QTR-1A, especially when you want to use many sensors in parallel.

Anyway, what controller are you using?


Well, I’m actually not using a controller but a very simple circiut of relays. I found this design in a beginners book called “Junkbots, Bugbots, and Bots on Wheels” so as you can probably tell I, myself, am a beginner at robotics. For this design, it uses a simple touch-switch as a means of edge detection but I thought that maybe I could improve the design a little bit by, instead of having a touch-switch, replace it with some sort of light sensor. A lot better than some paperclip that drags on the ground and when it goes off the edge it flicks the switch off.

So I’m thinking that if that design is analog it will have the same responses as a normal touch-switch.

Well, an analog sensor like the QTR-1A is quite different from a simple switch. In particular, it is only capable of drawing a very small amount of current, maybe a few milliamps. If your relay needs more current than this to activate, you’ll have to amplify that current somehow, and that requires a good understanding of analog circuitry. So, if you want to make it work, you’ll have to read the datasheets for your relays, learn something about how phototransistors work, probably find a few more junkbot-style parts, and create a custom solution for your robot. It’s quite possible to make a junkbot-style circuit using phototransistors if you really know electronics, but if you don’t, you’re probably going to have to use a microcontroller to get it to work.