SD Txt file data to tft with Arduino Due DAC

I want to start by apologizing if I have failed to find an open discussion of this topic and placed my inquiry in the wrong place. The high level of organization in this forum is daunting. Also, I recognize I am not posing this question in the most succinct manner possible. If I were able to do so, I would probably know the answer. Here it is:

I am able to read an analog device such as a pot and graph input on tft scren while saving it to txt file on SD. I would like to play the txt file back to generate the identical graph on the tft screen. My thought was that this could be done through the DAC on Arduino DUE. It occurred to me that perhaps DAC0 could be connected to A0 and that coding would parallel that for a live sensor. Being uncertain as to whether my conception of the wiring or the coding is correct, my multiple attempts have all met with failure. I haven't found any examples of a similar project even though there are examples of other uses of the Due's DAC, such as the simple audio player, that utilize files on SD as the source. Also, I would think that many users would like to review saved data in this manner. I suspect I'm missing something obvious. Would appreciate constructive suggestions.


Some thoughts:

In a perfect world, your idea to play back a file from an SD file should be easy. However, even so it should be possible; there is a hardware and a software side to this project.

The DUE DAC output range is between 1/6 * 3.3V and 5/6 * 3.3V instead of 0V to 3.3V. You will have firstly to add some hardware to fix this issue.

The DUE DACs can't provide much current, hence be sure to connect at least a 1.1 K Ohm in serie to the DAC pins. Without this resistor, you will burn your DACs.

The ADC peripheral needs some calibration to improve accuracy:

Some general rules to improve ADC conversions:

  • Power the DUE with a powerbank since power thru the USB cable from a PC is unstable,
  • Pay attention to wiring,
  • Put a signal conditioning circuit on the analog input pin,
  • Oversample and average ADC conversions,
  • write your code with PDC DMA (example sketches are provide in the DUE sub forum either for DAC or ADC with direct register programming), do not use analogRead(), analogWrite() functions.