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.

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:
HS3 said:
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?

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!
 
t.man said:
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.

Latest threads

New Articles From Microcontroller Tips

Back
Top