Difference between revisions of "High-Precision AD/DA Board"

From Waveshare Wiki
Jump to: navigation, search
Line 329: Line 329:
 
Breathing light effect in LEDA and LEDB<br />
 
Breathing light effect in LEDA and LEDB<br />
  
==AD/DA synthetical demo==
+
==AD/DA demo==
 
<pre>
 
<pre>
 
cd AD-DA/
 
cd AD-DA/

Revision as of 08:48, 15 April 2022

High-Precision AD/DA Board
High-Precision-AD-DA-Board l.jpg

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

{{{name3}}}

{{{name4}}}

{{{name5}}}

Introduction

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

Features

  • Onboard ADS1256, 8ch 24bit high-precision ADC (4ch differential input), 30ksps sampling rate
  • Onboard DAC8552, 2ch 16bit high-precision DAC
  • The pinout is compatible with Waveshare sensor interface standard, easy to connect various analog sensor modules
  • On-board terminal block encapsulates the input and output interface, which can be connected to analog signals and digital signals, which is convenient for use in various occasions
  • Features AD/DA detect circuit, easy for signal demonstration
  • Provides 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 DAC8532chip 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 Raspberry Pi terminal and enter the following command enters the configuration interface
sudo raspi-config
Choose Interfacing Options -> SPI -> Yes open SPIinterface

RPI open spi.png

Then reboot Raspberry Pi

sudo reboot

Please make sure that SPI is not occupied by other devices, you can check it by /boot/config.txt

Install Libraries

  • BCM2835
#Open Raspberry Pi terminal and run the following demands
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.68.tar.gz
tar zxvf bcm2835-1.68.tar.gz 
cd bcm2835-1.68/
sudo ./configure && sudo make && sudo make check && sudo make install
#For more information, please refer to the official website:http://www.airspayce.com/mikem/bcm2835/
  • Wiring Pi
#open Raspberry Pi terminal,run the following demand
sudo apt-get install wiringpi
#For Raspberry Pi systems after May 2019 (For earlier version, it is not necessary to execute), 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 does not appear, the installation is wrong.
#Bullseye branch system run the following demands
git clone https://github.com/WiringPi/WiringPi
cd WiringPi
./build
gpio -v
# Run gpio -v and version 2.60 will appear. If it does not appear, the installation is wrong.
  • 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 http://www.waveshare.net/w/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 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 http://www.waveshare.net/w/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 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, he is floating, 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

Datasheets

Application Notes

FAQ

 Answer:
The sample demo enables 8-channel high-precision ADC by default. In order 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.


 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:

Input Voltage Range (Max) (V): 2.5, 5
Input Voltage Range (Min) (V): -2.5, 0


Support

Support

If you require technical support, please go to the Support page and open a ticket.