5106 CM5IO 8ADC EN

来自Mcuzone Wiki

切换语言为中文

Keywords

Raspberry Pi, CM5 Core board, RPiOS, 12-bit ADC, 16-bit ADC, ADS1015, ADS1115, Single-ended input, Differential input, PGA, Comparator, 40Pin GPIO

I. Introduction

The CM5IO_8ADC expansion board is based on the Raspberry Pi 40Pin GPIO and extends two ADC chips with different addresses via I2C. It comes in two versions: a 12-bit ADC version and a 16-bit ADC version, with adjustable working voltages of 3.3V and 5V. Reserved voltage reference chip, users can utilize the voltage reference chip to calibrate ADC measurement errors. Each ADC chip includes four single-ended inputs or two differential inputs, featuring a comparator and a PGA (Programmable Gain Amplifier). The module is compatible with platforms such as Raspberry Pi 4B, Raspberry Pi 5, CM4IO, and CM5IO.

II. Hardware Spec

12-bit Version 16-bit Version
I2C, expansion through a 40-pin GPIO interface.
ADC chip*2 ADS1015 ADS1115
sampling speed(MAX) 3.3K SPS 860 SPS
channels Four single-ended inputs or two differential inputs, support 8 channels in total.
working voltage 3.3V or 5V. The working voltage is related to the input signal range, allowing users to make a selection based on their actual needs.
ADC inputs 3.81mm-3Pin *4
size 56×65 mm, M2.5 mounting holes; PCB complies with UL & RoHS certifications, flame retardant rating 94V-0.

5106_CM5IO_8ADC_18.jpg

5106_CM5IO_8ADC_12.jpg

5106_CM5IO_8ADC_13.jpg

5106_CM5IO_8ADC_14.jpg

III. ADC module test

Hardware: CM5IO_8ADC module (16-bit ADC) paired with the CM5IO MINI expansion board

Software: The version of Raspberry Pi OS is 2024-11-19-raspios-bookworm-arm64.img.xz.

The download link is:

https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-64-bit5005_CM5IO_Mini_159.jpg

3.1 System configuration

Boot the OS and enable the I2C interface:

The Raspberry Pi logo in the upper left corner — Preferences — Raspberry Pi Configuration — Interfaces

Enable "I2C", as shown in the figure:

3003_21700_5V5A_PD_07.jpg

Open the terminal and execute the following commands:

sudo nano /boot/firmware/config.txt

Insert the following lines at the end of the file:

dtoverlay=i2c0

5106_CM5IO_8ADC_03.jpg

Save, exit, and restart. After the OS boots up, install the I2C detection tool i2c-tools:

sudo apt install i2c-tools

Then open the terminal and execute the following commands:

i2cdetect -y 0

5106_CM5IO_8ADC_04.jpg

The addresses 48 and 49 correspond to the two channels of the ADC.

3.2 Download example code

For this demonstration, we utilize the open-source ADC example code provided by Adafruit. We extend our sincere thanks to Adafruit!

Execute the following commands in the terminal:

sudo apt-get update

git clone https://github.com/adafruit/Adafruit_Python_ADS1x15.git

cd Adafruit_Python_ADS1x15

Then install the library files:

sudo pip install adafruit-ads1x15 --break-system-packages

cd examples/

3.3 Configure ADC

3.3.1 Configure single-ended input

Take testing the left channel of ADC1 as an example.

Execute the following command in the example folder:

sudo nano simpletest.py

5106_CM5IO_8ADC_07.jpg

The ADC address is 0x49 (i.e., using the ADC1 interface in the schematic diagram), so:

Comment out the statement in the first yellow box.

Modify the second yellow box as shown in the figure. ADS1115 denotes a 16-bit ADC chip (if it is the 12-bit ADC version, set this to ADS1015 here), followed by the ADC address in parentheses, where 0x49 represents ADC1.

The third yellow box is for gain setting, which we set to 1 here. Referring to the table above, a gain of 1 corresponds to a measurement range of -4.096V to +4.096V.

After configuring, save and exit.

3.3.2 Configure differential input

Take testing the left channel of ADC1 as an example.

Execute the following command in the example folder:

sudo nano differential.py

