0 - 10V voltage source using PWM

10 posts / 0 new
Author
Message

Hi
I'm projecting 0-10V regulated voltage source. Diagram below shows general idea:

Basically i generate a 0-5V PWM with regulated duty cycle. PWM signal drives a key that switches between 0 and 10V to create another square wave. Low Pass Filter creates DC signal from 0-10V square wave. At the end there is an op-amp for separation.

I want to use 16bit pwm - mode 14 on ATmega8 if i remember right.
So I should have a square wave at around 120Hz.

As my switch I wanted to use MOSFET N + bipolar totem-pole drive circuit, something like shown below:

The problem is that when I was designing that switch I didn't know exactly what resolution (frequency) PWM I would use. So know I'm not sure if it's a good solution given the condition mentioned above.

As my LPF I'll have to use higher order active filter because as it turned out I need my output DC voltage to be as stable as possible so I can't use simple RC network because it gives too much riple to the DC voltage.

Basically that's my idea. The circuit has to provide high stability and precise regulation of output DC voltage, it doesn't have to respond fast though.
So that is my idea, I would like to hear some constructive criticism :) especially regarding that switch "subcircuit".

Why not find a MOSFET that you can drive directly from the micro port line ? You could use a P-CH MOSFET for high side operation or an N-CH for low side operation. I would also switch MUCH faster than 120HZ. Depending on your power requirements, you should have no trouble finding a MOSFET that will switch in the KHZ to 10's of KHZ range without a gate driver (direct port control). Of course, switching losses increase with higher switching frequencies, but your LP filter will be smaller, and you will have higher performance and lower ripple.

Quote:
At the end there is an op-amp for separation.

?

If the output is an op-amp, then obviously the op-amp has a 0-10V or 0-12V, of -12 to + 12 V power supply, so that the output can swing from 0-10 V, and it has the current capability that you require.

I therefore don't understand why one needs to PWM drive a 10V rail to generate a 10 V PWM signal, just to turn it into a DC voltage.

I would use a much higher PWM frequency, feed it through a LPF of several stages, and then feed if through an op-amp with a Gain of 2, to convert the 0-5V PWM generated DC signal up to 0-10 V DC signal.

The filter and the Gain can be combined into a single op-amp stage, if you are building thousands of units. Otherwise, keep it simple for your design and testing. A couple of simple RC filters and voltage followers will generate the 0-5 V DC signal. A simple G=2 will be the final driver.

The details: Note that the PWM output may or may not go "all the way" to 0 or "all the way" to +5V. So in practice the gain has to be a little bit higher, so that the actual output of the PWM at 100 % duty cycle actually hits 10 V on your output.

Likewise, if you really want 0.00 V output, you may need to level shift the PWM "0-5V" signal down a small amout to hit 0.

Still, all very doable without the rather complex and unnecessary PWM booster circuit.

JC

Why not use a simple D/A converter that can output the 0-10v based on a control word.

An OLD example is the AD558. Parallel in 0-10v out.

There are others of course that use I2C and SPI.

Another option is to use a 0-5v out D/A and a x2 op-amp to get your 0-10v

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

"The critical shortage here is not stuff, but time." - Johan Ekdahl

"Step N is required before you can do step N+1!" - ka7ehk

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

Be aware that if your output buffer is powered from +10V and Ground, the output will not reach all the way to 10V nor will it go all the way to ground.

Further,if you use an ordinary op-amp, you will be limited to a fairly small load current. Depending on the device, this limit might be as low as few milliamperes and as high as 20ma. This would not make a very robust voltage source. Such a current limit would still be higher than the current you can get from an RC lowpass filter.

Jim

Until Black Lives Matter, we do not have "All Lives Matter"!

Hi
Thank you all for your replies.
I feel that I should add few thoughts but first i have to explain that what I presented in my first post wasn't entirely my own idea.

At first I wanted to use 10-12 bit DAC just like jgmdesign said. However my far more experienced collegue suggested that when using DAC my output voltage wouldn't be very precise or stable (like reference voltage sources are), so his idea was to create 0-10V wave using voltage reference source and then use LPF - to provide bigger precision of output volt.

Secondly he said that 10bit resolution wouldn't be high enough so that is why I deided to use 16bit PWM - so gahelton that is where 120Hz came from (10 bit would provide 7.8kHz if I calculate correctly)

