tejashs
Member level 1
hello guys,
i am currently experimenting with a PIC16F873A microcontroller.(this is the only microcontroller i have tried other than 8051s).
i tried doing an automatic light on off mechanism for a room using an LDR, i connected the ldr as a voltage divider with a 100k resistor and connected it to one of the ADC pins in the controller.
in the program part i measured the light intensity in the room and gave something like this
but the problem is when i make the room dark to test, the light source(LED) turns on and illuminates the LDR so in the next round the LED is switched off...
its kinda blinking LED...
any hints to rectify for this????
The LDR gives 1M ohm when completely dark and i am using 7 white led's as a bulb....
i am also planning to implement pwm contol for LED after i learn that part... any tips would be helpful
i am currently experimenting with a PIC16F873A microcontroller.(this is the only microcontroller i have tried other than 8051s).
i tried doing an automatic light on off mechanism for a room using an LDR, i connected the ldr as a voltage divider with a 100k resistor and connected it to one of the ADC pins in the controller.
in the program part i measured the light intensity in the room and gave something like this
Code:
if(light_value < 400)
light = 1;
else
light = 0;
but the problem is when i make the room dark to test, the light source(LED) turns on and illuminates the LDR so in the next round the LED is switched off...
its kinda blinking LED...
any hints to rectify for this????
The LDR gives 1M ohm when completely dark and i am using 7 white led's as a bulb....
i am also planning to implement pwm contol for LED after i learn that part... any tips would be helpful