Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

Re: Using a capacitor to convert PWM to a voltage

Re: Using a capacitor to convert PWM to a voltage

2012-08-20 by Don Kinzer

--- In AVR-Chat@yahoogroups.com, Philippe Habib <phabib@...> wrote:
> Can someone provide some guidance about how to size the capacitor
> and what type of capacitor is best suited for this type of thing?
You need a resistor in addition to the capacitor.  The values for the R and C to get good filtering will vary depending the chosen PWM frequency and the impedance of the load.  (The PWM signal puts charge into the capacitor during the on time and draws it out during the off time; the load draws charge out of the capacitor.)

In order to calculate acceptable values for R and C, one would need to know the PWM frequency, the load impedance, the desired responsiveness and the allowable error voltage.  For a one-off project, it may be simpler to try some values and determine what works well enough.  For example, for a 1KHz PWM signal you might start with 100 ohms and 10uF.  An oscilloscope would be useful to be able to "see" the resulting signal.

Don Kinzer
ZBasic Microcontrollers

Using a capacitor to convert PWM to a voltage

2012-08-20 by Philippe Habib

I need to generate a 0-10V signal to control some dimmable LED drivers.  I know I could do it with a DAC, but I think I might be able to save a part by generating a PWM signal and smoothing it out with a capacitor to make a voltage out of it.  My problem is, I don't know how to properly size the capacitor to get a reasonably smooth signal.  The output would change slowly.  A full 0-100 or 100-0 transition would take at least a minute and usually many minutes.

Can someone provide some guidance about how to size the capacitor and what type of capacitor is best suited for this type of thing?

Thank you.

Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage

2012-08-20 by Philippe Habib

Thanks Don,

In my case I'm supposed to drive a commercial LED driver's input 0-10VDC control voltage.  Since the input impedance of the LED driver bricks will no doubt vary between manufacturers and probably even models from the same manufacturer it sounds like I'll be safer by using the DAC and spending the extra buck.
Show quoted textHide quoted text
----- Original Message -----
From: "Don Kinzer" <dkinzer@gmail.com>
To: AVR-Chat@yahoogroups.com
Sent: Monday, August 20, 2012 3:14:40 PM
Subject: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage

--- In AVR-Chat@yahoogroups.com, Philippe Habib <phabib@...> wrote:
> Can someone provide some guidance about how to size the capacitor
> and what type of capacitor is best suited for this type of thing?
You need a resistor in addition to the capacitor.  The values for the R and C to get good filtering will vary depending the chosen PWM frequency and the impedance of the load.  (The PWM signal puts charge into the capacitor during the on time and draws it out during the off time; the load draws charge out of the capacitor.)

In order to calculate acceptable values for R and C, one would need to know the PWM frequency, the load impedance, the desired responsiveness and the allowable error voltage.  For a one-off project, it may be simpler to try some values and determine what works well enough.  For example, for a 1KHz PWM signal you might start with 100 ohms and 10uF.  An oscilloscope would be useful to be able to "see" the resulting signal.

Don Kinzer
ZBasic Microcontrollers





------------------------------------

Yahoo! Groups Links

Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage

2012-08-20 by Jim Wagner

And, further, you will NOT get a 10V signal from a 5V logic PWM. From 5V logic,it will vary from (approximately) 0 to (approximately) 5V. There are ways to get 10V out, but you need some kind of supply that is 10V or higher to do it. 


Second, it will take more than just a capacitor. You want at least a series resistor, as Don suggests. 


Jim Wagner 
Oregon Research Electronics 
Show quoted textHide quoted text
----- Original Message -----
From: "Don Kinzer" <dkinzer@gmail.com> 
To: AVR-Chat@yahoogroups.com 
Sent: Monday, August 20, 2012 3:14:40 PM 
Subject: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 






--- In AVR-Chat@yahoogroups.com , Philippe Habib <phabib@...> wrote: 
> Can someone provide some guidance about how to size the capacitor 
> and what type of capacitor is best suited for this type of thing? 
You need a resistor in addition to the capacitor. The values for the R and C to get good filtering will vary depending the chosen PWM frequency and the impedance of the load. (The PWM signal puts charge into the capacitor during the on time and draws it out during the off time; the load draws charge out of the capacitor.) 

In order to calculate acceptable values for R and C, one would need to know the PWM frequency, the load impedance, the desired responsiveness and the allowable error voltage. For a one-off project, it may be simpler to try some values and determine what works well enough. For example, for a 1KHz PWM signal you might start with 100 ohms and 10uF. An oscilloscope would be useful to be able to "see" the resulting signal. 

Don Kinzer 
ZBasic Microcontrollers 




[Non-text portions of this message have been removed]

RE: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage

2012-08-20 by Cat C

Either way you'll likely still need an amplifier (neither AVRs nor DACs won't likely give you 10V output).
So you could go with the PWM and a buffer/amplifier.

Cat

----------------------------------------
Show quoted textHide quoted text
> To: AVR-Chat@yahoogroups.com
> CC: AVR-Chat@yahoogroups.com
> From: phabib@well.com
> Date: Mon, 20 Aug 2012 15:19:50 -0700
> Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage
>
> Thanks Don,
>
> In my case I'm supposed to drive a commercial LED driver's input 0-10VDC control voltage. Since the input impedance of the LED driver bricks will no doubt vary between manufacturers and probably even models from the same manufacturer it sounds like I'll be safer by using the DAC and spending the extra buck.
>
> ----- Original Message -----
> From: "Don Kinzer" <dkinzer@gmail.com>
> To: AVR-Chat@yahoogroups.com
> Sent: Monday, August 20, 2012 3:14:40 PM
> Subject: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage
>
> --- In AVR-Chat@yahoogroups.com, Philippe Habib <phabib@...> wrote:
> > Can someone provide some guidance about how to size the capacitor
> > and what type of capacitor is best suited for this type of thing?
> You need a resistor in addition to the capacitor. The values for the R and C to get good filtering will vary depending the chosen PWM frequency and the impedance of the load. (The PWM signal puts charge into the capacitor during the on time and draws it out during the off time; the load draws charge out of the capacitor.)
>
> In order to calculate acceptable values for R and C, one would need to know the PWM frequency, the load impedance, the desired responsiveness and the allowable error voltage. For a one-off project, it may be simpler to try some values and determine what works well enough. For example, for a 1KHz PWM signal you might start with 100 ohms and 10uF. An oscilloscope would be useful to be able to "see" the resulting signal.
>
> Don Kinzer
> ZBasic Microcontrollers
>
>
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>

Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage

2012-08-20 by Jim Wagner

The OP could drive a switch FET (2N7000, for example) from the AVR and powered from +10V or more. A couple of resistors and a cap will do it. And, you will get far better linearity than though any op-amp. 


Jim 
Show quoted textHide quoted text
----- Original Message -----
From: "Cat C" <catalin_cluj@hotmail.com> 
To: "AVR-Chat@yahoogroups.com" <avr-chat@yahoogroups.com> 
Sent: Monday, August 20, 2012 3:31:14 PM 
Subject: RE: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 







Either way you'll likely still need an amplifier (neither AVRs nor DACs won't likely give you 10V output). 
So you could go with the PWM and a buffer/amplifier. 

Cat 

---------------------------------------- 
> To: AVR-Chat@yahoogroups.com 
> CC: AVR-Chat@yahoogroups.com 
> From: phabib@well.com 
> Date: Mon, 20 Aug 2012 15:19:50 -0700 
> Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 
> 
> Thanks Don, 
> 
> In my case I'm supposed to drive a commercial LED driver's input 0-10VDC control voltage. Since the input impedance of the LED driver bricks will no doubt vary between manufacturers and probably even models from the same manufacturer it sounds like I'll be safer by using the DAC and spending the extra buck. 
> 
> ----- Original Message ----- 
> From: "Don Kinzer" < dkinzer@gmail.com > 
> To: AVR-Chat@yahoogroups.com 
> Sent: Monday, August 20, 2012 3:14:40 PM 
> Subject: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 
> 
> --- In AVR-Chat@yahoogroups.com , Philippe Habib <phabib@...> wrote: 
> > Can someone provide some guidance about how to size the capacitor 
> > and what type of capacitor is best suited for this type of thing? 
> You need a resistor in addition to the capacitor. The values for the R and C to get good filtering will vary depending the chosen PWM frequency and the impedance of the load. (The PWM signal puts charge into the capacitor during the on time and draws it out during the off time; the load draws charge out of the capacitor.) 
> 
> In order to calculate acceptable values for R and C, one would need to know the PWM frequency, the load impedance, the desired responsiveness and the allowable error voltage. For a one-off project, it may be simpler to try some values and determine what works well enough. For example, for a 1KHz PWM signal you might start with 100 ohms and 10uF. An oscilloscope would be useful to be able to "see" the resulting signal. 
> 
> Don Kinzer 
> ZBasic Microcontrollers 
> 
> 
> 
> 
> 
> ------------------------------------ 
> 
> Yahoo! Groups Links 
> 
> 
> 
> 
> 
> ------------------------------------ 
> 
> Yahoo! Groups Links 
> 
> 
> 



[Non-text portions of this message have been removed]

Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage

2012-08-20 by Jim Wagner

You won't get 10V from a 5V DAC! It will need a 10V reference. 


Jim Wagner 
Show quoted textHide quoted text
----- Original Message -----
From: "Philippe Habib" <phabib@well.com> 
To: AVR-Chat@yahoogroups.com 
Cc: AVR-Chat@yahoogroups.com 
Sent: Monday, August 20, 2012 3:19:50 PM 
Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 






Thanks Don, 

In my case I'm supposed to drive a commercial LED driver's input 0-10VDC control voltage. Since the input impedance of the LED driver bricks will no doubt vary between manufacturers and probably even models from the same manufacturer it sounds like I'll be safer by using the DAC and spending the extra buck. 

----- Original Message ----- 
From: "Don Kinzer" < dkinzer@gmail.com > 
To: AVR-Chat@yahoogroups.com 
Sent: Monday, August 20, 2012 3:14:40 PM 
Subject: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 

--- In AVR-Chat@yahoogroups.com , Philippe Habib <phabib@...> wrote: 
> Can someone provide some guidance about how to size the capacitor 
> and what type of capacitor is best suited for this type of thing? 
You need a resistor in addition to the capacitor. The values for the R and C to get good filtering will vary depending the chosen PWM frequency and the impedance of the load. (The PWM signal puts charge into the capacitor during the on time and draws it out during the off time; the load draws charge out of the capacitor.) 

In order to calculate acceptable values for R and C, one would need to know the PWM frequency, the load impedance, the desired responsiveness and the allowable error voltage. For a one-off project, it may be simpler to try some values and determine what works well enough. For example, for a 1KHz PWM signal you might start with 100 ohms and 10uF. An oscilloscope would be useful to be able to "see" the resulting signal. 

Don Kinzer 
ZBasic Microcontrollers 

------------------------------------ 

Yahoo! Groups Links 




[Non-text portions of this message have been removed]

Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage

2012-08-20 by Philippe Habib

Yes, I knew about that.  My plan is to have a 0-5V DAC and a transistor with a gain of 2 as a buffer to drive the LED driver's input.

Thanks for taking the time to point out some stuff I might not have been thinking of.
Show quoted textHide quoted text
----- Original Message -----
From: "Jim Wagner" <wagnejam99@comcast.net>
To: AVR-Chat@yahoogroups.com
Sent: Monday, August 20, 2012 3:39:53 PM
Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage

You won't get 10V from a 5V DAC! It will need a 10V reference. 


Jim Wagner 

----- Original Message -----
From: "Philippe Habib" <phabib@well.com> 
To: AVR-Chat@yahoogroups.com 
Cc: AVR-Chat@yahoogroups.com 
Sent: Monday, August 20, 2012 3:19:50 PM 
Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 






Thanks Don, 

In my case I'm supposed to drive a commercial LED driver's input 0-10VDC control voltage. Since the input impedance of the LED driver bricks will no doubt vary between manufacturers and probably even models from the same manufacturer it sounds like I'll be safer by using the DAC and spending the extra buck. 

----- Original Message ----- 
From: "Don Kinzer" < dkinzer@gmail.com > 
To: AVR-Chat@yahoogroups.com 
Sent: Monday, August 20, 2012 3:14:40 PM 
Subject: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 

--- In AVR-Chat@yahoogroups.com , Philippe Habib <phabib@...> wrote: 
> Can someone provide some guidance about how to size the capacitor 
> and what type of capacitor is best suited for this type of thing? 
You need a resistor in addition to the capacitor. The values for the R and C to get good filtering will vary depending the chosen PWM frequency and the impedance of the load. (The PWM signal puts charge into the capacitor during the on time and draws it out during the off time; the load draws charge out of the capacitor.) 

In order to calculate acceptable values for R and C, one would need to know the PWM frequency, the load impedance, the desired responsiveness and the allowable error voltage. For a one-off project, it may be simpler to try some values and determine what works well enough. For example, for a 1KHz PWM signal you might start with 100 ohms and 10uF. An oscilloscope would be useful to be able to "see" the resulting signal. 

Don Kinzer 
ZBasic Microcontrollers 

------------------------------------ 

Yahoo! Groups Links 




[Non-text portions of this message have been removed]



------------------------------------

Yahoo! Groups Links

Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage

2012-08-20 by Jim Wagner

Some of the brick LED drivers I have used have pretty "stiff" control inputs. BuckPuck is one. Not much current at the high voltage end, but quite a bit (several milliamperes) at the low voltage end. Do not assume they are anything like a high impedance. 


A "single transistor" is very unlikely to give you good results. First, it won't get closer to ground than around 0.3V. Second, its output impedance is likely to be pretty high. And, mediocre linearity (wasting a lot of DAC resolution). Op amps won't do much better because of "rail issues" unless carefully designed. 


A PWM'd FET could get you a long ways in this, pretty low cost, also. 


Jim 
Show quoted textHide quoted text
----- Original Message -----
From: "Philippe Habib" <phabib@well.com> 
To: AVR-Chat@yahoogroups.com 
Cc: AVR-Chat@yahoogroups.com 
Sent: Monday, August 20, 2012 3:41:56 PM 
Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 






Yes, I knew about that. My plan is to have a 0-5V DAC and a transistor with a gain of 2 as a buffer to drive the LED driver's input. 

Thanks for taking the time to point out some stuff I might not have been thinking of. 

----- Original Message ----- 
From: "Jim Wagner" < wagnejam99@comcast.net > 
To: AVR-Chat@yahoogroups.com 
Sent: Monday, August 20, 2012 3:39:53 PM 
Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 

You won't get 10V from a 5V DAC! It will need a 10V reference. 

Jim Wagner 

----- Original Message ----- 
From: "Philippe Habib" < phabib@well.com > 
To: AVR-Chat@yahoogroups.com 
Cc: AVR-Chat@yahoogroups.com 
Sent: Monday, August 20, 2012 3:19:50 PM 
Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 

Thanks Don, 

In my case I'm supposed to drive a commercial LED driver's input 0-10VDC control voltage. Since the input impedance of the LED driver bricks will no doubt vary between manufacturers and probably even models from the same manufacturer it sounds like I'll be safer by using the DAC and spending the extra buck. 

----- Original Message ----- 
From: "Don Kinzer" < dkinzer@gmail.com > 
To: AVR-Chat@yahoogroups.com 
Sent: Monday, August 20, 2012 3:14:40 PM 
Subject: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 

--- In AVR-Chat@yahoogroups.com , Philippe Habib <phabib@...> wrote: 
> Can someone provide some guidance about how to size the capacitor 
> and what type of capacitor is best suited for this type of thing? 
You need a resistor in addition to the capacitor. The values for the R and C to get good filtering will vary depending the chosen PWM frequency and the impedance of the load. (The PWM signal puts charge into the capacitor during the on time and draws it out during the off time; the load draws charge out of the capacitor.) 

In order to calculate acceptable values for R and C, one would need to know the PWM frequency, the load impedance, the desired responsiveness and the allowable error voltage. For a one-off project, it may be simpler to try some values and determine what works well enough. For example, for a 1KHz PWM signal you might start with 100 ohms and 10uF. An oscilloscope would be useful to be able to "see" the resulting signal. 

Don Kinzer 
ZBasic Microcontrollers 

------------------------------------ 

Yahoo! Groups Links 

[Non-text portions of this message have been removed] 

------------------------------------ 

Yahoo! Groups Links 




[Non-text portions of this message have been removed]

Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage

2012-08-20 by Philippe Habib

Are you saying that I'd do better with the capacitor/resistor combo and a FET than by using a FET to amplify the 0-5V signal out of my DAC?

Cost wise, its not a big difference either way.  Going with a DAC, I'd use a tiny24 to drive a SPI DAC, to get 4 ch of PWM, I'd have to get a bigger part that has the 4 ch of PWM available for more money, but I would skip the DAC and spend that money on a bigger micro.
Show quoted textHide quoted text
----- Original Message -----
From: "Jim Wagner" <wagnejam99@comcast.net>
To: AVR-Chat@yahoogroups.com
Sent: Monday, August 20, 2012 3:53:20 PM
Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage

Some of the brick LED drivers I have used have pretty "stiff" control inputs. BuckPuck is one. Not much current at the high voltage end, but quite a bit (several milliamperes) at the low voltage end. Do not assume they are anything like a high impedance. 


A "single transistor" is very unlikely to give you good results. First, it won't get closer to ground than around 0.3V. Second, its output impedance is likely to be pretty high. And, mediocre linearity (wasting a lot of DAC resolution). Op amps won't do much better because of "rail issues" unless carefully designed. 


A PWM'd FET could get you a long ways in this, pretty low cost, also. 


Jim 

----- Original Message -----
From: "Philippe Habib" <phabib@well.com> 
To: AVR-Chat@yahoogroups.com 
Cc: AVR-Chat@yahoogroups.com 
Sent: Monday, August 20, 2012 3:41:56 PM 
Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 






Yes, I knew about that. My plan is to have a 0-5V DAC and a transistor with a gain of 2 as a buffer to drive the LED driver's input. 

