What can't you do with PWM compared to DAC

Hi.

I am learning Arduino. I have read the analogWrite actually uses a digital signal, via the PWM technique.

I also read that is good enough for dimming LED's, controlling motors, generating audio...a lot of things, after all.

My question is, what are the main things you can't achieve with PWM, but you definitely need DAC instead? I am asking in general, but also particularly in the Arduino/microcontrollers arena.

Thanks,
Dan

With PWM, you have an oscillating signal that you filter with a low pass filter to smooth into a ripply level.
With a DAC, you are basically writing the level you want and it stays there until you write again.
You can have dual and quad DACs with higher resolution than the 8 bits offered with PWM, easily accessed with fast I2C or even faster SPI commands.
Its also possible to create more complex waveforms if desired, such as playback of sampled files from memory.

Very interesting, CrossRoads - thanks a lot.

Is the "low pass filter" you were talking about integrated into the microcontroller or is it something I should take care of?

Dan

low pass filter is external, just a resistor/capacitor.

there are lots of calculator websites, for example

PWM switches ~490 Hz, so pick values to filter out frequencies above that.

dan_plan:
My question is, what are the main things you can't achieve with PWM, but you definitely need DAC instead? I am asking in general, but also particularly in the Arduino/microcontrollers arena.

In general? Not much.

In Arduino terms? Quite a lot. Arduino has quite a limited PWM frequency/resolution. eg. You can't do high quality audio output.

My question is, what are the main things you can't achieve with PWM, but you definitely need DAC instead? I am asking in general, but also particularly in the Arduino/microcontrollers arena.

To generate low frequency analog output; to generate fine analog output; to generate fast analog output; etc.

The flip of the coin is also true: there are cases where pwm is much preferred over dac.

Both are very application specific.

My question is, what are the main things you can't achieve with PWM, but you definitely need DAC instead? I am asking in general, but also particularly in the Arduino/microcontrollers arena.

Well I pose a question to your. If one wires a PWM signal to a digital voltmeter what would it read at 50% output? If you have a DAC that outputs 0-+5vdc what will the same voltmeter display with a 50% signal?
There lies the difference and should point to applications best suited for one or the other.

Lefty

dhenry:

My question is, what are the main things you can't achieve with PWM, but you definitely need DAC instead? I am asking in general, but also particularly in the Arduino/microcontrollers arena.

To generate low frequency analog output; to generate fine analog output; to generate fast analog output; etc.

I guess all those "1-bit-DAC" CD players are a figment of my imagination....

From wikipedia:
"A Bitstream or 1-bit DAC is a consumer electronics marketing term describing an oversampling digital-to-analog converter (DAC) with an actual 1-bit DAC (that is, a simple "on/off" switch) in a delta-sigma loop operating at multiples of the sampling frequency. The combination is equivalent to a DAC with a larger number of bits (usually 16-20). The advantages of this type of converter are high linearity combined with low cost, owed to the fact that most of the processing takes place in the digital domain and requirements for the analog anti-aliasing filter after the output can be relaxed. For these reasons, this design is very popular in digital consumer electronics (CD/DVD players, set-top boxes and the like)."

So not sure what you are trying to point out fungus.

Found another good description here

CrossRoads:
So not sure what you are trying to point out fungus.

1-bit-DAC is an example of using PWM to generate analog signals in consumer electronics.

It does all that stuff he claims can't be done ("low frequency analog output; fine analog output; fast analog output; etc").

It may not be practical for all applications but in theory PWM+filter can do anything an DAC can do.

fungus:
It does all that stuff he claims can't be done ("low frequency analog output; fine analog output; fast analog output; etc").

Damn, how does TI get away with selling their expensive DACs then? :slight_smile:

http://www.ti.com/docs/prod/folders/print/dac5670.html

Gotta take the guy mentality for that one:
more bits/seconds
more power
more balls!

Gues it helps to have a higher power uP also to send it data that fast.

Features

14-Bit Resolution
2.4-GSPS Maximum Update Rate Digital to Analog Converter

Power Dissipation: 2 W
252-Ball GDJ Package

APPLICATIONS
Satellite Communications

JoeN:
Damn, how does TI get away with selling their expensive DACs then? :slight_smile:

http://www.ti.com/docs/prod/folders/print/dac5670.html

When I say "in theory" it means there's practical limits...

eg. 1.2Gsps output with 14-bit resolution would need a 20 terahertz PWM clock 8)

CrossRoads:
Guess it helps to have a higher power uP also to send it data that fast.

I think we would be well into (multiple?) CPLD/FPGA territory on that DAC. Certainly a (relatively) slow but smart uP to direct all the action of the heavy equipment.