Go Down

Topic: Digital to Analogue (Read 576 times) previous topic - next topic

cjdelphi


Arrch


Krodal

The most use Arduino Uno board doesn't have an DAC onboard. But it can output a PWM signal.
So the function analogWrite() is actually outputting a PWM signal to a digital output pin.
http://arduino.cc/en/Reference/analogWrite
This is good for leds and motors.

The new Arduino Due with ARM processor does have DAC outputs : http://arduino.cc/en/Main/ArduinoBoardDue

Sev

Nope.  PWM is digital; with PWM and a capacitor to integrate the pulses you can 'fake' an analog output, but that's slow.

analogWrite(255/2) on PWM will give you an on-off signal with 50% duty cycle; half the time it'll be on at full voltage (3.3v on the Due), half it'll be off.  As mentioned above, with a capacitor and a resistor you can integrate these pulses into a voltage, but it's slow and a pain in the butt and requires more components.

analogWrite(255/2) on a Due's DAC should give you a steady voltage of about half of 3.3v.

Of course, this assumes the resolution on both is 8 bits.

In some cases either can be fine, but when you need a real DAC, like for audio output, you need a real DAC

Grumpy_Mike


cjdelphi

i know what pulse width modulation is all about...

creating a low bit rate audio signal and output it via an atmega...  what would that be called ifnot a DAC?

PeterH


i know what pulse width modulation is all about...

creating a low bit rate audio signal and output it via an atmega...  what would that be called ifnot a DAC?


I'm not sure what you're trying to say here, but "creating a low bit rate audio signal and output it via an atmega" does not mean the same thing as PWM or DAC.
I only provide help via the forum - please do not contact me for private consultancy.

DuaneB

Hi,
The difference between DAC and PWM is that PWM is not going to get you high resolutions at high frequency.

For example if you wanted to output 16bit audio on an Arduino UNO running at 16Mhz, in theory you could use the 16 bit timer1.

In practice your output quality would be terrible because the UNO can only count to 65535  244 times a second where as you would want to run your audio interrupts at typical rates of 8,000 or 16,000 samples per second.

A DAC does not have this counting limitation.

Duane B

rcarduino.blogspot.com





Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

Grumpy_Mike


i know what pulse width modulation is all about

Then you should know that it is not a D/A.
It is a time to analogue converter. Not a digital to analogue converter.

Go Up
 

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.
Name:
Email:

shortcuts: alt+s submit/post or alt+p preview