Thanks for taking the time to point out some stuff I might not have been thinking of. 

----- Original Message ----- 
From: "Jim Wagner" < wagnejam99@comcast.net > 
To: AVR-Chat@yahoogroups.com 
Sent: Monday, August 20, 2012 3:39:53 PM 
Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 

You won't get 10V from a 5V DAC! It will need a 10V reference. 

Jim Wagner 

----- Original Message ----- 
From: "Philippe Habib" < phabib@well.com > 
To: AVR-Chat@yahoogroups.com 
Cc: AVR-Chat@yahoogroups.com 
Sent: Monday, August 20, 2012 3:19:50 PM 
Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 

Thanks Don, 

In my case I'm supposed to drive a commercial LED driver's input 0-10VDC control voltage. Since the input impedance of the LED driver bricks will no doubt vary between manufacturers and probably even models from the same manufacturer it sounds like I'll be safer by using the DAC and spending the extra buck. 

----- Original Message ----- 
From: "Don Kinzer" < dkinzer@gmail.com > 
To: AVR-Chat@yahoogroups.com 
Sent: Monday, August 20, 2012 3:14:40 PM 
Subject: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 

--- In AVR-Chat@yahoogroups.com , Philippe Habib <phabib@...> wrote: 
> Can someone provide some guidance about how to size the capacitor 
> and what type of capacitor is best suited for this type of thing? 
You need a resistor in addition to the capacitor. The values for the R and C to get good filtering will vary depending the chosen PWM frequency and the impedance of the load. (The PWM signal puts charge into the capacitor during the on time and draws it out during the off time; the load draws charge out of the capacitor.) 

In order to calculate acceptable values for R and C, one would need to know the PWM frequency, the load impedance, the desired responsiveness and the allowable error voltage. For a one-off project, it may be simpler to try some values and determine what works well enough. For example, for a 1KHz PWM signal you might start with 100 ohms and 10uF. An oscilloscope would be useful to be able to "see" the resulting signal. 

Don Kinzer 
ZBasic Microcontrollers 

------------------------------------ 

Yahoo! Groups Links 

[Non-text portions of this message have been removed] 

------------------------------------ 

Yahoo! Groups Links 




[Non-text portions of this message have been removed]



------------------------------------

Yahoo! Groups Links

Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage

2012-08-21 by Jim Wagner

You did not say four channels, earlier. I think I would still do: 


FET: gate to PWM port pin, source ground, drain through pull-up resistor to higher voltage. Pull-up resistor could be as small as 1K ohms (10ma when FET is on if powered from 10V). Maybe smaller. If supply voltage is higher than 10V, add some resistance from drain to ground to bring the FET-off voltage down to 10V. 


Resistor: from drain of FET to cap. 


Cap to ground. R & C as Don suggested. 


Very low cost, very linear, accuracy depends on load. 


Jim Wagner 
Oregon Research Electronics 
Show quoted textHide quoted text
----- Original Message -----
From: "Philippe Habib" <phabib@well.com> 
To: AVR-Chat@yahoogroups.com 
Sent: Monday, August 20, 2012 4:59:30 PM 
Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 






Are you saying that I'd do better with the capacitor/resistor combo and a FET than by using a FET to amplify the 0-5V signal out of my DAC? 

Cost wise, its not a big difference either way. Going with a DAC, I'd use a tiny24 to drive a SPI DAC, to get 4 ch of PWM, I'd have to get a bigger part that has the 4 ch of PWM available for more money, but I would skip the DAC and spend that money on a bigger micro. 

----- Original Message ----- 
From: "Jim Wagner" < wagnejam99@comcast.net > 
To: AVR-Chat@yahoogroups.com 
Sent: Monday, August 20, 2012 3:53:20 PM 
Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 

Some of the brick LED drivers I have used have pretty "stiff" control inputs. BuckPuck is one. Not much current at the high voltage end, but quite a bit (several milliamperes) at the low voltage end. Do not assume they are anything like a high impedance. 

A "single transistor" is very unlikely to give you good results. First, it won't get closer to ground than around 0.3V. Second, its output impedance is likely to be pretty high. And, mediocre linearity (wasting a lot of DAC resolution). Op amps won't do much better because of "rail issues" unless carefully designed. 

A PWM'd FET could get you a long ways in this, pretty low cost, also. 

Jim 

----- Original Message ----- 
From: "Philippe Habib" < phabib@well.com > 
To: AVR-Chat@yahoogroups.com 
Cc: AVR-Chat@yahoogroups.com 
Sent: Monday, August 20, 2012 3:41:56 PM 
Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 

Yes, I knew about that. My plan is to have a 0-5V DAC and a transistor with a gain of 2 as a buffer to drive the LED driver's input. 

Thanks for taking the time to point out some stuff I might not have been thinking of. 

----- Original Message ----- 
From: "Jim Wagner" < wagnejam99@comcast.net > 
To: AVR-Chat@yahoogroups.com 
Sent: Monday, August 20, 2012 3:39:53 PM 
Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 

You won't get 10V from a 5V DAC! It will need a 10V reference. 

Jim Wagner 

----- Original Message ----- 
From: "Philippe Habib" < phabib@well.com > 
To: AVR-Chat@yahoogroups.com 
Cc: AVR-Chat@yahoogroups.com 
Sent: Monday, August 20, 2012 3:19:50 PM 
Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 

Thanks Don, 

In my case I'm supposed to drive a commercial LED driver's input 0-10VDC control voltage. Since the input impedance of the LED driver bricks will no doubt vary between manufacturers and probably even models from the same manufacturer it sounds like I'll be safer by using the DAC and spending the extra buck. 

----- Original Message ----- 
From: "Don Kinzer" < dkinzer@gmail.com > 
To: AVR-Chat@yahoogroups.com 
Sent: Monday, August 20, 2012 3:14:40 PM 
Subject: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 

--- In AVR-Chat@yahoogroups.com , Philippe Habib <phabib@...> wrote: 
> Can someone provide some guidance about how to size the capacitor 
> and what type of capacitor is best suited for this type of thing? 
You need a resistor in addition to the capacitor. The values for the R and C to get good filtering will vary depending the chosen PWM frequency and the impedance of the load. (The PWM signal puts charge into the capacitor during the on time and draws it out during the off time; the load draws charge out of the capacitor.) 

