i need to connect the LDR Sensors just to detect human presence and to enable a port where it is connected!
i just want to know whether we can directly connect the LDR to the Port(eg. P0.0) or do we need to connect some more resistor- capacitor combination circuits?
If your microcontroller has A/D converter you can connect LDR directly to the ADC input and GND, and add anoter resistor between Vcc and this pin to create a voltage devider.
If your microcontroller doesn't have A/D converter you will have to use a comparator with adjustable level and then connect the output ftom comparator to pin, say, P0.0 (or any other) ..
Thanks for the reply.......but just one more question! 'I dont have any A/d converters....so shud i buy them or can i connect the LDR Sensors to my uC pins using comparator? if i have to connect them thru comparator...then can u pls give me the CKT diagram for thy connection?
The sensor has to give the pin a 5V Signal when its active and 0v when its inactive! thats all!
Here is a simple light switch build on 2 transistors. For direct connection with the microcontroller input change pnp transistors no npn (polarity of power = 0V to emiters) and connect collector of the second transistor to microcontroller pin..
you can use microcontroller ATMEL AT89C2051, 20 pin uC 8051 family. this uC have comparator internal. it is port 1.0 for + comparator and port 1.1 - comparator.