High-Precision AD/DA Board

From Waveshare Wiki
Jump to: navigation, search
High-Precision AD/DA Board
High-Precision-AD-DA-Board l.jpg

Raspberry Pi AD/DA Expansion
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

{{{name6}}}

Introduction

Raspberry Pi AD/DA Expansion Board is designed for Raspberry Pi and Jetson nano.

Features

  • Onboard ADS1256, 8-ch 24bit high-precision ADC (4ch differential input), 30ksps sampling rate.
  • Onboard DAC8552, 2-ch 16bit high-precision DAC.
  • The pinout is compatible with the Waveshare sensor interface standard, easy to connect various analog sensor modules.
  • Onboard terminal block encapsulates the input and output interface, which can be connected to analog signals and digital signals, which is convenient for use on various occasions.
  • Features AD/DA detect circuit, easy for signal demonstration.
  • Provides online sample demo of Raspberry Pi and Jetson Nano.

Pinouts

Pin Function BCM WiringPi Description
DRDY P17 P0 ADS1256 data output,active-low
RESET P18 P1 ADS1256 reset input
PDWN P27 P2 ADS1256 Sync/Shutdown power input, active-low
CS0 P22 P3 ADS1256 chip select, active-low
C1 P23 P4 DAC8532 chip select, active-low
DIN P10 P12 SPI data input
DOUT P9 P13 SPI data output
SCK P11 P14 SPI clock signal

Raspberry Pi

Provides C code and Python demo.

Open SPI Interface

  • Open the Raspberry Pi terminal, and enter the configuration interface with the following commands:
sudo raspi-config
Choose Interfacing Options -> SPI -> Yes to enable the SPI interface

RPI open spi.png

Then reboot Raspberry Pi.

sudo reboot
  • Check /boot/config.txt, and you can see 'dtparam=spi=on' was written in.

Raspberry Pi Guides for 4.37 e-Paper.jpg
To make sure SPI is not occupied, it is recommended to close other drivers' coverage. You can use ls /dev/spi to check whether SPI is occupied. If the terminal outputs /dev/spidev0.1 and /dev/spidev0.1, SPI is not occupied.
Raspberry Pi Guides for 4.37 e-Paper02.jpg


Install Library

If you use bookworm system, only the lgpio library is available, bcm2835 and wiringPi libarary cannot be installed or used. Please note that the python library does not need to install, you can directly run the demo.

BCM2835

#Open the Raspberry Pi terminal and run the following command
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.71.tar.gz
tar zxvf bcm2835-1.71.tar.gz 
cd bcm2835-1.71/
sudo ./configure && sudo make && sudo make check && sudo make install
# For more, you can refer to the official website at: http://www.airspayce.com/mikem/bcm2835/

WiringPi

#Open the Raspberry Pi terminal and run the following command
cd
sudo apt-get install wiringpi
#For Raspberry Pi systems after May 2019 (earlier than that can be executed without), an upgrade may be required:
wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb
gpio -v
# Run gpio -v and version 2.52 will appear, if it doesn't it means there was an installation error

# Bullseye branch system using the following command:
git clone https://github.com/WiringPi/WiringPi
cd WiringPi
. /build
gpio -v
# Run gpio -v and version 2.70 will appear, if it doesn't it means there was an installation error

lgpio

wget https://github.com/joan2937/lg/archive/master.zip
unzip master.zip
cd lg-master
sudo make install 
#for more details, you can refer to https://github.com/gpiozero/lg
  • python
sudo apt-get update
sudo apt-get install ttf-wqy-zenhei
sudo apt-get install python-pip 
sudo pip install RPi.GPIO
sudo pip install spidev

Download Demo

Run in raspberry pi terminal:

sudo apt-get install p7zip-full
wget https://files.waveshare.com/upload/5/5e/High-Precision-AD-DA-Board-Code.7z
7z x High-Precision-AD-DA-Board-Code.7z -r -o./High-Precision-AD-DA-Board-Code
cd High-Precision-AD-DA-Board-Code/RaspberryPI/

AD Demo

cd ADS1256

Provides four demos: bcm2835, python2, python3, wiringpi.

  • Hardware Settings

Set the Power Supply to 5V: connect 5V to VCC.
Set the Reference Input Voltage to 5V: connect 5V to VREF.
Set the Potentiometer output as an Analog Input: connect the pin ADJ and AD0. Make sure the left side Sensor Interface AD0 is disconnected.
Set the LDR output as an Analog Input: connect the pin LDR and AD1. Make sure the left-side Sensor Interface AD1 is disconnected. Connect AINCOM to AGND. When using AD for differential measurements, the common input AINCOM does not need to be tied to the ground.
High-Precision-AD-DA ADset.png

1. bcm2835

cd bcm2835/
make
sudo ./ads1256_test 

Notice: If you have run BCM2835 libraries, you need to reboot Raspberry Pi so as to run other libraries successfully.

2. wiringpi

cd wiringpi/
make
sudo ./ads1256_test

3. python2

cd python2/
sudo python  main.py

4. python3

cd python3/
sudo python3  main.py
  • Experiment Phenomenon:

Turn the potentiometer, the AD0 channel voltage will change accordingly.
Block the photoresistor, and the AD1 channel voltage changes accordingly.
Since other channels are not connected to the load, the related pins float around 1.17V.

DA Demo

cd DAC8532/

Provides four demos: bcm2835, python2, python3, wiringpi.

  • Hardware setting

Set the Power Supply to 5V: connect 5V to VCC.
Set the Reference Input Voltage to 5V: connect 5V to VREF.
Connect DA0 to LEDA and DA1 to LEDB. Then the brightness of the indicator LEDA will change according to the DA0 output voltage. The brightness of the indicator LEDB will vary according to the DA1 output voltage.

1. bcm2835

cd bcm2835/
make
sudo ./dac8532_test

Notice: If you have run BCM2835 libraries, you need to reboot Raspberry Pi so as to run other libraries successfully.

2. wiringpi

cd wiringpi/
make
sudo ./dac8532_test

3. python2

cd python2/
sudo python  main.py

4. python3

cd python3/
sudo python3  main.py
  • Experiment Phenomenon:

Breathing light effect in LEDA and LEDB.

AD/DA synthetical demo

cd AD-DA/

Provide demo: bcm2835, python.

1. bcm2835

cd bcm2835/
make
sudo ./main

Notice: If you have run BCM2835 libraries, you need to reboot Raspberry Pi so as to run other libraries successfully.

2. python

cd python/
sudo python  main.py
  • Experiment Phenomenon

After rotating the potentiometer, the two LEDs will light up alternately.

Jetson nano Developer Kit

Jetson nano program uses analog SPI, so SPI rate or sample rate is relatively slower.

Software setting

Install Function Libraries:

  • Open the terminal interface and enter the following commands to install function libraries.
cd python/
sudo apt-get update
sudo apt-get install python3-pip
sudo pip3 install Jetson.GPIO
sudo groupadd -f -r gpio
sudo usermod -a -G gpio your_user_name
sudo cp /opt/nvidia/jetson-gpio/etc/99-gpio.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules && sudo udevadm trigger
  • Install I2C:
sudo apt-get install python-smbus
  • Install image processing libraries
sudo apt-get install python3-pil
sudo apt-get install python3-numpy

Download Testing Demo

Open linuxterminal and execute:

sudo apt-get install p7zip-full
wget https://files.waveshare.com/upload/5/5e/High-Precision-AD-DA-Board-Code.7z
7z x High-Precision-AD-DA-Board-Code.7z -r -o./High-Precision-AD-DA-Board-Code
cd High-Precision-AD-DA-Board-Code/Jetsonnano/

AD Demo

cd ADS1256

Provides three demos: c, python2, python3.

  • Hardware Setting

Set the Power Supply to 5V: connect 5V to VCC.
Set the Reference Input Voltage to 5V: connect 5V to VREF.
Set the Potentiometer output as an Analog Input: connect the pin ADJ and AD0. Make sure the left side Sensor Interface AD0 is disconnected.
Set the LDR output as an Analog Input: connect the pin LDR and AD1. Make sure the left-side Sensor Interface AD1 is disconnected. Connect AINCOM to AGND. When using AD for differential measurements, the common input AINCOM does not need to be tied to the ground.

High-Precision-AD-DA ADset.png
1. C

cd C/
make
sudo ./main

2. python2

cd python2/
sudo python  main.py

3. python3

cd python3/
sudo python3  main.py
  • Experiment Phenomenon:

Turn the potentiometer, the AD0 channel voltage will change accordingly.
Block the photoresistor, and the AD1 channel voltage changes accordingly.
Since other channels are not connected to the load, it is not connected, so it floats around 1.17V.

DA Demo

cd DAC8532/

Provides three demos: c, python2, python3.

  • Hardware Setting:

The operating voltage is set to 5V: connect 5V to VCC.
The reference voltage is set to 5V: connect 5V to VREF.
Connect DA0 to LEDA and DA1 to LEDB. Then the brightness of the indicator LEDA will change according to the DA0 output voltage. The brightness of the indicator LEDB will vary according to the DA1 output voltage.

1. C

cd C/
make
sudo ./main

2. python2

cd python2/
sudo python  main.py

3. python3

cd python3/
sudo python3  main.py
  • Experiment Phenomenon:

Breathing light effect in LEDA and LEDB.

AD/DA demo

cd AD-DA/

Provides three demos:c, python2, python3.

1. C

cd C/
make
sudo ./main

2. python2

cd python2/
sudo python  main.py

3. python3

cd python3/
sudo python3  main.py
  • Experiment Phenomenon:

After rotating the potentiometer, the two LEDs will light up alternately.

Resource

Documentation

Datasheets

Application Notes

FAQ

 Answer:

The sample demo enables 8-channel high-precision ADC by default. To ensure stability and accuracy, the program adds a delay when reading and processing data. If a higher rate is required, the delay can be commented out.
High-Precision-AD-DA-Board-1CH


 Answer:
After running the BCM2835 library, you need to restart the Raspberry Pi to run the rest of the libraries normally. Restart the Raspberry Pi and run it again.


 Answer:
  • The unconnected idle channel shows 5.08V; it is a normal phenomenon due to the internal structure of the chip.
  • The default floating voltage is 5.08V, which does not affect the use. If you do not need other channels, you can close this channel or connect it to GND


 Answer:

You can connect the 3.3V pin of the Raspberry Pi to the ADX (AD7 here), and after running the ADC program, it can display a voltage close to 3.3V, which indicates that the function is normal, and the wiring is as shown in the figure:
High-Precision AD-DA Board FAQ.png

{{{5}}}


 Answer:
  • Compatible with STM32.
  • For more models about STM32, you can refer to the following STM32F10X demo to compile and port: sample demo.


 Answer:

Yes, it supports Raspberry Pi 4B.

{{{5}}}


 Answer:
sudo modprobe spidev

{{{5}}}


 Answer:

You can refer to this description of the datasheet.
HD rdata faq.png

{{{5}}}


Support



Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)