RobTillaart / AD5620

Arduino library for AD5620 / AD5640 Digital Analog Convertor (12/14 bit).
MIT License
2 stars 0 forks source link

Arduino CI Arduino-lint JSON check GitHub issues

License: MIT GitHub release PlatformIO Registry

AD5620

Arduino library for the AD5620 / AD5640 Digital Analog Convertor (12/14 bit).

Description

Experimental

The AD5620 is a 12 bit DAC, which is to be controlled by SPI. This library supports both hardware as software SPI.

The value of the DAC can be changed by setValue() or by setPercentage(). If the values are out of range these function will return false. The value set is kept by the library and can be fetched by getValue() and getPercentage().

The library also implements support for the AD5640, a 14 bit DAC.

Warning The library is not tested with hardware so use with care.

Feedback, issues, improvements are welcome. Please file an issue on GitHub.

Compatibles

Overview devices, nr of bits, setValue range and indicative LSB

device bits range LSB @ 5V notes
AD5620 12 0..4095 1.221 mV
AD5640 14 0..16383 0.3053 mV
AD5660 16 0..262143 19.07 uV almost compatible, not supported.

Related

Interface

#include "AD5620.h"

Base class

The AD5640 has identical constructors.

Set DAC

Power down

See datasheet P19 for details.

mode description
0 normal mode (default)
1 1 KOhm to GND
2 100 KOhm to GND
3 Threestate

SPI

Adjust the performance of the SPI port.

Datasheet maximum frequency. Overclocking is not tested.

Voltage Max Speed
2.7 V 20 MHz
3.5 V 20 MHz
3.6 V 30 MHz
5.5 V 30 MHz

Performance

Measurements with AD5620_demo.ino - performance of setValue() is the most important. The numbers are rounded and indicative, other boards might produce different numbers.

version board clock SPI calls / sec Notes
0.1.0 UNO 16 MHz HW 70900 max SPI speed
0.1.0 UNO 16 MHz SW 5289
0.1.0 ESP32 240 MHz HW 1
0.1.0 ESP32 240 MHz SW
  1. ESP32 HW is equal performant for HSPI and VSPI. Unknown why HW SPI is 20% slower than SW SPI (transaction overhead?)

70000 calls per second means that a 1 KHz wave can be constructed with 70 values per period (max).

Please share your performance data, open an issue to report.

Future

Must

Should

Could

Wont

Support

If you appreciate my libraries, you can support the development and maintenance. Improve the quality of the libraries by providing issues and Pull Requests, or donate through PayPal or GitHub sponsors.

Thank you,