Arduino WIFI MKR 1010

Prof. Joerg Vollrath, 10.11.2020


Cost 27.- (2020)

Video Lecture: Laboratory


Länge: 01:06:27
0:0:0 Hello

0:0:34 Task until 23.11.2020

0:1:40 Review Laboratory

0:2:14 Task connect PMODs

0:3:2 3 DAC and 5 ADC for testing

0:5:27 Test with higher resolution

0:7:49 Load example data

0:8:45 Number of bits, offset, gaine error, LSB, INL, DNL

0:9:28 Paste log text in Excel

0:9:50 Text in columns

0:10:33 Header line

0:11:33 Insert graph point x-y

0:11:57 Resolution DAC 8 bits, ADC 10 bits

0:12:52 Minimum, maximum, average (mittelwert)

0:13:40 Offset, Maximum, gain error

0:17:58 Eliminate offset and gain error

0:18:56 Pivot table

0:19:31 Missing codes

0:21:46 115 codes

0:23:56 Second Arduino sketch including PMODs

0:25:1 Select data for FFT tool

0:26:33 Sine, FFT, INL, DNL

0:28:54 Signal to noise ratio

0:29:41 Missing codes

0:30:36 Number of bits 6

0:34:11 Start Code review

0:34:41 Sine lookup table, array OSC1..4

0:36:11 Setup code IOs, and serial

0:36:58 R2R DAC lines

0:37:21 Loop

0:38:57 More samples

0:39:52 Extended program

0:39:59 Ramp implementation

0:40:51 Write DAC, read ADC

0:41:33 Select waveform

Goals:

This project investigates ADC and DAC performance in an Arduino environment.
1 DAC and 4 ADCs internally of Arduino are investigated for sampling rate, resolution, offset error (minimum code and minimum voltage), full scale error (maximum code and maximum voltage), INL, DNL error and signal to noise ratio (SNR, FFT).
Additionally an R2R DAC and a DAC PMOD and ADC PMOD are controlled by the Arduino.
An Electronic Explorer board can provide signals with a function generator (AWG, DAC) and acquire data via oscilloscope channels (ADC).
Challenges can be studied using unsynchronized test signals and sampling.
Measurement of these external data converters are compared to measurements of internal data converters.



Overview: Step by step


  1. Setting up environment:
    Getting started with the MKR WiFi 1010
    Blinking LED
  2. Sine signal DAC, PWL 256 values and ADC Serial output
  3. Performance investigation
  4. Extension with R2R DAC, PMOD ADC and PMOD DAC
  5. Measure and compare data converter performance
  6. Optimize code
  7. Summary


1. Setting up Environment


Pinout MKR WIFI 1010:


Download and Installation - Arduino IDE for Home



Arduino IDE is already installed in the laboratory.

Installation of Win 10 executable.
Zip version is unpacked executable without install? (Device drivers?)

Configuration:
Datei -> Voreinstellung Zusätzliche Boardverwaltung URL's
File ->
URL: http://arduino.esp8266.com/stable/package_esp8266com_index.json

Werkzeuge (Tools) -> Board -> Boardverwaltung ..
Arduino SAMD Boards(32-bits ARM Cortex M0+)
Werkzeuge (Tools) -> Board ->
Arduino MKR WIFI 1010

Connect Board via USB
Set COM port: Werkzeuge -> port -> COM..
Win 10: Gerätemanager -> Anschlüsse

C++ Source code LED blink

Datei -> Beispiele -> 01.Basics -> Blink
Sketch -> Hochladen or "button arrow"
Pfad: Dokumente/Arduino/Work



The LED is blinking and everything works.



2. Sine and Analog inputs to serial port

Program

Copy the following code into a new sketch.
/*
  Target board Arduino MKR WIFI 1010
  This sketch generates a sine signal with 
     DAC: DAC0, AIN[0], PA02, A0, D15
     PWL: AIN[7],PA07,A6,D21
     Digital: PA22,23,10,11,PB10,11,PA20, PA21
  This sketch samples:
    OSC1: AIN[10], PB02, A1, D16 
    OSC2: AIN[11], PB03, A2, D17
    OSC3: AIN[4], PA04, A3, D18 
    OSC4: AIN[5], PA05, A4, D19  
  Transfers 1024 values to serial port.
    
  Setup:  
  Array of sine values is generated.

  Loop:
  4 times
    1024 times
      Set sine DAC, PWL, Digital
      Read OSC1..4 to array
  Transfer last 1024 values to serial port.
  
  This example code is in the public domain.

  Written 9 Sep 2020 by Joerg Vollrath
*/

