Dicky Mint
Senior Member
Hi
I'm trying to build a proof of concept of a colour sensor to RGB LED converter!
What I'm trying to do is use an LDR to sense reflected red, green and blue light from Superbright LEDs then use this
information to pwm an RGB LED.
I've built a prototype module on a PCB and it responds after a fashion
I'm a bit stuck and would appreciate some help or a push in a right direction?
I've tried to calibrate using black, white and coloured cards but in practice the RGB LED appears to light at random!
How can I calibrate it to sense the coloured LEDs reflections and ignore the other colours?
My program is as follows:-
[#picaxe20M2
;Test Program for electronic Chemeleon 06
;13/2/13 Rick HSI-Inc
symbol RED_LED = B.3 ;assign names to pins
symbol GREEN_LED = B.2
symbol BLUE_LED = B.1
symbol RED_RGB = C.5
symbol GREEN_RGB = C.3
symbol BLUE_RGB = C.2
symbol LDR = B.0
main:
high RED_LED
Pause 333
readadc LDR,b0 ;measure amount of reflected RED light
let b0 = b0 - 95 * 10 ;scale LED brightness response
pwmout RED_RGB,255,b0 ;signal to control brightness of RGB LED
low RED_LED
high GREEN_LED
Pause 333
readadc LDR,b1
let b1 = b1 - 95 *10
pwmout GREEN_RGB,255,b1
low GREEN_LED
high BLUE_LED
pause 333
readadc LDR, b2
let b2 = b2 - 65 *5
pwmout BLUE_RGB,255,b2
low BLUE_LED
debug ;press F8 to show variables screen
Pause 333 ;blank all LEDs
goto main]
I'll post a circuit diagram and a photo if that would help?
Rick
I'm trying to build a proof of concept of a colour sensor to RGB LED converter!
What I'm trying to do is use an LDR to sense reflected red, green and blue light from Superbright LEDs then use this
information to pwm an RGB LED.
I've built a prototype module on a PCB and it responds after a fashion
I'm a bit stuck and would appreciate some help or a push in a right direction?
I've tried to calibrate using black, white and coloured cards but in practice the RGB LED appears to light at random!
How can I calibrate it to sense the coloured LEDs reflections and ignore the other colours?
My program is as follows:-
[#picaxe20M2
;Test Program for electronic Chemeleon 06
;13/2/13 Rick HSI-Inc
symbol RED_LED = B.3 ;assign names to pins
symbol GREEN_LED = B.2
symbol BLUE_LED = B.1
symbol RED_RGB = C.5
symbol GREEN_RGB = C.3
symbol BLUE_RGB = C.2
symbol LDR = B.0
main:
high RED_LED
Pause 333
readadc LDR,b0 ;measure amount of reflected RED light
let b0 = b0 - 95 * 10 ;scale LED brightness response
pwmout RED_RGB,255,b0 ;signal to control brightness of RGB LED
low RED_LED
high GREEN_LED
Pause 333
readadc LDR,b1
let b1 = b1 - 95 *10
pwmout GREEN_RGB,255,b1
low GREEN_LED
high BLUE_LED
pause 333
readadc LDR, b2
let b2 = b2 - 65 *5
pwmout BLUE_RGB,255,b2
low BLUE_LED
debug ;press F8 to show variables screen
Pause 333 ;blank all LEDs
goto main]
I'll post a circuit diagram and a photo if that would help?
Rick