I am using a picaxe 08M with a 4.5 volt supply. I am trying to fade an array of LEDS when a finger passes over a sensor in a lit room. Here is my progress so far.
I have so far succeeded in using an LDR to notice a finger passing by, and I can make one LED fade out in the time I like. Now, how do I get an array of LED's to do that?
Here is the circuit I have right now. Do you see any problems with it?
4.5v --------o-----------------o
| |
| |
-------- LDR
| 08M | |
| | |
| | (in 1) |
(out4)o--|3 6|--------------o
| | | |
| | | |
| -------- |
| | |
330ohm | 1k ohm
| | |
| | |
1.7v | |
20mA LED | |
| | |
| | |
0v --o------o-----------------o
Is there any reason why I would need a larger resistor for the LDR comparison other than changing the sensitivity?
I like how simple the circuit is right now, since I need about 10 of them.
The circuit works really well right now, being very sensitive to even a very fast moving finger over the LDR.
Here is the code I am using:
main: readadc 1,b1
if b1<50 then flash
goto main
flash:
for b2 = 1 to 40
b3 = b2 * 5
b4 = 201 - b3
pwm 4,b4,3
next b2
goto main
I start the pwm signal at 201 so the brightness is just right and the fade looks good.
The increment size of 5 gives me a good fade.
Was I right to assume the pwm output cannot be zero?
So, now that this seems to be working well, how do I get an array of LED's, 8 to 10 of them, to fade at the same rate, on command?
Sice my background is all things mechanical, I am very new to elecrtonic circuits and the picaxe. Any help to get me in the right direction will be greatly appreciated. Thanks!
Eddie
I have so far succeeded in using an LDR to notice a finger passing by, and I can make one LED fade out in the time I like. Now, how do I get an array of LED's to do that?
Here is the circuit I have right now. Do you see any problems with it?
4.5v --------o-----------------o
| |
| |
-------- LDR
| 08M | |
| | |
| | (in 1) |
(out4)o--|3 6|--------------o
| | | |
| | | |
| -------- |
| | |
330ohm | 1k ohm
| | |
| | |
1.7v | |
20mA LED | |
| | |
| | |
0v --o------o-----------------o
Is there any reason why I would need a larger resistor for the LDR comparison other than changing the sensitivity?
I like how simple the circuit is right now, since I need about 10 of them.
The circuit works really well right now, being very sensitive to even a very fast moving finger over the LDR.
Here is the code I am using:
main: readadc 1,b1
if b1<50 then flash
goto main
flash:
for b2 = 1 to 40
b3 = b2 * 5
b4 = 201 - b3
pwm 4,b4,3
next b2
goto main
I start the pwm signal at 201 so the brightness is just right and the fade looks good.
The increment size of 5 gives me a good fade.
Was I right to assume the pwm output cannot be zero?
So, now that this seems to be working well, how do I get an array of LED's, 8 to 10 of them, to fade at the same rate, on command?
Sice my background is all things mechanical, I am very new to elecrtonic circuits and the picaxe. Any help to get me in the right direction will be greatly appreciated. Thanks!
Eddie