#define DAC          A0

#define DAC_D0          0
#define DAC_D1          1
#define DAC_D2          2
#define DAC_D3          3
#define DAC_D4          4
#define DAC_D5          5
#define DAC_D6          6
#define DAC_D7          13

#define DAC_PWM          8

#define ADC_OSC1          A1
#define ADC_OSC2          A2
#define ADC_OSC3          A3
#define ADC_OSC4          A4

// Sine wave lookup table 0..255 Sinbe.xlsx
uint16_t sineWave[] = { 
    128,131,134,137,140,143,146,149,152,155,158,162,165,167,170,173,
    176,179,182,185,188,190,193,196,198,201,203,206,208,211,213,215,
    218,220,222,224,226,228,230,232,234,235,237,238,240,241,243,244,
    245,246,248,249,250,250,251,252,253,253,254,254,254,255,255,255,
    255,255,255,255,254,254,254,253,253,252,251,250,250,249,248,246,
    245,244,243,241,240,238,237,235,234,232,230,228,226,224,222,220,
    218,215,213,211,208,206,203,201,198,196,193,190,188,185,182,179,
    176,173,170,167,165,162,158,155,152,149,146,143,140,137,134,131,  
    128,124,121,118,115,112,109,106,103,100,97,93,90,88,85,82,
    79,76,73,70,67,65,62,59,57,54,52,49,47,44,42,40,
    37,35,33,31,29,27,25,23,21,20,18,17,15,14,12,11,
    10,9,7,6,5,5,4,3,2,2,1,1,1,0,0,0,
    0,0,0,0,1,1,1,2,2,3,4,5,5,6,7,9,
    10,11,12,14,15,17,18,20,21,23,25,27,29,31,33,35,
    37,40,42,44,47,49,52,54,57,59,62,65,67,70,73,76,
    79,82,85,88,90,93,97,100,103,106,109,112,115,118,121,124
};
// Buffer for ADC values of 4 channels
    uint16_t osc1[] = {
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    };
    uint16_t osc2[] ={
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
      };
    uint16_t osc3[] = {
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
      };
    uint16_t osc4[] = {
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    };
    uint16_t bitsX[] = {1,2,4,8,16,32,64,128};
    

void setup() {
  // put your setup code here, to run once:
  pinMode(DAC_D0, OUTPUT);
  pinMode(DAC_D1, OUTPUT);
  pinMode(DAC_D2, OUTPUT);
  pinMode(DAC_D3, OUTPUT);
  pinMode(DAC_D4, OUTPUT);
  pinMode(DAC_D5, OUTPUT);
  pinMode(DAC_D6, OUTPUT);
  pinMode(DAC_D7, OUTPUT);
 
 // initialize serial communication at 115200
 Serial.begin(115200);
 Serial.println("\r\nData Converter Sine Test");

}

// Setting 8 digital outputs for R2R DAC
void digWrite(uint16_t sineValue){
// It takes some time (20us?) to set all pins
// Settling tim emeasurements will be skewed
  if ((sineValue & bitsX[0]) == bitsX[0] ) {
    digitalWrite(DAC_D0, HIGH);
  } else {
    digitalWrite(DAC_D0, LOW);    
  }
  if ((sineValue & bitsX[1]) == bitsX[1] ) {
    digitalWrite(DAC_D1, HIGH);
  } else {
    digitalWrite(DAC_D1, LOW);    
  }
  if ((sineValue & bitsX[2]) == bitsX[2] ) {
    digitalWrite(DAC_D2, HIGH);
  } else {
    digitalWrite(DAC_D2, LOW);    
  }
  if ((sineValue & bitsX[3]) == bitsX[3] ) {
    digitalWrite(DAC_D3, HIGH);
  } else {
    digitalWrite(DAC_D3, LOW);    
  }
  if ((sineValue & bitsX[4]) == bitsX[4] ) {
    digitalWrite(DAC_D4, HIGH);
  } else {
    digitalWrite(DAC_D4, LOW);    
  }
  if ((sineValue & bitsX[5]) == bitsX[5] ) {
    digitalWrite(DAC_D5, HIGH);
  } else {
    digitalWrite(DAC_D5, LOW);    
  }
  if ((sineValue & bitsX[6]) == bitsX[6] ) {
    digitalWrite(DAC_D6, HIGH);
  } else {
    digitalWrite(DAC_D6, LOW);    
  }
  if ((sineValue & bitsX[7]) == bitsX[7] ) {
    digitalWrite(DAC_D7, HIGH);
  } else {
    digitalWrite(DAC_D7, LOW);    
  }
  
}

