Wire Configuration

Using input from a photo-sensor

When I look at one schematick it shows:

PWR to Leg 1 of photo-sensor
Leg 2 of Photo-sensor connect to a resitor that then goes to ground AND
Leg 2 of Photo-sensor connected to the analog pin (ie. A0)

Another schematick from another places shows it reversed

PWR to a resitor and then to Leg 1 of photo-sensor AND
Leg 1 of Photo-sensor connected to the analog pin (ie. A0)
Leg 2 of Photo-sensor connect to ground.

What I want to know is why this setup.

Why can't you just have pwr to leg 1 and leg2 to the input pin?

itisi:
Why can't you just have pwr to leg 1 and leg2 to the input pin?

Hi

There's a very detailed tutorial on these over at Adafruit (How to use photocells, LDRs, CdS cells, photoresistors!). Under the heading "Analog voltage reading method" it shows the schematic with the pulldown resistor, and why.

Hope this helps, Geoff

Using input from a photo-sensor

Which one there are lots of different types.

The way a sensor is wired up is defined in the sensor's data sheet.

Why can't you just have pwr to leg 1 and leg2 to the input pin?

Because then there would be no ground to work the amplifier inside the sensor nor any way for the sensor to put a logic zero out to the arduino pin.

Thank you both very much for the reply. I will head over to the link to get my-self some education :fearful: