cedric100

Hi, I want to create a segway that knows about the distance of the ground using light sensors. I have been trying to use IR phototransistor and IR led in order to measure the intensity of the light that goes back to the phototransistor.

I used IR because I do not want the surrounding light to disturb the signal.

First, I wanted to see what the Phototransistor measures in front of a LED. I have weird values. (Either 0 or 1023, which means either everything or nothing, it is not quite analogic).

Connections. It is the basic:- Resistor of 220 Ohms connected in serie to the LED to produce light feeded to the 5V.- Same resistor connected to the phototransistor, same connection, and the analog input connected between resistor and phototransistor.

I used IR because I do not want the surrounding light to disturb the signal.

But sunlight and tungsten lighting do have near IR - silicon LEDs are only justbeyond the visible at 850--900nm or so. Make sure your phototransistor has an IR filterto reduce the amount of visible it picks up (they respond to all shorter wavelengthsotherwise). You will need to shade your system to get meaningful results I think.

mirith

Have you tried using ultrasonics? My experience with IR sensors (And this is anecdotal, so I could be quite wrong), is that they tend to only really work REALLY close to the ground, and tend to be better for digital rather than analog signals. The times I've used them were to detect the edges of table, so there was a sudden and drastic change in reflected light.