In order to calculate acceptable values for R and C, one would need to know the PWM frequency, the load impedance, the desired responsiveness and the allowable error voltage. For a one-off project, it may be simpler to try some values and determine what works well enough. For example, for a 1KHz PWM signal you might start with 100 ohms and 10uF. An oscilloscope would be useful to be able to "see" the resulting signal. 

Don Kinzer 
ZBasic Microcontrollers 

------------------------------------ 

Yahoo! Groups Links 

[Non-text portions of this message have been removed] 

------------------------------------ 

Yahoo! Groups Links 

[Non-text portions of this message have been removed] 

------------------------------------ 

Yahoo! Groups Links 




[Non-text portions of this message have been removed]

Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage

2012-08-21 by Bernd Felsche

On Tue, 21 Aug 2012 06:14:40 Don Kinzer wrote:
> --- In AVR-Chat@yahoogroups.com, Philippe Habib <phabib@...> wrote:
> > Can someone provide some guidance about how to size the capacitor
> > and what type of capacitor is best suited for this type of thing?

> You need a resistor in addition to the capacitor.  The values for
> the R and C to get good filtering will vary depending the chosen
> PWM frequency and the impedance of the load.  (The PWM signal puts
> charge into the capacitor during the on time and draws it out
> during the off time; the load draws charge out of the capacitor.)

> In order to calculate acceptable values for R and C, one would
> need to know the PWM frequency, the load impedance, the desired
> responsiveness and the allowable error voltage.  For a one-off
> project, it may be simpler to try some values and determine what
> works well enough.  For example, for a 1KHz PWM signal you might
> start with 100 ohms and 10uF.  An oscilloscope would be useful to
> be able to "see" the resulting signal.

Other than PWM into an RC network, another method is to use a
capacitor that is fed from a high supply via a resistor and "bled"
via a FET driven from a digital output of the AVR. The 0-10V output
is realized via a small resistance into smoothing cap; the voltage
on that being the 0-10V.

If the output voltage is scaled (high-impedance R-divider), then
that can be fed into an ADC pin as a feedback for driving the pin to
the FET gate. Software closes the control loop. i.e. the measurement
of the output voltage is used to adjust e.g. the PWM ratio to achieve
the desired voltage. That's basically how a DAC works inside a
package so this is a "Superman-DAC"; wearing its underpants outside
of the suit.  :-)

NB: When the AVR is stopped, the output voltage can rise up to the
high supply's voltage.

-- 
/"\ Bernd Felsche - Innovative Reckoning, Perth, Western Australia
\ /  ASCII ribbon campaign | For every complex problem there is an
 X   against HTML mail     | answer that is clear, simple, and wrong.
/ \  and postings          |  --HL Mencken

RE: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage

2012-08-21 by Cat C

So how is something "ending" in an RC, using a FET as a high voltage switch
better than a rail to rail buffer/amplifier that offers high/known impedance to an RC placed before it, and low impedance to the unknown load after it?

Cat

> To: AVR-Chat@yahoogroups.com
> From: wagnejam99@comcast.net
> Date: Tue, 21 Aug 2012 00:22:20 +0000
> Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage
> 
> You did not say four channels, earlier. I think I would still do: 
> 
> 
> FET: gate to PWM port pin, source ground, drain through pull-up resistor to higher voltage. Pull-up resistor could be as small as 1K ohms (10ma when FET is on if powered from 10V). Maybe smaller. If supply voltage is higher than 10V, add some resistance from drain to ground to bring the FET-off voltage down to 10V. 
> 
> 
> Resistor: from drain of FET to cap. 
> 
> 
> Cap to ground. R & C as Don suggested. 
> 
> 
> Very low cost, very linear, accuracy depends on load. 
> 
> 
> Jim Wagner 
> Oregon Research Electronics 
> 
> 
> 
> 
> ----- Original Message -----
> From: "Philippe Habib" <phabib@well.com> 
> To: AVR-Chat@yahoogroups.com 
> Sent: Monday, August 20, 2012 4:59:30 PM 
> Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 
> 
> 
> 
> 
> 
> 
> Are you saying that I'd do better with the capacitor/resistor combo and a FET than by using a FET to amplify the 0-5V signal out of my DAC? 
> 
> Cost wise, its not a big difference either way. Going with a DAC, I'd use a tiny24 to drive a SPI DAC, to get 4 ch of PWM, I'd have to get a bigger part that has the 4 ch of PWM available for more money, but I would skip the DAC and spend that money on a bigger micro. 
> 
> ----- Original Message ----- 
> From: "Jim Wagner" < wagnejam99@comcast.net > 
> To: AVR-Chat@yahoogroups.com 
> Sent: Monday, August 20, 2012 3:53:20 PM 
> Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 
> 
> Some of the brick LED drivers I have used have pretty "stiff" control inputs. BuckPuck is one. Not much current at the high voltage end, but quite a bit (several milliamperes) at the low voltage end. Do not assume they are anything like a high impedance. 
> 
> A "single transistor" is very unlikely to give you good results. First, it won't get closer to ground than around 0.3V. Second, its output impedance is likely to be pretty high. And, mediocre linearity (wasting a lot of DAC resolution). Op amps won't do much better because of "rail issues" unless carefully designed. 
> 
> A PWM'd FET could get you a long ways in this, pretty low cost, also. 
> 
> Jim 
> 
> ----- Original Message ----- 
> From: "Philippe Habib" < phabib@well.com > 
> To: AVR-Chat@yahoogroups.com 
> Cc: AVR-Chat@yahoogroups.com 
> Sent: Monday, August 20, 2012 3:41:56 PM 
> Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 
> 
> Yes, I knew about that. My plan is to have a 0-5V DAC and a transistor with a gain of 2 as a buffer to drive the LED driver's input. 
> 
> Thanks for taking the time to point out some stuff I might not have been thinking of. 
> 
> ----- Original Message ----- 
> From: "Jim Wagner" < wagnejam99@comcast.net > 
> To: AVR-Chat@yahoogroups.com 
> Sent: Monday, August 20, 2012 3:39:53 PM 
> Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 
> 
> You won't get 10V from a 5V DAC! It will need a 10V reference. 
> 
> Jim Wagner 
> 
> ----- Original Message ----- 
> From: "Philippe Habib" < phabib@well.com > 
> To: AVR-Chat@yahoogroups.com 
> Cc: AVR-Chat@yahoogroups.com 
> Sent: Monday, August 20, 2012 3:19:50 PM 
> Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 
> 
> Thanks Don, 
> 
> In my case I'm supposed to drive a commercial LED driver's input 0-10VDC control voltage. Since the input impedance of the LED driver bricks will no doubt vary between manufacturers and probably even models from the same manufacturer it sounds like I'll be safer by using the DAC and spending the extra buck. 
> 
> ----- Original Message ----- 
> From: "Don Kinzer" < dkinzer@gmail.com > 
> To: AVR-Chat@yahoogroups.com 
> Sent: Monday, August 20, 2012 3:14:40 PM 
> Subject: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 
> 
> --- In AVR-Chat@yahoogroups.com , Philippe Habib <phabib@...> wrote: 
> > Can someone provide some guidance about how to size the capacitor 
> > and what type of capacitor is best suited for this type of thing? 
> You need a resistor in addition to the capacitor. The values for the R and C to get good filtering will vary depending the chosen PWM frequency and the impedance of the load. (The PWM signal puts charge into the capacitor during the on time and draws it out during the off time; the load draws charge out of the capacitor.) 
> 
> In order to calculate acceptable values for R and C, one would need to know the PWM frequency, the load impedance, the desired responsiveness and the allowable error voltage. For a one-off project, it may be simpler to try some values and determine what works well enough. For example, for a 1KHz PWM signal you might start with 100 ohms and 10uF. An oscilloscope would be useful to be able to "see" the resulting signal. 
> 
> Don Kinzer 
> ZBasic Microcontrollers 
> 
> ------------------------------------ 
> 
> Yahoo! Groups Links 
> 
> [Non-text portions of this message have been removed] 
> 
> ------------------------------------ 
> 
> Yahoo! Groups Links 
> 
> [Non-text portions of this message have been removed] 
> 
> ------------------------------------ 
> 
> Yahoo! Groups Links 
> 
> 
> 
> 
> [Non-text portions of this message have been removed]
> 
> 
> 
> ------------------------------------
> 
> Yahoo! Groups Links
> 
> 
> 
 		 	   		  

[Non-text portions of this message have been removed]

Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage

2012-08-21 by Jim Wagner

If you can find a real rail-rail buffer, then, fine. They do generally cost more than a FET. On the other hand, output impedance is a lot lower so it might drive a substantial load.  As usual, its an engineering problem where you have to evaluate lots of things and figure the tradeoffs.

In this case, one possible push toward (good) op-amps is that he wants 4. That means a quad makes sense, and the board area per amp and cost per amp drops.

Jim Wagner

On Aug 20, 2012, at 9:59 PM, Cat C wrote:

> 
> So how is something "ending" in an RC, using a FET as a high voltage switch
> better than a rail to rail buffer/amplifier that offers high/known impedance to an RC placed before it, and low impedance to the unknown load after it?
> 
> Cat
> 
> > To: AVR-Chat@yahoogroups.com
> > From: wagnejam99@comcast.net
> > Date: Tue, 21 Aug 2012 00:22:20 +0000
> > Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage
> > 
> > You did not say four channels, earlier. I think I would still do: 
> > 
> > 
> > FET: gate to PWM port pin, source ground, drain through pull-up resistor to higher voltage. Pull-up resistor could be as small as 1K ohms (10ma when FET is on if powered from 10V). Maybe smaller. If supply voltage is higher than 10V, add some resistance from drain to ground to bring the FET-off voltage down to 10V. 
> > 
> > 
> > Resistor: from drain of FET to cap. 
> > 
> > 
> > Cap to ground. R & C as Don suggested. 
> > 
> > 
> > Very low cost, very linear, accuracy depends on load. 
> > 
> > 
> > Jim Wagner 
> > Oregon Research Electronics 
> > 
> > 
> > 
> > 
> > ----- Original Message -----
> > From: "Philippe Habib" <phabib@well.com> 
> > To: AVR-Chat@yahoogroups.com 
> > Sent: Monday, August 20, 2012 4:59:30 PM 
> > Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 
> > 
> > 
> > 
> > 
> > 
> > 
> > Are you saying that I'd do better with the capacitor/resistor combo and a FET than by using a FET to amplify the 0-5V signal out of my DAC? 
> > 
> > Cost wise, its not a big difference either way. Going with a DAC, I'd use a tiny24 to drive a SPI DAC, to get 4 ch of PWM, I'd have to get a bigger part that has the 4 ch of PWM available for more money, but I would skip the DAC and spend that money on a bigger micro. 
> > 
> > ----- Original Message ----- 
> > From: "Jim Wagner" < wagnejam99@comcast.net > 
> > To: AVR-Chat@yahoogroups.com 
> > Sent: Monday, August 20, 2012 3:53:20 PM 
> > Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 
> > 
> > Some of the brick LED drivers I have used have pretty "stiff" control inputs. BuckPuck is one. Not much current at the high voltage end, but quite a bit (several milliamperes) at the low voltage end. Do not assume they are anything like a high impedance. 
> > 
> > A "single transistor" is very unlikely to give you good results. First, it won't get closer to ground than around 0.3V. Second, its output impedance is likely to be pretty high. And, mediocre linearity (wasting a lot of DAC resolution). Op amps won't do much better because of "rail issues" unless carefully designed. 
> > 
> > A PWM'd FET could get you a long ways in this, pretty low cost, also. 
> > 
> > Jim 
> > 
> > ----- Original Message ----- 
> > From: "Philippe Habib" < phabib@well.com > 
> > To: AVR-Chat@yahoogroups.com 
> > Cc: AVR-Chat@yahoogroups.com 
> > Sent: Monday, August 20, 2012 3:41:56 PM 
> > Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 
> > 
> > Yes, I knew about that. My plan is to have a 0-5V DAC and a transistor with a gain of 2 as a buffer to drive the LED driver's input. 
> > 
> > Thanks for taking the time to point out some stuff I might not have been thinking of. 
> > 
> > ----- Original Message ----- 
> > From: "Jim Wagner" < wagnejam99@comcast.net > 
> > To: AVR-Chat@yahoogroups.com 
> > Sent: Monday, August 20, 2012 3:39:53 PM 
> > Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 
> > 
> > You won't get 10V from a 5V DAC! It will need a 10V reference. 
> > 
> > Jim Wagner 
> > 
> > ----- Original Message ----- 
> > From: "Philippe Habib" < phabib@well.com > 
> > To: AVR-Chat@yahoogroups.com 
> > Cc: AVR-Chat@yahoogroups.com 
> > Sent: Monday, August 20, 2012 3:19:50 PM 
> > Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 
> > 
> > Thanks Don, 
> > 
> > In my case I'm supposed to drive a commercial LED driver's input 0-10VDC control voltage. Since the input impedance of the LED driver bricks will no doubt vary between manufacturers and probably even models from the same manufacturer it sounds like I'll be safer by using the DAC and spending the extra buck. 
> > 
> > ----- Original Message ----- 
> > From: "Don Kinzer" < dkinzer@gmail.com > 
> > To: AVR-Chat@yahoogroups.com 
> > Sent: Monday, August 20, 2012 3:14:40 PM 
> > Subject: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 
> > 
> > --- In AVR-Chat@yahoogroups.com , Philippe Habib <phabib@...> wrote: 
> > > Can someone provide some guidance about how to size the capacitor 
> > > and what type of capacitor is best suited for this type of thing? 
> > You need a resistor in addition to the capacitor. The values for the R and C to get good filtering will vary depending the chosen PWM frequency and the impedance of the load. (The PWM signal puts charge into the capacitor during the on time and draws it out during the off time; the load draws charge out of the capacitor.) 
> > 
> > In order to calculate acceptable values for R and C, one would need to know the PWM frequency, the load impedance, the desired responsiveness and the allowable error voltage. For a one-off project, it may be simpler to try some values and determine what works well enough. For example, for a 1KHz PWM signal you might start with 100 ohms and 10uF. An oscilloscope would be useful to be able to "see" the resulting signal. 
> > 
> > Don Kinzer 
> > ZBasic Microcontrollers 
> > 
> > ------------------------------------ 
> > 
> > Yahoo! Groups Links 
> > 
> > [Non-text portions of this message have been removed] 
> > 
> > ------------------------------------ 
> > 
> > Yahoo! Groups Links 
> > 
> > [Non-text portions of this message have been removed] 
> > 
> > ------------------------------------ 
> > 
> > Yahoo! Groups Links 
> > 
> > 
> > 
> > 
> > [Non-text portions of this message have been removed]
> > 
> > 
> > 
> > ------------------------------------
> > 
> > Yahoo! Groups Links
> > 
> > 
> > 
> 
> 
> [Non-text portions of this message have been removed]
> 
> 



[Non-text portions of this message have been removed]

Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage

2012-08-21 by Bernd Felsche

On Tue, 21 Aug 2012 12:59:01 Cat C wrote:

> So how is something "ending" in an RC, using a FET as a high
> voltage switch better than a rail to rail buffer/amplifier that
> offers high/known impedance to an RC placed before it, and low
> impedance to the unknown load after it?

More complicated. Another IC. More space. More expensive.
A FET would only have to shunt at most a couple of milliamps.

Compensating for the load impedance is fairly straight-forward,
requiring only a small capacitor, 2 resistors and an ADC input on
the AVR.

The trade-off is the "ripple" and the response time. For LED
lighting, a small ripple is not important in most applications.

-- 
/"\ Bernd Felsche - Innovative Reckoning, Perth, Western Australia
\ /  ASCII ribbon campaign | For every complex problem there is an
 X   against HTML mail     | answer that is clear, simple, and wrong.
/ \  and postings          |  --HL Mencken

Re: Using a capacitor to convert PWM to a voltage

2012-10-01 by raoul.palma

--- In AVR-Chat@yahoogroups.com, Philippe Habib <phabib@...> wrote:
>
> I need to generate a 0-10V signal to control some dimmable LED
drivers.  I know I could do it with a DAC, but I think I might be able
to save a part by generating a PWM signal and smoothing it out with a
capacitor to make a voltage out of it.  My problem is, I don't know how
to properly size the capacitor to get a reasonably smooth signal.  The
output would change slowly.  A full 0-100 or 100-0 transition would take
at least a minute and usually many minutes.
>
> Can someone provide some guidance about how to size the capacitor and
what type of capacitor is best suited for this type of thing?
>
> Thank you.
>

All the previous suggestions will like drive you crazy if you try get
them working !  You can not "save a component" and have a decently
working circuit.

-) First off, the nature of an LED is that it is a current-driven
device, not a voltage driven one. Trying to drive it with voltages is
harder than driving it with currents.

-) A nice and simple single IC DAC is very easy to design into a circuit
and even simpler to program with an MCU. It's best that you toss the
PWM-driving idea. This is why Atmel includes a ADC on some of there
MCUs, but never a D/A.  it's very easy to implement externally.

-) You're going to need a signal amplifier. That can be a nice simple
CMOS opamp. Trying to use a single transistor as a signal amplifier will
likely to drive you crazy, too. Transistors are very nonlinear devices,
but you need a linear amplifier. Even the cheapest, simplest, lowest
bandwidth, low-power opamp circuit excels at this. An opamp I've used
with great success is the National Semiconductor LMC6482AIM dual CMOS
opamp.

-) The opamp signal amplifier circuit can take the voltage output from
the DAC and, with just a few resistors, output a linear current
amplifier. Since your LEDs are driven by a "high" voltage, a suitable
low power "drive transistor" should be part of the opamp
voltage-to-current signal amplifier.
  [277]
The DAC drives the current amplifier and the current amplifier drives
the LEDs.
  [389]






[Non-text portions of this message have been removed]

Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage

