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

From Waveshare Wiki
Jump to: navigation, search
 
(57 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Infobox item|colorscheme=blue
+
<div class="wiki-pages jet-green-color">
 +
{{Infobox item|
 
|name=[[High-Precision AD/DA Board]]
 
|name=[[High-Precision AD/DA Board]]
|img=[[File:High-Precision-AD-DA-Board_l.jpg|250px|link=http://www.waveshare.com/High-Precision-AD-DA-Board.htm]]
+
|img=[[File:High-Precision-AD-DA-Board_l.jpg|250px|{{Amazon_nolink|default={{#ifeq: {{#urlget:amazon|0}}|{{#urlget:Amazon|0}}| default|}}|url=link=http://www.waveshare.com/High-Precision-AD-DA-Board.htm}}]]
 
|caption=Raspberry Pi AD/DA Expansion
 
|caption=Raspberry Pi AD/DA Expansion
 
|platform=Raspberry Pi
 
|platform=Raspberry Pi
 
|category=[[:Category:Expansions|Expansions]], [[:Category:Raspberry Pi|Raspberry Pi]]
 
|category=[[:Category:Expansions|Expansions]], [[:Category:Raspberry Pi|Raspberry Pi]]
 
|brand=Waveshare
 
|brand=Waveshare
|{{#urlget:amazon|default}}=display
+
|{{#ifeq: {{#urlget:amazon|0}}|{{#urlget:Amazon|0}}| default|}}=display
 
|website_cn=[http://www.waveshare.net/shop/High-Precision-AD-DA-Board.htm 官方中文站点]
 
|website_cn=[http://www.waveshare.net/shop/High-Precision-AD-DA-Board.htm 官方中文站点]
 
|website_en=[http://www.waveshare.com/High-Precision-AD-DA-Board.htm Website]
 
|website_en=[http://www.waveshare.com/High-Precision-AD-DA-Board.htm Website]
Line 13: Line 14:
 
|interface3 = DA
 
|interface3 = DA
 
}}
 
}}
== Introduction ==
+
='''Introduction''' =
Raspberry Pi AD/DA Expansion Board is suited for Raspberry Pi and Jetson nano
+
Raspberry Pi AD/DA Expansion Board is designed for Raspberry Pi and Jetson nano.
 +
 
 
==Features==
 
==Features==
*Onboard ADS1256, 8ch 24bit high-precision ADC (4ch differential input), 30ksps sampling rate
+
*Onboard ADS1256, 8-ch 24bit high-precision ADC (4ch differential input), 30ksps sampling rate.
*Onboard DAC8552, 2ch 16bit high-precision DAC
+
*Onboard DAC8552, 2-ch 16bit high-precision DAC.
*The pinout is compatible with Waveshare sensor interface standard, easy to connect various analog sensor modules
+
*The pinout is compatible with the 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
+
*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
+
*Features AD/DA detect circuit, easy for signal demonstration.
*Provides sample demo of Raspberry Pi and Jetson nano
+
*Provides online sample demo of Raspberry Pi and Jetson Nano.
  
 
==Pinouts==
 
==Pinouts==
 
{|border=1; style="width:700px;" align="center"
 
{|border=1; style="width:700px;" align="center"
|-style="background:#0000ff; color:white;" align="center"
+
|-style="background:green; color:white;" align="center"
 
|Pin Function||BCM||WiringPi||Description
 
|Pin Function||BCM||WiringPi||Description
 
|-align="center"
 
|-align="center"
Line 36: Line 38:
 
|CS0||P22||P3||ADS1256 chip select, active-low
 
|CS0||P22||P3||ADS1256 chip select, active-low
 
|-align="center"
 
|-align="center"
|C1||P23||P4||DAC8532chip select, active-low
+
|C1||P23||P4||DAC8532 chip select, active-low
 
|-align="center"
 
|-align="center"
 
|DIN||P10||P12||SPI data input
 
|DIN||P10||P12||SPI data input
Line 47: Line 49:
 
<div class="tabbertab" title="RPi" id="myrpi">
 
<div class="tabbertab" title="RPi" id="myrpi">
  
=Raspberry Pi=
+
='''Raspberry Pi'''=
Provides C code and python demo
+
Provides C code and Python demo.
  
 
==Open SPI Interface==
 
==Open SPI Interface==
*Open Raspberry Pi terminal and enter the following command enters the configuration interface
+
*Open the Raspberry Pi terminal, and enter the configuration interface with the following commands:
 
<pre>
 
<pre>
 
sudo raspi-config
 
sudo raspi-config
Choose Interfacing Options -> SPI -> Yes open SPIinterface
+
Choose Interfacing Options -> SPI -> Yes to enable the SPI interface
 
</pre>
 
</pre>
 
[[File:RPI_open_spi.png]]
 
[[File:RPI_open_spi.png]]
  
Then reboot Raspberry Pi
+
Then reboot Raspberry Pi.
 
<pre>
 
<pre>
 
sudo reboot
 
sudo reboot
 
</pre>
 
</pre>
Please make sure that SPI is not occupied by other devices, you can check it by /boot/config.txt
+
*Check /boot/config.txt, and you can see 'dtparam=spi=on' was written in.
 +
[[File:Raspberry Pi Guides for 4.37 e-Paper.jpg]]<br />
 +
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.<br />
 +
[[File:Raspberry Pi Guides for 4.37 e-Paper02.jpg]]<br />
  
==Install Libraries==
+
 
*BCM2835
+
{{RPI_C_lib}}
<pre>
 
#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/
 
</pre>
 
*Wiring Pi
 
<pre>
 
#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.
 
</pre>
 
 
*python
 
*python
 
<pre>
 
<pre>
Line 100: Line 81:
  
 
==Download Demo==
 
==Download Demo==
Run in raspberry pi terminal:<br />
+
Run in raspberry pi terminal:<br />
 
<pre>
 
<pre>
 
sudo apt-get install p7zip-full
 
sudo apt-get install p7zip-full
wget http://www.waveshare.net/w/upload/5/5e/High-Precision-AD-DA-Board-Code.7z
+
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
 
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/
 
cd High-Precision-AD-DA-Board-Code/RaspberryPI/
Line 112: Line 93:
 
cd ADS1256
 
cd ADS1256
 
</pre>
 
</pre>
Provides four demos:bcm2835、python2、python3、wiringpi<br />
+
Provides four demos: bcm2835, python2, python3, wiringpi.<br />
 
*Hardware Settings
 
*Hardware Settings
Set the Power Supply to 5V: connect 5V to VCC<br />
+
Set the Power Supply to 5V: connect 5V to VCC.<br />
Set the Reference Input Voltage to 5V: connect 5V to VREF <br />
+
Set the Reference Input Voltage to 5V: connect 5V to VREF. <br />
 
Set the Potentiometer output as an Analog Input: connect the pin ADJ and AD0. Make sure the left side Sensor Interface AD0 is disconnected.<br />
 
Set the Potentiometer output as an Analog Input: connect the pin ADJ and AD0. Make sure the left side Sensor Interface AD0 is disconnected.<br />
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. <br />
+
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. <br />
 
[[File:High-Precision-AD-DA_ADset.png]]
 
[[File:High-Precision-AD-DA_ADset.png]]
  
1.bcm2835
+
1. bcm2835
 
<pre>
 
<pre>
 
cd bcm2835/
 
cd bcm2835/
Line 130: Line 111:
 
</font>
 
</font>
  
2.wiringpi
+
2. wiringpi
 
<pre>
 
<pre>
 
cd wiringpi/
 
cd wiringpi/
Line 137: Line 118:
 
</pre>
 
</pre>
  
3.python2
+
3. python2
 
<pre>
 
<pre>
 
cd python2/
 
cd python2/
Line 143: Line 124:
 
</pre>
 
</pre>
  
4.python3
+
4. python3
 
<pre>
 
<pre>
 
cd python3/
 
cd python3/
Line 149: Line 130:
 
</pre>
 
</pre>
  
*Experiment Phenomenon
+
*Experiment Phenomenon:
 
Turn the potentiometer, the AD0 channel voltage will change accordingly.<br />
 
Turn the potentiometer, the AD0 channel voltage will change accordingly.<br />
 
Block the photoresistor, and the AD1 channel voltage changes accordingly.<br />
 
Block the photoresistor, and the AD1 channel voltage changes accordingly.<br />
Line 158: Line 139:
 
cd DAC8532/
 
cd DAC8532/
 
</pre>
 
</pre>
Provides four demos: bcm2835、python2、python3、wiringpi<br />
+
Provides four demos: bcm2835, python2, python3, wiringpi.<br />
  
 
*Hardware setting
 
*Hardware setting
Set the Power Supply to 5V:connect 5V to VCC<br />
+
Set the Power Supply to 5V: connect 5V to VCC.<br />
Set the Reference Input Voltage to 5V:connect 5V to VREF <br />
+
Set the Reference Input Voltage to 5V: connect 5V to VREF. <br />
 
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.<br />
 
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.<br />
  
1.bcm2835
+
1. bcm2835
 
<pre>
 
<pre>
 
cd bcm2835/
 
cd bcm2835/
Line 175: Line 156:
 
</font>
 
</font>
  
2.wiringpi
+
2. wiringpi
 
<pre>
 
<pre>
 
cd wiringpi/
 
cd wiringpi/
Line 182: Line 163:
 
</pre>
 
</pre>
  
3.python2
+
3. python2
 
<pre>
 
<pre>
 
cd python2/
 
cd python2/
Line 188: Line 169:
 
</pre>
 
</pre>
  
4.python3
+
4. python3
 
<pre>
 
<pre>
 
cd python3/
 
cd python3/
Line 194: Line 175:
 
</pre>
 
</pre>
  
*Experiment Phenomenon
+
*Experiment Phenomenon:
Breathing light effect in LEDA and LEDB<br />
+
Breathing light effect in LEDA and LEDB.<br />
  
 
==AD/DA synthetical demo==
 
==AD/DA synthetical demo==
Line 201: Line 182:
 
cd AD-DA/
 
cd AD-DA/
 
</pre>
 
</pre>
Provide demo:bcm2835、python<br />
+
Provide demo: bcm2835, python.<br />
  
1.bcm2835
+
1. bcm2835
 
<pre>
 
<pre>
 
cd bcm2835/
 
cd bcm2835/
Line 213: Line 194:
 
</font>
 
</font>
  
2.python
+
2. python
 
<pre>
 
<pre>
 
cd python/
 
cd python/
Line 220: Line 201:
  
 
*Experiment Phenomenon
 
*Experiment Phenomenon
After rotating the potentiometer, the two LEDs will light up alternately<br />
+
After rotating the potentiometer, the two LEDs will light up alternately.<br />
</div>
 
 
 
<div class="tabbertab" title="JetsonNano" id="myjetson">
 
  
 
='''Jetson nano Developer Kit'''=
 
='''Jetson nano Developer Kit'''=
 
Jetson nano program uses analog SPI, so SPI rate or sample rate is relatively slower.<br />
 
Jetson nano program uses analog SPI, so SPI rate or sample rate is relatively slower.<br />
 
==Software setting==
 
==Software setting==
Install Function Libraries
+
Install Function Libraries:
*Open terminal interface and enter the following commands to install function libraries
+
*Open the terminal interface and enter the following commands to install function libraries.
 
<pre>
 
<pre>
 
cd python/
 
cd python/
Line 240: Line 218:
 
sudo udevadm control --reload-rules && sudo udevadm trigger
 
sudo udevadm control --reload-rules && sudo udevadm trigger
 
</pre>
 
</pre>
*Install I2C
+
*Install I2C:
 
<pre>
 
<pre>
 
sudo apt-get install python-smbus
 
sudo apt-get install python-smbus
Line 251: Line 229:
  
 
===Download Testing Demo===
 
===Download Testing Demo===
Open linuxterminal and execute:<br />
+
Open linuxterminal and execute:<br />
 
<pre>
 
<pre>
 
sudo apt-get install p7zip-full
 
sudo apt-get install p7zip-full
wget http://www.waveshare.net/w/upload/5/5e/High-Precision-AD-DA-Board-Code.7z
+
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
 
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/
 
cd High-Precision-AD-DA-Board-Code/Jetsonnano/
Line 263: Line 241:
 
cd ADS1256
 
cd ADS1256
 
</pre>
 
</pre>
Provides three demos:c、python2、python3<br />
+
Provides three demos: c, python2, python3.<br />
  
 
*Hardware Setting
 
*Hardware Setting
Set the Power Supply to 5V:connect 5V to VCC<br />
+
Set the Power Supply to 5V: connect 5V to VCC.<br />
Set the Reference Input Voltage to 5V:connect 5V to VREF <br />
+
Set the Reference Input Voltage to 5V: connect 5V to VREF.<br />
 
Set the Potentiometer output as an Analog Input: connect the pin ADJ and AD0. Make sure the left side Sensor Interface AD0 is disconnected.<br />
 
Set the Potentiometer output as an Analog Input: connect the pin ADJ and AD0. Make sure the left side Sensor Interface AD0 is disconnected.<br />
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. <br />
+
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. <br />
  
 
[[file:High-Precision-AD-DA_ADset.png|900px]]<br />
 
[[file:High-Precision-AD-DA_ADset.png|900px]]<br />
1.C
+
1. C
 
<pre>
 
<pre>
 
cd C/
 
cd C/
Line 279: Line 257:
 
</pre>
 
</pre>
  
2.python2
+
2. python2
 
<pre>
 
<pre>
 
cd python2/
 
cd python2/
Line 285: Line 263:
 
</pre>
 
</pre>
  
3.python3
+
3. python3
 
<pre>
 
<pre>
 
cd python3/
 
cd python3/
Line 291: Line 269:
 
</pre>
 
</pre>
  
*Experiment Phenomenon
+
*Experiment Phenomenon:
 
Turn the potentiometer, the AD0 channel voltage will change accordingly.<br />
 
Turn the potentiometer, the AD0 channel voltage will change accordingly.<br />
 
Block the photoresistor, and the AD1 channel voltage changes accordingly.<br />
 
Block the photoresistor, and the AD1 channel voltage changes accordingly.<br />
Since other channels are not connected to the load, he is floating, so it floats around 1.17V<br />
+
Since other channels are not connected to the load, it is not connected, so it floats around 1.17V.<br />
  
 
==DA Demo==
 
==DA Demo==
Line 300: Line 278:
 
cd DAC8532/
 
cd DAC8532/
 
</pre>
 
</pre>
Provides three demos:c、python2、python3<br />
+
Provides three demos: c, python2, python3.<br />
  
*Hardware Setting
+
*Hardware Setting:
 
The operating voltage is set to 5V: connect 5V to VCC.<br />
 
The operating voltage is set to 5V: connect 5V to VCC.<br />
 
The reference voltage is set to 5V: connect 5V to VREF.<br />
 
The reference voltage is set to 5V: connect 5V to VREF.<br />
 
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.<br />
 
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.<br />
  
1.C
+
1. C
 
<pre>
 
<pre>
 
cd C/
 
cd C/
Line 314: Line 292:
 
</pre>
 
</pre>
  
2.python2
+
2. python2
 
<pre>
 
<pre>
 
cd python2/
 
cd python2/
Line 320: Line 298:
 
</pre>
 
</pre>
  
3.python3
+
3. python3
 
<pre>
 
<pre>
 
cd python3/
 
cd python3/
Line 326: Line 304:
 
</pre>
 
</pre>
  
*Experiment Phenomenon
+
*Experiment Phenomenon:
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/
 
</pre>
 
</pre>
Provides three demos:c、python2、python3<br />
+
Provides three demos:c, python2, python3.<br />
  
1.C
+
1. C
 
<pre>
 
<pre>
 
cd C/
 
cd C/
Line 342: Line 320:
 
</pre>
 
</pre>
  
2.python2
+
2. python2
 
<pre>
 
<pre>
 
cd python2/
 
cd python2/
Line 348: Line 326:
 
</pre>
 
</pre>
  
3.python3
+
3. python3
 
<pre>
 
<pre>
 
cd python3/
 
cd python3/
Line 354: Line 332:
 
</pre>
 
</pre>
  
*Experiment Phenomenon
+
*Experiment Phenomenon:
After rotating the potentiometer, the two LEDs will light up alternately<br />
+
After rotating the potentiometer, the two LEDs will light up alternately.<br />
 
</div>
 
</div>
  
 
='''Resource'''=
 
='''Resource'''=
*[[:File:High-Precision-AD-DA-User-Manual.pdf|User Manual]]
+
==Documentation==
*[[:File:High-Precision-AD-DA-board.pdf | Schematic]]
+
*[https://files.waveshare.com/upload/b/b7/High-Precision-AD-DA-User-Manual.pdf User Manual]
*[[:File:High-Precision-AD-DA-Board-Code.7z | Source code]]
+
*[https://files.waveshare.com/upload/2/29/High-Precision-AD-DA-board.pdf Schematic]
+
*[https://files.waveshare.com/upload/5/5e/High-Precision-AD-DA-Board-Code.7z Source code]
 
*[https://github.com/waveshare/High-Precision-AD-DA-Board Github]
 
*[https://github.com/waveshare/High-Precision-AD-DA-Board Github]
 +
*[https://service.waveshare.com/wswt/ticket/edit/160609?ll=/wswt Third Party Project shared by user Henri P Gavin]
 
{{High-Precision AD/DA Board Datasheets}}
 
{{High-Precision AD/DA Board Datasheets}}
 
{{DVK512 Application Notes}}
 
{{DVK512 Application Notes}}
Line 370: Line 349:
 
='''FAQ'''=
 
='''FAQ'''=
 
{{FAQ|According to the introduction, the module has a sampling rate of 30ksps, why the AD test cannot reach this rate?<br>|
 
{{FAQ|According to the introduction, the module has a sampling rate of 30ksps, why the AD test cannot reach this rate?<br>|
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.|||}}
+
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.<br>
 +
[https://files.waveshare.com/upload/7/7c/AD1256-bcm2835.zip High-Precision-AD-DA-Board-1CH]
 +
|||}}
  
 
{{FAQ|Why does the running program show ID read fail?<br>|
 
{{FAQ|Why does the running program show ID read fail?<br>|
 
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.|||}}
 
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.|||}}
  
{{FAQ|What is the voltage range that supports access?<br>|
+
{{FAQ|After running the program, why does it always display 5V<br>|
Input Voltage Range (Max) (V): 2.5, 5<br>
+
* The unconnected idle channel shows 5.08V; it is a normal phenomenon due to the internal structure of the chip.
Input Voltage Range (Min) (V): -2.5, 0
+
*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
 
|||}}
 
|||}}
 +
{{FAQ|How can I simply test that the AD is functioning properly?
 +
|
 +
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:<br/>
 +
[[File:High-Precision AD-DA Board FAQ.png]]
  
<div class="tabbertab" title="Support" id="mysupport">
+
||}}
 
+
{{FAQ|Is High-Precision AD/DA Board compatible with STM32?
=''Support''=
+
|
{{Service00}}
+
*Compatible with STM32.
 +
*For more models about STM32, you can refer to the following STM32F10X demo to compile and port: [https://files.waveshare.com/upload/f/f5/High-Precision-AD-DA-Board-Code-STM32F10X.zip sample demo].
 +
|
 +
||}}
  
 +
='''Support'''=
 +
{{Servicebox1}}
 
[[Category:Robotics|Robotics]]
 
[[Category:Robotics|Robotics]]

Latest revision as of 06:22, 19 March 2024

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 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 the bookworm system, you can only use lgpio library, bcm2835 and wiringPi can't be installed and used.

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

#Open the Raspberry Pi terminal and run the following command
wget https://github.com/joan2937/lg/archive/master.zip
unzip master.zip
cd lg-master
sudo make install

# You can refer to the official website for more: 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.


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 AM GMT+8 (Monday to Friday)