Light Sensing Robot

to test my programming skills with a PIC(when i get it) i was gonna make a light sensing robt, to go to the brightest spot, or the darkest, but i dont know how i would sense the light, i could use a photoresistor or photo transistor but that would measure the like where the sensor is not out away from it

for example if the robot was in the shadow outside it would sense the shadow not the sun light

Parallex is you one stop shop! :smiley: Seriously they have exactly what your looking for. I was thinking about using one of their ultrasonic sensora on our robot…

A photoresistor is a good option. You’ll need to mount it so that it has a “view”, like putting it at one end of a tube with the other end open and pointing away. It’ll act something like a one-pixel camera. If you place the tube on a servo you’ll be able to scan the scene in various directions before deciding which way to turn the robot. If you mount it solidly to the robot you’ll have to turn the whole thing to look for light and dark.

Multiple sensors with different “views” can make it easier to decide which direction to move at any given moment.

Here are some suggestions:

  1. Use two photo resistors facing the same direction, separated by a piece of foam a couple inches long, or anything else that will block light. Measure the difference between the two cells to determine which side is brighter. Adjust your steering to go toward the brighter side until the values of the two cells are equal (within a certain window or dead band). This will allow you to steer toward light.

  2. If neither cell is seeing enough light to determine which way to steer, like your shadow scenario, set the program to run a searching pattern. A spiral outward works well and is simple to implement.

Both of these suggestions will take some experimenting to find what values work well. Photo resistors are notorious for not being matched, so you should grab extras to sort through to find a set that are close. Then you may need to build a custom circuit to give you a real good match, slightly modifying the resistance of one leg over the other of the sampling circuits.

Oh Bummer. Alan beat me to the punch while I was typing.

wouldn’t that not work becuase doesn’t a photoresistor measure the light touching it?

If you put the sensor inside one end of a tube, what touches it is the light from what the other end of the tube is pointing to.

I dont know if i am just confused or what because I am really good with electronics, but if the sensor is in on end of the tube and the other end has light at it(lets say a 3 inch tube) would the light that is touching the sensor the shadow from the tube?

but i will just take your word for it and try it