Sign in

username:

password:



Not a member?

Search basicx



Search tips

Subscribe to basicx



basicx by Keywords

Accelerometer | ADC | ADXL | Adxl20 | AVR | BasicStamp | BX-35 | BX28 | BX35 | COM3 | Compiler | Downloader | EEPROM | Electromagnet | GetADC | GP2D1 | GPS | I2C | IDE | Keypad | LCD | LCD+ | MIDI | Motors | Multitasking | Netmedia | Networking | PCB | PID | PlaySound | PWM | Relays | RTC | Servo | ShiftOut | SitePlayer | SPI | Stack | Timer | USB

Ads

Discussion Groups

Discussion Groups | BasicX | LED as simple light detector

Discussion forum for the BasicX family of microcontroller chips.

LED as simple light detector - Tom Becker - Jun 13 16:28:58 2007

Folks, here's a cool trick to detect light.

Connect an LED - any LED should work, but I chose a phosphor "white" -
between an analog input processor pin and ground. Connect the LED
_anode_ to ground, the reverse of normal LED wiring; no resistor is
necessary. That's the extent of the hardware.

To measure illumination hitting the LED, do this:

call PutPin(BackwardsLEDpin, bxOutputHigh) 'charge the LED
uiLightValue = cuint(RCTime(BackwardsLEDpin, 1) 'discharge the LED

Brighter illumination will produce a smaller value, dimmer larger, but
below some brightness threshold, RCTime will timeout and yield zero.

Using a phosphor white LED makes the device sensitive to UV, since the
LED phosphor will be excited and, in turn, illuminate the LED. It is
moderately UV sensitive, in fact.

This works by treating the LED as a light-dependent capacitor,
charging it to supply voltage and using RCTime to determine how long
it takes to discharge.
Tom



(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )


Re: LED as simple light detector - Tom Becker - Jun 13 17:32:46 2007

Actually, the RCTime technique works on any input pin and it seems to
work very well with a grounded-anode IR photodiode, too.
Tom


(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: LED as simple light detector - Tom Becker - Jun 13 18:57:34 2007

> ... photodiode, too.

I see that this technique has been shown before; it was buried in
http://tech.groups.yahoo.com/group/basicx/message/20743 , by
bryanwasherein04.
Tom


(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )