Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Light detection using 16F877

Status
Not open for further replies.

antoni1

New Member
Hi
using LDR minimum resistance 9k and max 22k can anyone suggest a value for a capacitor to be used to enable 16F877 to detect light????

(Im trying to set RA5 to +5V output and wait a short time for the capacitor to discharge (both plates at +5V). Then, change the pin to act as an input. As soon as this is done the capacitor will be free to charge up again through the resistor (Ie it brings the capacitor plate back down to 0 Volts). As soon as the pin is changed to an input, it suppose that i have to wait for a certain amount of time and if it hasn't charged by then assume that the resistance is high and therefore the light levels are low. )

I use Ldr connected in series with 10K parallel with capacitor of 100nF but nothing seems to happen !!!!
 
antoni1 said:
Hi
using LDR minimum resistance 9k and max 22k can anyone suggest a value for a capacitor to be used to enable 16F877 to detect light????

(Im trying to set RA5 to +5V output and wait a short time for the capacitor to discharge (both plates at +5V). Then, change the pin to act as an input. As soon as this is done the capacitor will be free to charge up again through the resistor (Ie it brings the capacitor plate back down to 0 Volts). As soon as the pin is changed to an input, it suppose that i have to wait for a certain amount of time and if it hasn't charged by then assume that the resistance is high and therefore the light levels are low. )

I use Ldr connected in series with 10K parallel with capacitor of 100nF but nothing seems to happen !!!!

Check my tutorials, the Joystick one uses this method to read it's resistance. Replace the joystick with the LDR, then try light and dark readings, adjust the value of the capacitor to give a good range.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top