[Company Logo Image]        Misc 

Home Up Contents Search Articles Caveat Purpose Notice                                                           

 

If you shine a light into a LED, approximately 1.5V develops across it. This is enough voltage to drive a transistor and produce an input signal to a PIC. So you could use a LED as a simple light detector.

To measure analog resistive signals, connect a pin to ground via a capacitor (about 10n) and connect a variable resistance across the capacitor. In your code, set the pin to OUTPUT a HIGH long enough to charge the capacitor, then switch the pin to INPUT. The capacitor will discharge via the variable resistance and the time for the PIC to register a LOW input signal will be a function of the size of the capacitor (which will be constant) and the variable resistance to be measured.

Credit:  Drew Ames - South Australian PIC Users Group

Home ] Up ]                                                                                                                                               

Send mail to ironsidz@hotmail.com with questions or comments about this web site.
Copyright © 2003 
Last modified: March 18, 2004