Difference: ADCAndDAC (2 vs. 3)

Revision 32020-07-30 - UliRaich

Line: 1 to 1
 
META TOPICPARENT name="Exercises"

Exercise 9: Analogue to Digital (ADC) and Digital to Analogue (DAC) conversion

Introduction

Line: 15 to 15
 This will generate a slow triangular wave form that can be observed on a multi-meter.

Checking linearity

Changed:
<
<
If we connect the DAC output to the input of an ADC channel and we slowly ramp up the DAC value from 0 to its maximum and we read back the signal level with an ADC, then we expect a perfectly linear curve. This is true under the condition that both, the DAC and the ADC are perfectly linear.
>
>
If we connect the DAC output to the input of an ADC channel and we slowly ramp up the DAC value from 0 to its maximum and we read back the signal level with the ADC, then we expect a perfectly linear curve. This is true under the condition that both, the DAC and the ADC are perfectly linear.
 
linearity full range linearity restricted range
linearity.png restrictedLinearity.png
As we can see, the curve becomes very non-linear for values above 200 (3.3V * 200 / 256 ~ 2.6 V). Unfortunately we do not know if the ADC or the DAC is responsible for this non-linearity. We need an external ADC to check. We also see that the line does not pass though 0,0 as it should.
Added:
>
>

Verifying linearity with an external ADS1115

The ADS1115 is a high precision 16 bit Sigma/Delta ADC with an I2C interface. It can easily be connected to the WeMos D1 bus as follows:

ADS 1115 WeMos D1 bus and ESP32 WeMos D1 bus and ESP8266
Vdd 3.3V 3.3V
Gnd Gnd Gnd
SCL D1: GPIO 22 D1: GPIO 5
SDA D2: GPIO 21 D2: GPIO 4
A0 DAC 2: GPIO 26  
A driver MicroPython driver for the ADS1115 is available making it very easy to use: https://github.com/robert-hh/ads1x15

I modified the above program checking linearity, replacing ADC readout by access to the ADS1115 instead of the ESP32 internal ADC. This is the result:

linADS1115.png

This clearly shows that the ESP32 ADC is the culprit!

  -- Uli Raich - 2020-07-26
Line: 28 to 44
 
META FILEATTACHMENT attachment="linearity.png" attr="" comment="" date="1596111249" name="linearity.png" path="linearity.png" size="32384" user="UliRaich" version="1"
META FILEATTACHMENT attachment="restrictedLinearity.png" attr="" comment="" date="1596111254" name="restrictedLinearity.png" path="restrictedLinearity.png" size="29920" user="UliRaich" version="1"
Added:
>
>
META FILEATTACHMENT attachment="linADS1115.png" attr="" comment="" date="1596115847" name="linADS1115.png" path="linADS1115.png" size="30931" user="UliRaich" version="1"
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback