This sketch is a basic blueprint demonstrating how to connect the MCP4822 DAC to an ESP32-C3 Super Mini.
The code is not optimized for speed, but for portability. It should work on any Arduino or ESP32 with SPI pins.
For increased speed replace digitalWrite(...)
with direct port manipulation to toggle the chip select low/high.
- Target device: ESP32-C3 Super Mini
- Board to set in Arduino IDE: ESP32 Dev Board
- MCP4822 Datasheet TIP: See application notes and sample schematics at the end of the sheet. Very useful!
Scope measuring VoutA and VoutB that are outputting the inverse of each other (this is what the code does).
There is quite a lot of interference because of breadboard and lack of decoupling capacitors.
See this thread: https://www.reddit.com/r/esp32/comments/16qaf8u/trouble_reading_serial_output_on_my_esp32c3/