void loop() {
  // put your main code here, to run repeatedly:

    // 4 periods
    for (int i2 = 0; i2 < 4; i2++) {
	  // 256 samples written and read
      for (int i1 = 0; i1 < 256; i1++) {
        // writing Analog
        analogWrite(DAC, sineWave[i1]);
        // writing PWM
        analogWrite(DAC_PWM, sineWave[i1]);
        // writing digital
        digWrite(sineWave[i1]);       
        // reading analog
        osc1[i1] = analogRead(ADC_OSC1);
        osc2[i1] = analogRead(ADC_OSC2);
        osc3[i1] = analogRead(ADC_OSC3);
        osc4[i1] = analogRead(ADC_OSC4);
      }
    }

    // transfer data to PC via serial interface
    Serial.println("New block: ");
    for (int i3 = 0; i3 < 256; i3++) {
      Serial.print(i3);
      Serial.print(" , Sine = ");
      Serial.print(sineWave[i3]);
      Serial.print(" , ADC(OSC1) = ");
      Serial.print(osc1[i3]);
      Serial.print(" , ADC(OSC2) = ");
      Serial.print(osc2[i3]);
      Serial.print(" , ADC(OSC3) = ");
      Serial.print(osc3[i3]);
      Serial.print(" , ADC(OSC4) = ");
      Serial.println(osc4[i3]);
    }
     
    delay(10);

}

Wire connections for test


The Electronic Explorer is used for measurements.
The basic operation of the Electronic Explorer is shown here.
Connect PWM output to oscilloscope channel 2.
Connect ADC 1,2,3,4 to DAC output.
Connect DAC output to oscilloscope 1.
Connect one digital pin to oscilloscope 3.


Sampling data from the ADC with DAC sine/ramp input allows data converter investigations for INL, DNL and SNR.
The measuring device should have a higher resolution than the device under test (DUT).
A high resolution DAC can generate a test signal for a ADC investigation.
A high resolution ADC can sample the output of the DAC investigation.

Connect the USB cable of the MKR WIFI 1010.
Start the Arduino IDE from: L:\apps\Arduino\Arduino.exe
Start COM tool IDE from: L:\apps\Arduino\Com Port
Select correct board: Werkzeuge (Tools) -> Board -> Board management
ARDUINO SAMD(32-bit Arm Cortex - M0+) Boards, Install
Arduino MKR WIFI 1010
Select correct COM port: Werkzeuge (Tools) -> Port
Compile and upload sketch: Sketch -> Hochladen (Upload)
Open serial monitor: Werkzeuge (Tools) -> Serieller Monitor (Serial monitor)
You should see generated values and readout of ADCs.

Data logging

Option 1:
Use serial monitor
Disable Autoscroll
Select data with mouse
Copy data with <STRG><C> or <CTRL><C>
Paste data with <STRG><V> or <CTRL><V>
Use serial plotter for graphical ouptut to check waveform

Option 2:
Close serial monitor.
For data logging open Hyperterminal: L.\apps\Hyperterminal\hypertrm.exe
Select COM port.
Put in baud rate 115200.
Start logging data: Übertragung -> Text aufzeichnen
Select a path and file name (Durchsuchen) and start logging (Starten).
After gathering needed data do stop logging (Beenden)


You can analyze the logged data at home with Excel or the FFT tool.

Connect the DAC outputs to the Electronic Explorer SCOPE 1 DC and SCOPE 2 DC channels.
Start Waveforms on the Desktop to be able to look at the waveforms using and oscilloscope.
Start SCOPE from the control center.
Enable channel 1 and 2.
Select under time Range 200 ms.
Move the curves to the center of the window.
Adjust amplitude and Offset for channel 1 and 2.
You can export data for further analysis.

Challenges


