Go Down

Topic: Arduino Zero DAC (Analog Output) Cutoff Below the Rail Voltage (Read 369 times) previous topic - next topic


I recently purchased a few Arduino Zero boards for the first time because I wanted a Digital to Analog Converter (DAC; i.e. and Analog Output) and the Arduino Due isn't in stock. Based on [1], my understanding is that the output range on the DAC should be 0-3.3V (i.e. rail-to-rail). Unfortunately, when I try to run a simple sketch to output an analog sine wave, the Zero appears to cut-off the voltage at 2.3V.

To be more specific, I am driving a red LED in series with a 10kOhm resistor from the A0 output on the Zero board. The board is powered through the programming USB (I also tried powering the board via Vin with a 5V power supply with no change in behavior). In the sketch, I configure A0 as an output, set the resolution to 10-bits, and then use "analogWrite" to update the value on A0 as a 10-bit integer (see the attached sketch). I've looked at a few examples for the DAC on the Zero and don't see any other functions being used to configure or control the DAC. I have tried multiple Zero boards as well as I have simply connected the A0 pin directly to an oscilloscope (i.e. no LED) to make sure I am not overloading the DAC. In all cases, the output on the oscilloscope is the bottom half of a nice clean sine wave that is cutoff at 2.3V.

I'm hoping I've made a simple rookie mistake and and that there is a simple fix.

1. https://forum.arduino.cc/index.php?topic=353363.0


Hi jessewp,

remove this line from your code

Code: [Select]
  pinMode(A0, OUTPUT);        //Set A0 as a DAC 

otherwise pin A0 will be set as a digital output and this interferes with the dac output



Thank you Sulimarco, removing the "pinMode(A0, OUTPUT)" line fixed the problem.

Go Up