Go Down

Topic: Digital to Analogue (Read 569 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


Go Up