How does this work? (Voltage question)

Hi guys! I just got started with Arduino and I'm working my way through Banzi's book. I have a shiny new Duemilanove and a bunch of scrap parts.

I'm working on a really simple analog sensor read (p. 68-9 in Getting Started With Arduino.)

Just for fun, I plugged the cathode lead of a green LED into my sensor input (pin 0) and the other lead into my GND pin.

My serial monitor shows 0 most of the time, but when I block light from hitting the LED, serial monitor shows a very small voltage. The numbers hover around 15 or 20.

Why does this happen? Can someone with a more expansive electronics background weigh in? Thanks.

An LED is capable of converting electricity to light, but surprisingly also capable of converting light to electricity. Though it does a pretty poor job of light-->electricity conversion (special "photodiodes" exist that are much better at it).

I think the normal state is to have a few millivolts present at an analog pin due to noise, leakage from neighboring pins, etc. Light shining on the LED could serve to drain charge away from the analog pin and bring it closer to 0. That's my theory :slight_smile:

I'm guessing if you remove the LED entirely you will also see small voltages.

--
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, light sensor, potentiometers, pushbuttons

One of our members Grumpy_Mike actually has a write up on this, take a look, he's got a great website for various applications.

http://www.thebox.myzen.co.uk/Workshop/LED_Sensing.html

Welcome to the wonderful world of Arduino!:slight_smile:

The RedRock Solar Panel control system uses the photovoltaic properties of LEDs as sun position sensors for the linear actuator controller that keeps your panel facing the sun. The LEDs are positioned with about a 90 degree angle between their axii and the differential in voltage feeds into a Schmitt trigger array that drives an H-bridge.