5106_CM5IO_8ADC_08.jpg

The configuration method is the same as the single-ended instance.

After configuring, save and exit.

3.3.3 Configure other channels

Both single-ended and differential require configuration:

adc = Adafruit_ADS1x15.ADS1115(address=0x49, busnum=0)

address: ADC addresses, ADC1 is 0x49 and ADC2 is 0x48

busnum: I2C number, which can be checked by executing `ls /dev/i2c*`, usually 0 or 1.

Only differential needs to be configured:

value = adc.read_adc_difference(0, gain=GAIN)

The first number in parentheses, ADC1 is 0, ADC2 is 3.

3.4 ADC test

This test used the REF5040 and REF5020 voltage references as input signals. The measured values were 4.094V for the REF5040 and 2.048V for the REF5020. The ADC operates at a supply voltage of 5V or 3.3V.

Single-ended input test:

Connect Vout1 from the input signal source interface to AIN0 of ADC1, and connect their GNDs together.

5106_CM5IO_8ADC_16.jpg

Execute:

python simpletest.py

Differential input test:

Connect Vout1 of the input signal source interface to AIN0 of ADC1, and connect its GND to AIN1 of ADC1.

5106_CM5IO_8ADC_15.jpg

Execute:

python differential.py

We are testing AIN0, a 16-bit ADC, so the voltage value of AIN0 after conversion can be calculated using the following formula:

VAIN0=(AIN0/(2^16/2))*Measuring_range

The correspondence between the gain and the measuring range can be found in the source code.

Given an input signal source voltage of 4.094V, an operating voltage of 5V, and a gain of 1, when the single-ended test yields an input result of 32752, then:

VAIN0=(32752/(2^16/2))*4.096=4.094V

We performed tests under multiple scenarios, as follows:

No. Input signal

source voltage (V)

Operating

voltage (V)

Gain Test method Output result Output

voltage (V)

Absolute

error (V)

Error rate The measured

output result

01 4.094 3.3 1 Single-ended 31424 3.928 -0.166 -4.05% 点击查看结果
02 4.094 5 1 Single-ended 32752 4.094 0 0.00% 点击查看结果
03 4.094 3.3 2/3 Single-ended 21056 3.948 -0.146 -3.57% 点击查看结果
04 2.048 5 2 Single-ended 32752 2.047 -0.001 -0.05% 点击查看结果
05 2.048 3.3 1 Single-ended 16384 2.048 0 0.00% 点击查看结果
06 2.048 5 1 Single-ended 16384 2.048 0 0.00% 点击查看结果
07 2.048 3.3 1 Differential 16432 2.054 0.006 0.29% 点击查看结果

The jitter range of the above test output is almost 0, indicating that the conversion is quite stable.

The errors for No. 01 and No. 03 are relatively large, and the reasons are analyzed as follows:

No. 01:

Since the input signal source voltage is 4.094V while the operating voltage is 3.3V, with a gain of 1, the input signal source voltage significantly exceeds the operating voltage. However, the ADC chip manual provides the following explanation regarding the relationship between the input signal source voltage and the operating voltage:

No more than VDD + 0.3V must be applied to the analog inputs of the device.

That is, the input signal source voltage can only be at most 0.3V higher than the operating voltage, while 4.094V is far greater than 3.3V, resulting in a significant error.

No. 03:

The input signal source voltage is 4.094V, and the operating voltage is 3.3V. With a gain of 2/3 at this time, 4.094*(2/3)=2.729<3.3. However, the ADC chip manual provides the following explanation regarding the relationship between the input signal source voltage and the operating voltage:

No more than VDD + 0.3V must be applied to the analog inputs of the device.

The input signal source voltage can only be up to 0.3V higher than the operating voltage, so No. 03 clearly does not meet the requirements, resulting in a significantly high error rate.

Contact Us

0001_x.jpg 0002_fb.jpg 0004_ytb.jpg 0003_bb.jpg 0005_qq.jpg QQ:8204136

Email: mcuzone@vip.qq.com

Tel: +86(0)13957118045

If there are any omissions, errors, or infringements on this page, please contact us through the above methods. Thank you!

Copyright 2004-2025 Wildchip