I recently purchased an SCD30 (CO2 sensor) and would like to use it with a Raspberry Pi 5 (RPI5). According to the sensor's specifications, it should operate on I2C at a maximum clock speed of 100 kHz. However, I've had some trouble getting it to work.
I found a discussion here (viewtopic.php?t=360996), but it didn't resolve my issue.
In the /boot/firmware/config.txt file, I added the following line:However, I am unsure how to verify if the clock speed has been correctly applied. There are multiple I2C buses listed on the Raspberry Pi, but none of them appear to correspond to the one on pins 2/3.
The output of following loop does not show any changes, between i2c_arm enabled or disabled:
Only the output of
When I connect the SCD30 to an RPI2, the IR LED on the sensor immediately starts flashing. On the RPI5 this does not happen. The code from this GitHub repo (https://github.com/RequestForCoffee/scd ... urement.py) runs without issues on the RPI2, producing the following output:
The RPI5 runs Linux kernel 6.6.63-v8-16k+ #1821.
I am using Python 3.11.2 on the RPI5 and Python 3.10.12 on the RPI2, though I don't believe the Python version is the issue.
Both RPIs show the sensor on address 61 when usingI am running the script on both machines in a virtual environment, and I've installed the necessary dependencies using:Any help or suggestions would be greatly appreciated!
I found a discussion here (viewtopic.php?t=360996), but it didn't resolve my issue.
In the /boot/firmware/config.txt file, I added the following line:
Code:
dtparam=i2c_arm=on,i2c_arm_baudrate=50000
The output of following loop does not show any changes, between i2c_arm enabled or disabled:
Code:
for i in $(find /proc/device-tree/soc/ -name clock-frequency | egrep -v "timer|serial"); do od -i --endian=big "$i"done
changes. When it is enabled, it shows:i2cdetect -l
When disabled, the first line is missing.i2c-1i2c Synopsys DesignWare I2C adapter I2C adapter
i2c-13i2c 107d508200.i2c I2C adapter
i2c-14i2c 107d508280.i2c I2C adapter
When I connect the SCD30 to an RPI2, the IR LED on the sensor immediately starts flashing. On the RPI5 this does not happen. The code from this GitHub repo (https://github.com/RequestForCoffee/scd ... urement.py) runs without issues on the RPI2, producing the following output:
However, when I run the same script on the RPI5, it does not produce any output after this line:INFO:root:Probing sensor...
INFO:root:Link to sensor established.
INFO:root:Getting firmware version...
INFO:root:Sensor firmware version: 834
INFO:root:Setting measurement interval to 2s...
INFO:root:Enabling automatic self-calibration...
INFO:root:Starting periodic measurement...
INFO:root:ASC status: 1
INFO:root:Measurement interval: 2s
INFO:root:Temperature offset: 0.0'C
CO2: 1308.16ppm, temp: 26.30'C, rh: 40.33%
Here are the key details:INFO:root:Temperature offset: 0.0'C
The RPI5 runs Linux kernel 6.6.63-v8-16k+ #1821.
I am using Python 3.11.2 on the RPI5 and Python 3.10.12 on the RPI2, though I don't believe the Python version is the issue.
Both RPIs show the sensor on address 61 when using
Code:
i2cdetect -y 1
Code:
python3 -m pip install --upgrade pip setuptools scd30_i2c
Statistics: Posted by Rayn0r42 — Fri Nov 29, 2024 10:55 am — Replies 0 — Views 31