It was difficult to determine the names of the pins.
Bit conversion to digital pins is sensitive to type.
Disconnect Arduino IDE serial monitor.
Start Hyperterm with 115200 to log data.
Sine lookup and logged data (SineFirst.TXT) Sine.xlsx
Data log file



3. Analysis and FFT

The minimum value of the ADC(OSC1) is 5.
The maximum value of the ADC(OSC1) is 1021.

Compare minimum and maximum of the four ADC channels.
Calculate LSB?

The oscilloscope shows the following waveforms.



The short break after 4 periods for sending serial data can be seen.
C1 (orange) shows the analog sine output.
C2 (blue) shows the pulse width modulated output.
C3 (red) shows D5 digital output of bit 5.
Minimum of sine signal is 30mV, maximum 3.31 V with a frequency of 1.13 Hz and period of 880 ms.
In this configuration sampling is done with 289.28 Hz and 3.48 ms.

A FFT can be done: FFT Tool .



Due to changing slope of sine signal there are 140 missing codes.
Signal level for frequency 1 (one period) 36.09dB and total noise -13.26 dB.
Highest harmonic for frequency 47 at -22.81 dB.
SNR = (36.09 - (-13.26)) dB = 49.35 dB
ENOB = (SNR - 1.76 dB) / 6.02 dB = 8 Bit

Now scaling to 10 bits in FFT tool is done. This can be seen at the range of the displayed sine signal.



899 Missing codes.
Signal level for frequency 1 (one period) 48.11dB and total noise 3.1 dB.
Highest harmonic for frequency 2 at -8.44 dB.
SNR = (48.11 - 3.1) dB = 45.01 dB
ENOB = (SNR - 1.76 dB) / 6.02 dB = 7.5 Bit



4. Extension with R2R DAC, ADC and DAC PMODs

Part list

PartNumberCost (Euro)
Arduino MKR WIFI 1010130.-
Digilent PMOD AD2120.-
Digilent PMOD DA2120.-
Potentiometer 10k lin1
Resistor 20k 8
Resistor 10k 7
R ?value? RC low pass 1
C ?value? RC low pass 1
Drähte Jumper wire 32
Micro USB cable 32

Pin Assignments



R2R DAC


Build the R2R DAC on the board. Connect the output to OSC4, A4.
Pin ArduinoNameNameR2R
D0 D0 D0 D0
D1 D1 D1 D1
D2 D2 D2 D2
D3 D3 D3 D3
D4 D4 D4 D4
D5 D5 D5 D5
D6 D6 D6 D6
D13 D13 D7 D7
A4 OSC4 Output R2R Output R2R

First test


Connect DAC, OSC1, OSC2 and OSC3 pin on Arduino.
The sine signal on DAC is sampled with OSC1, OSC2 and OSC3.

Connect the USB cable of the MKR WIFI 1010.
Start the Arduino IDE from: L:\apps\Arduino\Arduino.exe
Start COM tool IDE from: L:\apps\Arduino\Com Port
Select correct board: Werkzeuge (Tools) -> Board
Select correct COM port: Werkzeuge (Tools) -> Port
Compile and upload sketch: Sketch -> Upload
Open serial monitor: Werkzeuge (Tools) -> Serial monitor
You should see generated values and readout of ADCs.

Option 1:
Use serial monitor
Disable Autoscroll
Select data with mouse
Copy data with <STRG><C> or <CTRL><C>
Paste data with <STRG><V> or <CTRL><V>
Use serial plotter for graphical ouptut to check waveform

Option 2:
Close serial monitor.
For data logging open Hyperterminal: L.\apps\Hyperterminal\hypertrm.exe
Select COM port.
Put in baud rate 115200.
Start logging data: Übertragung -> Text aufzeichnen
Select a path and file name (Durchsuchen) and start logging (Starten).
After gathering needed data do stop logging (Beenden)

You can analyze the logged data at home with Excel or the FFT tool.

Frequency selection with Poti


Pin ArduinoNameNamePin Poti
A5 SCK MID center
GND GND GND left
+3V3 VCC VDD right

PMOD DA2 ( 2 Channel, 12-Bit, 125kHz, 8 µs)



Pin ArduinoNameNamePin PMOD DA2
D9 SCK CLK 4
D8 MOSI D1 2
D21 D21 CS 1
GND GND GND 5
+3V3 VCC VDD 6

Only Output Vout1 is used for signal generation.

Digilent: PMOD DA2 20.-
Texas Instruments DAC121S101 8us settling 12-Bit 16.5 MS/s $1.-

30 MHz SCLK

PMOD AD2



Pin ArduinoNameNamePin PMOD AD2
D12 SCL SCL 1
D11 SDA SDA 2
GND GND GND 3
+3V3 VCC VDD 4

Only Input V1 is used for data acquisition.

Digilent: PMOD AD2 20.-
Analog devices AD7991 4 channel, I2C, 1us conversion time, 12-bit



Arduino sketch:


DataConverterSine.ino

This outputs waveform from PMOD DA2 at Vout1 and reads V1 from the PMOD AD2.
Connect Output PMOD DA2 to oscilloscope channel 4.
Variable freq sets waveform.
The lookup tables contain 256 values each.
256 samples are measured and transfered to the PC.
(The potentiometer changes the frequency.)

Option 1: Arduino DAC is tested with Arduino ADC (OSC1..4)
Option 2: Arduino DAC is tested with Arduino ADC (OSC1..3)
R2R DAC is tested with Arduino ADC (OSC4)
Option 3: DAC PMOD DA2 is tested with ADC PMOD AD2
Option 4: Arduino DAC is tested with ADC PMOD AD2
R2R DAC is tested with Arduino ADC (OSC1..4)
Option 5: R2R DAC is tested with ADC PMOD AD2


This configuration makes it possible to connect any DAC to any ADC to study system behaviour, INL, DNL and SNR.
A given sine signal code is fed to DAC and sampled with ADC giving an integer output code at the serial interface for further analysis.

What is the maximum sampling frequency?
How does the signal and FFT look at higher frequencies?
Is there any jitter present?

23.11.2020 Tasks


(1) Task: PMOD ADC log data min, max, FFT, 1 Period, more periods,
Compare channel 1, 2, 3, 4, FFT SNR
(2) Task: Ramp test 0..255
Calculate INL, DNL
(3) make proposal how to modify the program for higher resolution

3.12.2020 Improvements


There is a new sketch available: DataConverterCharV2.ino
There is no ADC data buffer used in the program any more, since the memory size of variables is limited to 32kByte.
ADC readings are directly transfered via serial interface. This gives a sampling rate of 233 Samples/s.
Column sequence of output is different: index, ramp/sine value, ADC(AD2), ADC(Osc1), ADC(Osc2), ADC(Osc3), ADC(Osc4)
16k data blocks are generated for ramp or sine analysis usable for 12 bit data converters.
Data can be copied from serial monitor disabling Autoscroll.
Selecting all data with <Strg><a>.
Copying selected data with <Strg><c>.
Inserting data into Excel via Start, Insert, Textconversion, delimited, Delimiter: comma, "=".
Data can be then selected and copied for FFT to Javascript FFT tool .
For ramp data another column in Excel is generated using verketten, concatenate (concatenate(A2,";",C2))to generate lines like: 23;56
.
Time (s);C2 (V)
0;0
1;0
2;0
..
DAC ramp data can then be copied and analyzed with Javascript read oscilloscope data tool .

What is the SNR for the digital sine data?
What is the SNR for Arduino DAC measured with PMOD AD2 and Arduino ADC?
What is the SNR for R2R DAC measured with PMOD AD2 and Arduino ADC?
What is the difference in SNR using windowing?
What is the INL, DNL for a ramp test of R2R, Arduino DAC, PMOD DAC measured with PMOD ADC and Arduino ADC?
3 measurement setups with 2 output data each.
Do a histogram test of Arduino ADC with PMOD DA2 as signal generator.

DAC Characterization


Use ADCs (serial port) and Electronic Explorer oscilloscope input (Export data) for acquiring signals

ADC Characterization


Generate ramp with Electronic Explorer AWG1 or PMOD DAC
Use ADCs (serial port) and Electronic Explorer oscilloscope input (Export data) for acquiring signals

Task: Interface Electronics 2020


Update 14.12.2020

DAC characterization

Use 12-bit PMOD ADC for measurement acquisition.

ADC characterization

Use 12-bit PMOD DAC for signal generation.
Document your results as web report.
Deadline for the report is 22. January 2020.

Task: Interface Electronics 2021


Update 20.12.2021

DAC characterization

Use 12-bit PMOD ADC for measurement acquisition.

ADC characterization

