How to use the DAC output on Arduino Nano 33 iot

Hello everyone,

I use the Arduino Nano 33 iot in my project. I am measuring a distance from a sensor, and I want to convert that value to an analog signal to drive an external analog device. (0 to 3.3 volts for example).

Is it feasible to do that through the DAC0 pin? If yes, how would I do that, just using the "analogwrite" prompt on that pin, or should I use a more complicated command?

Thanks in advance.

In setup() set the resolution to 10 bit
analogWriteResolution(10); // Change the DAC resolution to 10 bits, i.e. 1024 steps

Then all you need to output a voltage:
analogWrite(A0, value);

The load on the DAC output must be greater than 5K ohms

Thanks a lot Jim-p. I am not sure how to check the load. The output of the DAC will be directed to an external device. This is a very old analog strip chart recorder. I am not sure how to check its impedance.

LK

Apply some voltage to the recorder input (say 1V), and use your multimeter to measure the current draw. The DC input resistance in Ohms, which is what you need to know, is (applied voltage)/(current draw).

Do you have multimeter DMM, ohmeter?

yes I have a DMM, I will try what jremington described above. Thanks both for your info!

If the current is greater than 1mA then the impedance is too low

in that case, does an op-amp in terms of a buffer will solve the problem?

Yes

I run the above code, but for value>800 the DAC output saturates at 2.3 volts

Thanks in advance.

Are you using an opamp buffer?

no, but there is no load while I am measuring. it seems that this is a bug in nano 33 iot because it has been reported in another post also:

have you to propose an op-amp for buffering the DAC output (however the load is very low, it consumes a few decades of μA).

Thanks!

I did not realize that there is a problem with the 33 iot DAC, actually, I do not have one.

No you won't need a buffer.