Author Topic: PWM to Analog DC Voltage Converter Chip for Arduino  (Read 17851 times)

0 Members and 1 Guest are viewing this topic.

Offline beaker353

  • Regular Contributor
  • *
  • Posts: 78
  • Country: us
PWM to Analog DC Voltage Converter Chip for Arduino
« on: February 19, 2011, 07:39:45 AM »
Hello all!  I am working on a project that uses serial commands to control a voltage controlled gain op-amp.  I am using the Arduino to receive and process the serial commands and slowly working through the needed programming.  On the output side of the Arduino I need to find a way to convert the 5V PWM outputs into a clean 0-4v DC signal, what the VCA op-amp needs.  I have seen various designs on the web using a RC network to accomplish this, but I have to believe that there is a chip out there that would do it more precise and all in one nice package.  Anyone know what I should be looking for or some specific recommendations?  Thanks!

Online Simon

  • Global Moderator
  • *****
  • Posts: 7413
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Politically Incorrect
Re: PWM to Analog DC Voltage Converter Chip for Arduino
« Reply #1 on: February 19, 2011, 07:47:40 AM »
why do you need a chip if a simple RC network (fancy name for two basic parts) will do the job ?

Offline DaveW

  • Frequent Contributor
  • **
  • Posts: 252
  • Country: gb
    • WattCircuit
Re: PWM to Analog DC Voltage Converter Chip for Arduino
« Reply #2 on: February 19, 2011, 08:48:11 AM »
Well you can buy a nice 5th order filter chip, or just buy a DAC chip which will give you an output that won't need filtering in roughly the same space-but as Simon says, why use that instead of an RC filter?

Offline beaker353

  • Regular Contributor
  • *
  • Posts: 78
  • Country: us
Re: PWM to Analog DC Voltage Converter Chip for Arduino
« Reply #3 on: February 19, 2011, 09:15:59 AM »
It honestly comes from to my lack of knowledge of caps and RC circuits in general.  Usually an IC datasheet gives me enough information that I can figure out how to interface the chip into a workable circuit.  If it's not something that exists on a chip, I can certainly play around with some caps and RC circuits and eventually find a workable solution.  Just trying to find an easier way to get to a solution.

Online Hero999

  • Super Contributor
  • ***
  • Posts: 3710
  • Country: 00
Re: PWM to Analog DC Voltage Converter Chip for Arduino
« Reply #4 on: February 19, 2011, 09:52:50 AM »
I agree an RC is ideal.

What's the PWM frequency and signal being modulated?

If you use a single RC filter with a cut-off of 1/100 of the PWM frequency you'll have virtually no ripple or you could use two RC filters one after the other with the cut-off at 1/10 of the PWM frequency for similar performance.

An op-amp configured as a non inverting amplifier could be used to reduce the output impedance of the circuit.

Offline beaker353

  • Regular Contributor
  • *
  • Posts: 78
  • Country: us
Re: PWM to Analog DC Voltage Converter Chip for Arduino
« Reply #5 on: February 19, 2011, 10:12:08 AM »
The Arduino PWM outputs modulates at just under 500Hz, so the period between pulses is little over 2ms. The impedance of the control voltage input on the Analog Device SSM2018 is 1Mohms, so the drain that will put is minimal at worst.  Would I be able to predict how long it would take for the DC voltage to stabilize after a change in the PWM?  For example, I change the PWM from 25% modulation to 75%, and then later back to 25%.  My understanding is there will be a time for the DC voltage to reflect the PWM change.

Offline Eliminateur

  • Regular Contributor
  • *
  • Posts: 170
  • Country: ar
  • Electronic's Technician
Re: PWM to Analog DC Voltage Converter Chip for Arduino
« Reply #6 on: February 19, 2011, 10:28:01 AM »
beaker, i've come to a similar necesiity than your and solved quite easily as i don't like fiddling with analog if i can help it(Rc networks, cutoff freqa, yadda yadda, i don't like it, too messy and i needed a perfectly static output voltage):
serial controlled(I2c/SPI, both have arduino libraries) digital potentionmeter.
It has the same cost as a low cost-DAC and gives you a little more "simplicity" as you simply put a tap value instead of having to calculate what vout you'll get at what duty and then calibrate it(because arduino pwm ain't exactly 500Hz, in fact it's a little lower and messy freq), they come in various values, shapes and taps.

examples:
Analog Devices AD5206 spi 6 pots 256taps(8bit word) in DIP package
Microchip MCP42010

and several others, hope it helps

alm

  • Guest
Re: PWM to Analog DC Voltage Converter Chip for Arduino
« Reply #7 on: February 19, 2011, 11:45:41 AM »
serial controlled(I2c/SPI, both have arduino libraries) digital potentionmeter.
It has the same cost as a low cost-DAC and gives you a little more "simplicity" as you simply put a tap value instead of having to calculate what vout you'll get at what duty and then calibrate it(because arduino pwm ain't exactly 500Hz, in fact it's a little lower and messy freq), they come in various values, shapes and taps.
With a DAC you simply put a voltage, even simpler in my opinion. You can also get them with higher resolution and/or speed than digital pots. Digital potentiometers seem to me like devices for people who haven't got their head around the digital world yet, so they try to emulate a pot. They are useful for some applications (eg. a variable attenuator with mediocre performance, like for audio), but for generating DC voltages, a DAC is superior.

Offline Eliminateur

  • Regular Contributor
  • *
  • Posts: 170
  • Country: ar
  • Electronic's Technician
Re: PWM to Analog DC Voltage Converter Chip for Arduino
« Reply #8 on: February 19, 2011, 01:35:16 PM »
how do you "simply put a voltage"?, it's the same as a digital pot, you put vcc, vref and output so it's almost the same for both devices, you simply put the voltage.

i use 8 bit digital pot for a 0-5V precision adjust of qusi-static output}(maybe changes once every minute), i find it offers the same performance as an 8bit DAC but much simpler(both offer 256 steps from 0 to 5v), as almost any serial 8-bit dac is multiple output and SMD (which i don't want, and haven't found a single DIP I2C serial 8bit simple voltage output DAC, heck, it's hard to even find a serial 8bit dac at all, the 8bit dacs normally found are +10yr designs like the DAC083 series from National that use parallel bus, which is a no-go).
pricewise i'd say they're the same.

Maybe if i where to need 12bit or differential output or current output or even simultaneous multiples outputs or high speed or if there where some problem with the variable output impedance of the pot output(easily solvable with a opamp) then a DAC would be the only choice(and some dacs even require external buffers, so kind of moot), but for semi-static 8bit 0-5v single ended output, it's the same(and i think digital pot commands are simpler than a DACs)

at the end, everyone uses what they feel more comfortable/simpler/best for their application based on the data they have

Offline cyberfish

  • Regular Contributor
  • *
  • Posts: 171
Re: PWM to Analog DC Voltage Converter Chip for Arduino
« Reply #9 on: February 19, 2011, 08:34:56 PM »
Digital pots may have their uses in very specific application areas (variable gain amplifier, etc), but generating an analog voltage digitally is not one of them.

By definition, that's what DACs do. Digital to analog converters.

Quote
i use 8 bit digital pot for a 0-5V precision adjust of qusi-static output}(maybe changes once every minute), i find it offers the same performance as an 8bit DAC but much simpler(both offer 256 steps from 0 to 5v), as almost any serial 8-bit dac is multiple output and SMD (which i don't want, and haven't found a single DIP I2C serial 8bit simple voltage output DAC, heck, it's hard to even find a serial 8bit dac at all, the 8bit dacs normally found are +10yr designs like the DAC083 series from National that use parallel bus, which is a no-go).
pricewise i'd say they're the same.

What's wrong with more than 8 bits? People don't make slow 8-bit DACs anymore because they can make 12-bit ones for the same price. If you don't need that many bits, just set the 4 LSB to 0. People don't usually complain about having too many bits.

http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=MAX518BCPA%2B-ND

Online Hero999

  • Super Contributor
  • ***
  • Posts: 3710
  • Country: 00
Re: PWM to Analog DC Voltage Converter Chip for Arduino
« Reply #10 on: February 19, 2011, 10:08:57 PM »
The Arduino PWM outputs modulates at just under 500Hz, so the period between pulses is little over 2ms. The impedance of the control voltage input on the Analog Device SSM2018 is 1Mohms, so the drain that will put is minimal at worst.

What about the frequency being modulated?

It can't be over 50Hz anyway, otherwise filtering becomes very difficult and there'll be lots of ripple on the output.

What's the maximum acceptable ripple on the output?


Quote
Would I be able to predict how long it would take for the DC voltage to stabilize after a change in the PWM?  For example, I change the PWM from 25% modulation to 75%, and then later back to 25%.  My understanding is there will be a time for the DC voltage to reflect the PWM change.


Technically speaking, the DC voltage on the capacitor never reaches the average PWM value (steady state), it just gets closer and closer over time until for all intents on purposes it's equal to the average voltage. For a single RC circuit, the DC voltage on the capacitor will be within 3% of the average PWM voltage after 3 RC time constants and it'll be within 0.7% after 5.
http://en.wikipedia.org/wiki/RC_circuit

Unfortunately, a single RC circuit won't be enough to give you low ripple, unless the bandwidth is really low. Using three, one after another will be better. I've not calculated the settling time but I estimate it'll be three times as long. So for the circuit attached, you can expect the output to be within 0.7% of the input after 16.5ms which is RC time constants.



Offline beaker353

  • Regular Contributor
  • *
  • Posts: 78
  • Country: us
Re: PWM to Analog DC Voltage Converter Chip for Arduino
« Reply #11 on: February 20, 2011, 07:43:02 AM »
I can think of places where each of the three options would be the best choice, so I guess you are all right in that respect.  Just for the heck of it, I'm going to try to work out each of the three options mentioned and see which one floats my boat the best...

Hero999, if I’m reading your last post correctly...  There is no data modulated on the PWM signal.  Simple duty cycle on/off usually used to vary the brightness of a LED.  http://www.arduino.cc/en/Tutorial/PWM  I really couldn't tell you what my acceptable ripple is quite yet.  The less the better, but I really can't predict the end audible effect the ripple will impart into the VCA until I breadboard it.  As far as stabilization time, I would say with 1% within 50 cycles (100ms) is about as good as I would need.  I have a feeling that depending on the load a RC circuit places on the PWM outputs, this might be the way to go at least for my first test...

Thanks all for the ideas!!

Online Hero999

  • Super Contributor
  • ***
  • Posts: 3710
  • Country: 00
Re: PWM to Analog DC Voltage Converter Chip for Arduino
« Reply #12 on: February 20, 2011, 07:52:01 AM »
If all you need to do is vary the brightness of an LED, there's no need for an RC filter, the slow response of the human eye will act like a low pass filter.

Online Simon

  • Global Moderator
  • *****
  • Posts: 7413
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Politically Incorrect
Re: PWM to Analog DC Voltage Converter Chip for Arduino
« Reply #13 on: February 20, 2011, 08:00:59 AM »
for 1% in 50 cycles you will be fine with the RC filter. Don't over complicate your life. If your worried about loading the output (don't know about atmels but pic's can output up to 25mA) just use a transistor as a buffer

Offline beaker353

  • Regular Contributor
  • *
  • Posts: 78
  • Country: us
Re: PWM to Analog DC Voltage Converter Chip for Arduino
« Reply #14 on: February 20, 2011, 09:04:41 AM »
Hero999, I was just explaining how the PWM output of the Arduino is USUALLY used.  For my application I am feeding a control voltage to a Analog Devices SSM2018 a voltage controlled op-amp that directly uses a true industrial level differential input.  Gain is inversely proportional to the DC voltage put on the control pin from 0 to 4vDC.  I have the many 2018's in a large Vegas production show I maintain so I know it can actually cut it.  It's usually just controlled by a DC voltage from a pot configured as a voltage divider or just 4vDC on/off from a relay or such.  I want to be able to control a decent sized bank of these from a fairly remote location, so hence using the PWM outputs of an Arduino connected to a network...

If a simple RC circuit will suffice, anyone with specific schematics and values to get me going?...


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf