can PWM do this?

Status
Not open for further replies.

t.man

New Member
hi!

i want to regulate three LEDs birightness.
llike this:

have a setpoint. from my defined range, take any value and subtract the setpoint then the greater the difference the bighter the led. for example, take 0 - 15 and setpoint be 6.
o - 5 : green led
6 - 10: yellow led
11 - 15: red led
then looking at my setpoint, one can see green brightness increases from 5 to 0, yellow increases from 6 to 10, etc.

is that possible using a PWM or the red led would already have been bright, i've tried to read the datasheet but can't clearly get how PWM works
https://www.atmel.com/dyn/resources/prod_documents/doc2466.pdf
 
I am not sure I understand. You have an input voltage range from 0 to 15 and want the green to increase in brightness from 0 to 5, the yellow from 5 to 10, etc.

The first idea I can come up with is to use three comparators. Thuis should be fairly easy using opamps. No need for PWM.

If you want to convert PWM to analog all you need is a low pass filter (RC) and maybe an amplifier.

Or what am I missing?
 
Last edited:

i'm trying to say the greater the deviation is from the setpoint, the brighter the LEDs will shine!...thus the green one will shine as you go away from 6 to zero while the other two wiil shine as you go up from 6.

i think i have clearify my idea!

so i was thinking of the mcu internal PWM! i'm using avr mega16 in avr-gcc c compiler!
 

hi,
Look at these links:

https://www.electro-tech-online.com/custompdfs/2008/04/doc2542.pdf

**broken link removed**

http://www.nongnu.org/avr-libc/user-manual/group__demo__project.html

IIUC the AVR has 4 PWM pins.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…