1 Attachment(s)
LED "capacitance" won't get lower
Hello,
I've been reading some threads about the LED's capacity feature and that they can be used as "sensors".
Now, I made a short program where I involve 3 LEDs to be discharged and measured in time like this:
<img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1583&stc=1&d=117804885 4">
The shema is simple: one port connected to all Anodes (through a 330 ohms resistor) and three ports connected each to one Kathode. I use a 16F88 @ 20MHz.
I reduced the code as much as I could and here it is:
Code:
LOOP:
for Counter = 1 to 3
PORTB.0 = 0 : PORTB.0(counter) = 1 'reverse power to the LED to "charge" it
TRISB.0(counter) = 1 'make the last HIGH port an Input and...
while PORTB.0(counter) = 1 '...read it. As long as port is 1, increment "Discharge"
discharge = discharge + 1
wend
discharge(counter) = discharge 'store Discharge's value for later comparision
discharge = 0
next
gosub display
TRISB = 0
goto loop
end
I know I can reduce the overall process time by modifying the program but this is currently not the problem since I want to reduce the discharge time of each LED.
I thought I would be able to lower the LED's capacitance by reducing the voltage applied to it. So I put a 10K instead of the 330ohms one.
I even added a 10Mohms resistor in parallel with the LED to make a kind of load.
Result: no change(!?). The time values never change.
What am I doing wrong here? Should I use a 40MHz PIC instead?
Lower the "RC time" is the aim
Well,
I see we all have been reading and viewing the same documents and medias already.
I've tried this with lots of different LEDs (IR, simple colored red/ambre/green/yellow/blue/white, 7seg and even a bicolor one) and they ALL work. Of course, I get different results but it works always.
Since the way to "measure" the LED with a PIC is to calculate it's discharging time (state change), to make it work fast, I want to REDUCE the "RC time".
So, if now I'm counting around 4000 counts (see post #1) until the LED goes from state "1" to state "0", I want to speed-up things with lowering this value and make it become something around 100.
How can I reach this?
Depending on the surrounding luminosity, the scanning/counting process can vary from a few milliseconds to seconds.
As mentionned in lots of articles, the surrounding luminosity affects tremendously the discharge time of the LED and compensation is mandatory.
In my mind, the only way to compensate the longer discharging time due to surrounding darkness is to reduce the voltage applied to the LEDs.
Is there another way?