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 Sensor

Status
Not open for further replies.

ibwev

Member
I am attempting to connect a light sensor (GP2A200LCS0F) to PIC16F690. The pic will receive signal from the light sensor and count the number of interruptions. The maximum current output of the light sensor is 50 mA and the maximum output voltage is 30 V.

Since the maximum input clamp current of the pic is 20 mA and the maximum voltage on Vdd is 6.5 V (I assume all other input pin maximum voltages = Vdd), should Resistor A (see diagram) be:

R=V/I
=(Difference of Maximum Voltages)/(Maximum input clamp current)
=(30 - 6.5) / (0.020)
=1.18 kΩ

View attachment Light Sensor.sch

Light Sensor Datasheet
 

Attachments

  • Light Sensor.pdf
    153.8 KB · Views: 178
Last edited:
Cant read your .sch file. Next time post a graphics file, like a jpg or pdf.

Tie Pin 1 to PIC VCC (+5V).
Tie Pin 2 to PIC input port pin, connect a 10K resistor from PIC pin to +5V.
Tie Pin 3 to PIC VSS (Gnd).
 
This is what I originally posted in .png.

Light Sensor Schematic.png

Is the following diagram the correct schematic?

Light Sensor Schematic 1.png
 
Is the following diagram the correct schematic?

You don't need the 1K resistor. The 10K already provides the pull-up.
 
The 10K already provides the pull-up.

Thanks again for the help MikeMI. Originally, I interpreted the datasheet to require the 1K resistor. Please help me understand how the value of the pull-up resistor is derived.

LightSensorResistor.png

LightSensorMax.png
 
The lower limit for the pull-up resistor is based on how much current the sensor will sink, which I think is ~30mA, so 5V/0.03 = 167Ω.

The upper limit is based on either the input current into the PIC port pin while HIGH plus the Off leakage back into the sensor output pin while HIGH, or how long it will take the pull-up to charge the capacitance of the wire and both pins when the sensor's output transistor turns off.

When the wire is at 4V (which is a clean HIGH, >Vih), there is 1V across my 10K pull-up, meaning it can supply (5-4)/10K = 100uA, which is well in excess of the leakages, which are likely ~1uA each.

A WAG at the capacitance on that wire node is 15p (pin) + 15pF(pin) + 30pF(wire) = 60pF. The time-constant when the pull-up is charging the node is 10e3*60e-12 = 600e-9 = 600ns. I dont think there will many pulses you will miss....

10K is a good compromise; does the job, doesn't produce much heat while the sensor output pin is low...
 
Wow!!! Thanks for the detailed explanation. :) That helps me better understand what is happening in the circuit.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top