Use 12-bit PMOD DAC for signal generation.
Document your results as a IEEE report with 2 to 6 pages.
Deadline for the report is 26. January 2022.

Other Data Converter Boards


MAX11205



16 bit ADC, 0.12 ksps, Sigma-Delta 18.-
Pin1: NC, Pin2: NC, Pin3: MISO, PIN4: SCK, Pin5: GND, Pin6: VCC
2 MHz internal system clock

Arduino code:
Hello

MAX5216



16-Bit DAC, SPI,
Pin1: /SS: Chip enable, Pin2: MOSI, Pin3: NC, Pin4: SCK, Pin5: GND, PIn6: VCC

MAX11259



24-bit 6-channel, 64kSps, delta-sigma ADC
I2C

MAX5715BOB




Breakout Board (BOB) for the MAX5715 12-Bit, 4-Channel SPI VOUT DAC, 14$


MCP4725 Breakout Board - 12-Bit DAC 860 Sa/s w/I2C Interface 5.-
https://www.adafruit.com/product/935

12-Bit-ADC-Board ADS1015, I2C, Adafruit 12.-

Adafruit: https://www.adafruit.com/category/1013

Adafruit PCF8591 Quad 8-bit ADC + 8-bit DAC - STEMMA QT / Qwiic 10kSa/s 6.50
Sparkfun: https://www.sparkfun.com/categories/363 ADC/DAC

Eckstein Components ADC

Optimization of Arduino DAC & ADC Resolution


Since Arduino DAC and ADCs are set to 10 bits by default, but their resolution can be increased by accessing them via IDE sketch. The resolution of Arduino DAC is increased from 10bits to 12 bits by using the code;
analogWriteResolution(bits);
This sketch line is written before the [analogWrite(DAC, sine12);], here sine 12 given as input to let the DAC generate signal that can be tested by 12-bit ADC and then compare with the external 12-bit Pmod DAC. Below is the modified Arduino sketch for optimization of the Arduino DAC.
<!-- Arduino IDE DAC optimization Sketch -->

analogWriteResolution(12);     // Arduino DAC Resolution Change     
     analogWrite(DAC, sine12); //  //Writing Analogue to arduino DAC//

Similarly, the resolution of the ADC is increased from 10 bits to 12 and 16 bits. The results of 12-bit optimized combination are realistic and included in the report. However, it was observed that Arduino MKR WIFI 1010 has maximum accessible resolution of 12 bits, although 65,536 steps (quantization) were achieved but arduino was padding the extra bits with zeros. The following addition was made in the sketch before the serial print argument to increase the ADCs resolution.
<!-- Arduino IDE ADC optimization Sketch -->

analogReadResolution(bits);     // Arduino ADC Resolution Change     

Optimization of Arduino DAC & ADC Speed


DMA allows the faster transfer from data to and from the ADC, DAC to memory. This can speed up waveform generation.

A DAC DMA Exaple was found here.
Sketch ZeroDMA_DAC.ino can be downloaded.
Setting the variable period to 199 gives a sine signal with 32 samples at a sample rate of 240 kHz.

The library Adafruit ZeroDMA gives an example sketch ZeroDMA.ino for reading 256 ADC samples at high speed (2 MHz).

Unfortunately it is difficult to merge the libraries. Change the DAC sampling to ZeroDMA library was not successful.
A general description of SAM DMA can be found here .

IRQ with ADC A4 and DAC A0

The sketch Timer_IRQ.ino realizes a 15.9 kHz sample rate with an ADC input range of 1..1.65V and DAC range from 0..3.3V.
256 8-bit values are calculated for sine lookup.

ToDo

  1. Increase DAC samples to 256, 4096 or more
  2. Increase ADC samples to 4096 or more
  3. Make a fast synchronous DMA for IOs for R2R DAC
  4. Elimante ZeroDMA library for ADC DMA sampling and merge sampling and generation
  5. Making a nice signal generator and oscilloscope interface
  6. Can more than one ADC input be sampled using DMA?
  7. Adapting other boards using DMA?
  8. Use interrupt ISR for ADC reading and DAC writing
YetAnother USB Oscilloscope

Arduino getting stuck and USB device problems


The Arduino can get stuck with infinite loops and IRQ disabled.
Pressing "RST" button twice changes COM address of the Arduino. Then downloading the Sketch 'Basic' 'Minimum' makes the Arduino again operational at the previous COM port.

Timeline of Realization