ka7ehk - I once did research and calculation on how R=9k load would affect RC network's operation (especially corner frequency) so keeping that in mind I decided to use a buffer. I wanted to use rail-to-rail op-amp as buffer to get as close to 0 and 10 as possible, and I think that for now I could survive with fairly small load current.

I would appreciate any further comments :)

Quote:

At first I wanted to use 10-12 bit DAC just like jgmdesign said. However my far more experienced collegue suggested that when using DAC my output voltage wouldn't be very precise or stable (like reference voltage sources are), so his idea was to create 0-10V wave using voltage reference source and then use LPF - to provide bigger precision of output volt.

Well, I'll disagree there, based on my experience. DACs are purpose-built for the task, and are inherently accurate. The "PWM DAC" will always be an approximation, and depending on the filtering will either be "fast but with ripple" or "relatively slow with ripple well filtered".

Our designs have both "PWM DACs" and DAC chips. Back when I was your age, a 12-bit DAC was expensive, say about \$5. Our PWM-DAC circuit with two op amps and discretes was less expensive. Nowadays, we have often applied the Microchip MCP4921/2 (1/2 channels). The two-channel is about \$1/channel in modest quantities. It has pretty good specs and a fairly decent drive, as DACs go. In your case, and in most cases, it is followed by an op amp stage to get desired voltage levels and drive. There is also the MCP48nn series with on-board 2.048V reference. We've used both series.

Quote:

Secondly he said that 10bit resolution wouldn't be high enough

Tell more about that app need.

==================
Now, for both "PWM DAC" and "real DAC" apps, we often have a feedback path to an A/D channel. With that, the commanded value can be "trimmed" to get better accuracy. This might be even more important with a PWM-DAC if you are on that quest for high resolution 9and I assume accuracy).

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

Last Edited: Fri. Dec 28, 2012 - 04:49 PM

You haven't stated HOW accurate you need the output voltage to be?

PWM to DC converters have a LOT of ripple. That is why several people suggested a much higher PWM frequency. With the higher PWM frequency and a good LPF one can reduce the ripple. Build one on the bench and scope it and you will be surprised at the output. Related to this is how fast you can make adjustments to the output.

If you are interested in both precision and accuracy then matching resistors for an R-2R self built DAC is a hassle and not worth it. Using the DAC on the Xmega or an external chip DAC would be easier.

If you are worried about the Vref for the DAC then put a good filter on the V+ supply feeding that chip.

Now, of course, the number of bits of the DAC determine how finely you can adjust the output voltage, analogous to the 10 bit, 12-bit, 16-bit PWM resolution.

You still need a LPF on the output of the DAC to filter the high freq switching noise when you change the output level. Of course there is no ripple when you hold the output at a constant setting.

What is the ripple in the 10 V supply? Is that supply, which abviously also impacts the output voltage, that much better than the supply to a DAC chip?

JC

Well, PWM DACs are monotonic, inherently. That is one thing in their favor.

If all you need is "DC", then lots of filtering can be applied. However, if you use active filtering to get more than one pole or just an op-amp to drive loads, you now have the dc inaccuracies of the op-amp (primarily offset, but also noise).

When you try for more than about 10 bits, there are many other significant factors than just the "DAC".

Jim

Until Black Lives Matter, we do not have "All Lives Matter"!

Here is our "PWM DAC" circuit. It works well for us, with virtually no ripple. But it is gonna be slow--check out the 10uF cap in the middle.

I picked up the design from the Web somewhere over 10 years ago. Perhaps a Microchip app note, but I haven't found it again. lol

The top signal is PWM output from OC1A. The bottom signal is the trim feedback going to an A/D pin. This app is a 0-10V speed command to a motor drive.

In this app, I use the 10-bit Fast PWM mode of timer1. This maps nicely in many apps since it is about 1000 counts and each count represents 0.1% of full range. Lessee, with a 7.37MHz AVR clock and /1 that would give a PWM frequency of 7200Hz. With full 16 bit, that would be about 100Hz PWM. At 16MHz AVR speed, maybe 250Hz. I don't know how the circuit would react at that rate; it would be time to pull out the 'scope. ;)

Attachment(s):

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.