2012-10-02 by Jim Wagner

The original poster does not require either a filter or an amplifier. A simple NMOS FET switch will do it. SImply PWM drive the switch in the ground lead of the LED., Run the PWM frequency (the PWM repetition frequency, not the counter clock frequency) anything greater than 100Hz or so (set by the vision time constant of the human eye). Done. 


Jim Wagner 
Oregon Research Electronics 
Show quoted textHide quoted text
----- Original Message -----
From: "raoul.palma" <raoul.palma@yahoo.com> 
To: AVR-Chat@yahoogroups.com 
Sent: Monday, October 1, 2012 1:43:49 PM 
Subject: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 







--- In AVR-Chat@yahoogroups.com , Philippe Habib <phabib@...> wrote: 
> 
> I need to generate a 0-10V signal to control some dimmable LED 
drivers. I know I could do it with a DAC, but I think I might be able 
to save a part by generating a PWM signal and smoothing it out with a 
capacitor to make a voltage out of it. My problem is, I don't know how 
to properly size the capacitor to get a reasonably smooth signal. The 
output would change slowly. A full 0-100 or 100-0 transition would take 
at least a minute and usually many minutes. 
> 
> Can someone provide some guidance about how to size the capacitor and 
what type of capacitor is best suited for this type of thing? 
> 
> Thank you. 
> 

All the previous suggestions will like drive you crazy if you try get 
them working ! You can not "save a component" and have a decently 
working circuit. 

-) First off, the nature of an LED is that it is a current-driven 
device, not a voltage driven one. Trying to drive it with voltages is 
harder than driving it with currents. 

-) A nice and simple single IC DAC is very easy to design into a circuit 
and even simpler to program with an MCU. It's best that you toss the 
PWM-driving idea. This is why Atmel includes a ADC on some of there 
MCUs, but never a D/A. it's very easy to implement externally. 

-) You're going to need a signal amplifier. That can be a nice simple 
CMOS opamp. Trying to use a single transistor as a signal amplifier will 
likely to drive you crazy, too. Transistors are very nonlinear devices, 
but you need a linear amplifier. Even the cheapest, simplest, lowest 
bandwidth, low-power opamp circuit excels at this. An opamp I've used 
with great success is the National Semiconductor LMC6482AIM dual CMOS 
opamp. 

-) The opamp signal amplifier circuit can take the voltage output from 
the DAC and, with just a few resistors, output a linear current 
amplifier. Since your LEDs are driven by a "high" voltage, a suitable 
low power "drive transistor" should be part of the opamp 
voltage-to-current signal amplifier. 
[277] 
The DAC drives the current amplifier and the current amplifier drives 
the LEDs. 
[389] 

[Non-text portions of this message have been removed] 




[Non-text portions of this message have been removed]

Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage

2012-10-02 by Philippe Habib

Actually, what I needed was a 0-10V analog signal to drive a commercial dimmable LED driver module.  The requirement was to drive 4 of these with up to 50ma.  I was leaning toward a quad SPI DAC and then a simple amplifier using a FET, but the project was put on hold for a few months so I never followed up.

Thank you for all of the help and advice.
Show quoted textHide quoted text
----- Original Message -----
From: "Jim Wagner" <wagnejam99@comcast.net>
To: AVR-Chat@yahoogroups.com
Sent: Tuesday, October 2, 2012 8:21:13 AM
Subject: Re: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage

The original poster does not require either a filter or an amplifier. A simple NMOS FET switch will do it. SImply PWM drive the switch in the ground lead of the LED., Run the PWM frequency (the PWM repetition frequency, not the counter clock frequency) anything greater than 100Hz or so (set by the vision time constant of the human eye). Done. 


Jim Wagner 
Oregon Research Electronics 

----- Original Message -----
From: "raoul.palma" <raoul.palma@yahoo.com> 
To: AVR-Chat@yahoogroups.com 
Sent: Monday, October 1, 2012 1:43:49 PM 
Subject: [AVR-Chat] Re: Using a capacitor to convert PWM to a voltage 







--- In AVR-Chat@yahoogroups.com , Philippe Habib <phabib@...> wrote: 
> 
> I need to generate a 0-10V signal to control some dimmable LED 
drivers. I know I could do it with a DAC, but I think I might be able 
to save a part by generating a PWM signal and smoothing it out with a 
capacitor to make a voltage out of it. My problem is, I don't know how 
to properly size the capacitor to get a reasonably smooth signal. The 
output would change slowly. A full 0-100 or 100-0 transition would take 
at least a minute and usually many minutes. 
> 
> Can someone provide some guidance about how to size the capacitor and 
what type of capacitor is best suited for this type of thing? 
> 
> Thank you. 
> 

All the previous suggestions will like drive you crazy if you try get 
them working ! You can not "save a component" and have a decently 
working circuit. 

-) First off, the nature of an LED is that it is a current-driven 
device, not a voltage driven one. Trying to drive it with voltages is 
harder than driving it with currents. 

-) A nice and simple single IC DAC is very easy to design into a circuit 
and even simpler to program with an MCU. It's best that you toss the 
PWM-driving idea. This is why Atmel includes a ADC on some of there 
MCUs, but never a D/A. it's very easy to implement externally. 

-) You're going to need a signal amplifier. That can be a nice simple 
CMOS opamp. Trying to use a single transistor as a signal amplifier will 
likely to drive you crazy, too. Transistors are very nonlinear devices, 
but you need a linear amplifier. Even the cheapest, simplest, lowest 
bandwidth, low-power opamp circuit excels at this. An opamp I've used 
with great success is the National Semiconductor LMC6482AIM dual CMOS 
opamp. 

-) The opamp signal amplifier circuit can take the voltage output from 
the DAC and, with just a few resistors, output a linear current 
amplifier. Since your LEDs are driven by a "high" voltage, a suitable 
low power "drive transistor" should be part of the opamp 
voltage-to-current signal amplifier. 
[277] 
The DAC drives the current amplifier and the current amplifier drives 
the LEDs. 
[389] 

[Non-text portions of this message have been removed] 




[Non-text portions of this message have been removed]



------------------------------------

Yahoo! Groups Links

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.