Skip to content

Commit 414c8ac

Browse files
authored
Merge pull request #44 from Sensirion/scd4x_2.0_20250129_1204
Generate SCD4x driver from SCD4x model version 2.0
2 parents 229d854 + 2e763f3 commit 414c8ac

21 files changed

+2132
-1277
lines changed
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
name: Quality check
22

33
on:
4-
pull_request:
5-
branches:
6-
- master
74
push:
5+
pull_request:
86
branches:
97
- master
108

@@ -13,4 +11,5 @@ jobs:
1311
uses: sensirion/.github/.github/workflows/driver.arduino.check.yml@main
1412
with:
1513
expect-arduino-examples: true
14+
# change to "update" once you published the driver on Arduino library registry
1615
lint-lib-manager-check: update

CHANGELOG.md

Lines changed: 10 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,23 @@
1-
# Changelog
2-
3-
All notable changes to this project will be documented in this file.
1+
# CHANGELOG
42

53
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
64
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
75

8-
## Unreleased
6+
## [Unreleased]
97

10-
## [0.4.0] - 2023-03-06
8+
## [1.0.0] - 2025-1-30
119

1210
### Added
13-
- Methods for ASC (Automatic Self Calibration)
14-
15-
### Breaking changes
16-
- Renamed getDataReadyStatus to getDataReadyFlag
17-
18-
### Fixed
19-
- RH/T conversion now uses correct constant: `2^16 - 1`
20-
- Fixed a few comments
21-
- Initializing the output variables to zero
22-
23-
## [0.3.1] - 2021-04-30
2411

25-
### Changed
12+
- All commands according to data sheet
2613

27-
* Increase timing for single shot from 1350ms to 5000ms
28-
* Increase timing for self test from 5500ms to 10000ms
29-
30-
31-
## [0.3.0] - 2021-03-01
14+
## [0.1.0] - 2021-2-1
3215

3316
### Added
34-
- Convenience interfaces taking care of unit conversion to and from ticks.
35-
36-
### Fixed
37-
- wake-up interface handles missing ACK from sensor on wake up.
38-
39-
40-
## [0.2.0] - 2021-02-10
41-
42-
### Changed
43-
44-
* Updated Sensirion Core library version from 0.4.0 to 0.4.2. This includes the
45-
renaming of the library header file from `SensirionCoreArduinoLibrary.h` to
46-
`SensirionCore.h`.
47-
* Define `SCD4X_I2C_ADDRESS` as hex instead of dec (unchanged value).
48-
49-
### Added
50-
51-
* Added warning about limited EEPROM write cycles.
52-
53-
## [0.1.0] - 2021-02-05
5417

55-
Initial release
18+
- Initial version
19+
- Check latest 0.x.x version for changelog prior to version 1.0.0
5620

57-
[0.3.1]: https://github.com/Sensirion/arduino-i2c-scd4x/compare/0.3.0...0.3.1
58-
[0.3.0]: https://github.com/Sensirion/arduino-i2c-scd4x/compare/0.2.0...0.3.0
59-
[0.2.0]: https://github.com/Sensirion/arduino-i2c-scd4x/compare/0.1.0...0.2.0
60-
[0.1.0]: https://github.com/Sensirion/arduino-i2c-scd4x/releases/tag/0.1.0
21+
[Unreleased]: https://github.com/Sensirion/arduino-i2c-scd4x/compare/1.0.0...HEAD
22+
[1.0.0]: https://github.com/Sensirion/arduino-i2c-scd4x/compare/0.1.0...1.0.0
23+
[0.1.0]: https://github.com/Sensirion/arduino-i2c-scd4x/releases/tag/0.1.0

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 3-Clause License
22

3-
Copyright (c) 2021, Sensirion AG
3+
Copyright (c) 2025, Sensirion AG
44
All rights reserved.
55

66
Redistribution and use in source and binary forms, with or without

README.md

Lines changed: 171 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,195 @@
1-
# Sensirion I2C SCD4x Arduino Library
1+
# Sensirion I²C SCD4X Arduino Library
22

3-
This is the Sensirion SCD4x library for Arduino using the I2C interface.
3+
This is the Sensirion SCD4X library for Arduino allowing you to
4+
communicate with a sensor of the SCD4X family over I²C.
45

5-
[<center><img src="images/SCD41_Development_Board.png" width="300px"></center>](https://sensirion.com/my-scd-ek)
6+
<img src="images/SCD41.png" width="300px">
67

7-
Click [here](https://sensirion.com/my-scd-ek) to learn more about the SCD4x
8-
sensor and the SCD41 Evaluation Kit Board.
8+
Click [here](https://sensirion.com/products/catalog/SEK-SCD41) to learn more about the Sensirion SCD4X sensor family.
99

10-
# Installation
1110

12-
To install, download the latest release as .zip file and add it to your
13-
[Arduino IDE](http://www.arduino.cc/en/main/software) via
11+
Not all sensors of this driver family support all measurements.
12+
In case a measurement is not supported by all sensors, the products that
13+
support it are listed in the API description.
1414

15-
Sketch => Include Library => Add .ZIP Library...
1615

17-
Don't forget to **install the dependencies** listed below the same way via `Add
18-
.ZIP Library`
1916

20-
Note: Installation via the Arduino Library Manager is coming soon.
17+
## Supported sensor types
2118

22-
# Dependencies
19+
| Sensor name | I²C Addresses |
20+
| ------------- | -------------- |
21+
|[SCD40](https://sensirion.com/products/catalog/SCD40)| **0x62**|
22+
|[SCD41](https://sensirion.com/products/catalog/SCD41)| **0x62**|
2323

24+
The following instructions and examples use a *SCD41*.
25+
26+
27+
28+
## Installation of the library
29+
30+
This library can be installed using the Arduino Library manager:
31+
Start the [Arduino IDE](http://www.arduino.cc/en/main/software) and open
32+
the Library Manager via
33+
34+
`Sketch``Include Library``Manage Libraries...`
35+
36+
Search for the `Sensirion I2C SCD4X` library in the `Filter
37+
your search...` field and install it by clicking the `install` button.
38+
39+
If you cannot find it in the library manager, download the latest release as .zip file
40+
and add it to your [Arduino IDE](http://www.arduino.cc/en/main/software) via
41+
42+
`Sketch``Include Library``Add .ZIP Library...`
43+
44+
Don't forget to **install the dependencies** listed below the same way via library
45+
manager or `Add .ZIP Library`
46+
47+
#### Dependencies
2448
* [Sensirion Core](https://github.com/Sensirion/arduino-core)
2549

50+
## Connect the sensor
51+
52+
Use the following pin description to connect your SCD4X to the standard I²C bus of your Arduino board:
53+
54+
<img src="images/SCD41_pinout.png" width="300px">
55+
56+
| *Pin* | *Cable Color* | *Name* | *Description* | *Comments* |
57+
|-------|---------------|:------:|----------------|------------|
58+
| 1 | yellow | SCL | I2C: Serial clock input |
59+
| 2 | black | GND | Ground |
60+
| 3 | red | VDD | Supply Voltage | 2.4V to 5.5V
61+
| 4 | green | SDA | I2C: Serial data input / output |
62+
63+
64+
65+
66+
The recommended voltage is 3.3V.
67+
68+
### Board specific wiring
69+
You will find pinout schematics for recommended board models below:
70+
71+
72+
73+
<details><summary>Arduino Uno</summary>
74+
<p>
75+
76+
| *SCD4X* | *SCD4X Pin* | *Cable Color* | *Board Pin* |
77+
| :---: | --- | --- | --- |
78+
| SCL | 1 | yellow | D19/SCL |
79+
| GND | 2 | black | GND |
80+
| VDD | 3 | red | 3.3V |
81+
| SDA | 4 | green | D18/SDA |
82+
83+
84+
85+
<img src="images/Arduino-Uno-Rev3-i2c-pinout-3.3V.png" width="600px">
86+
</p>
87+
</details>
88+
89+
90+
91+
92+
<details><summary>Arduino Nano</summary>
93+
<p>
94+
95+
| *SCD4X* | *SCD4X Pin* | *Cable Color* | *Board Pin* |
96+
| :---: | --- | --- | --- |
97+
| SCL | 1 | yellow | A5 |
98+
| GND | 2 | black | GND |
99+
| VDD | 3 | red | 3.3V |
100+
| SDA | 4 | green | A4 |
101+
26102

27-
# Quick Start
28103

29-
1. Connect the SCD4x sensor to your Arduino board's standard I2C bus. Check
30-
the pinout of your Arduino board to find the correct pins. The pinout of the
31-
SCD4x sensor board can be found [here](https://sensirion.com/my-scd-ek)
104+
<img src="images/Arduino-Nano-i2c-pinout-3.3V.png" width="600px">
105+
</p>
106+
</details>
32107

33-
* **VDD** of the SEK-SCD41 to the **3.3V** of your Arduino board (5V is also possible)
34-
* **GND** of the SEK-SCD41 to the **GND** of your Arduino board
35-
* **SCL** of the SEK-SCD41 to the **SCL** of your Arduino board
36-
* **SDA** of the SEK-SCD41 to the **SDA** of your Arduino board
37108

38-
2. Open the `exampleUsage` sample project within the Arduino IDE
39109

40-
File => Examples => Sensirion I2C Scd4x => exampleUsage
41110

42-
3. Click the `Upload` button in the Arduino IDE or
111+
<details><summary>Arduino Micro</summary>
112+
<p>
43113

44-
Sketch => Upload
114+
| *SCD4X* | *SCD4X Pin* | *Cable Color* | *Board Pin* |
115+
| :---: | --- | --- | --- |
116+
| SCL | 1 | yellow | ~D3/SCL |
117+
| GND | 2 | black | GND |
118+
| VDD | 3 | red | 3.3V |
119+
| SDA | 4 | green | D2/SDA |
120+
121+
122+
123+
<img src="images/Arduino-Micro-i2c-pinout-3.3V.png" width="600px">
124+
</p>
125+
</details>
126+
127+
128+
129+
130+
<details><summary>Arduino Mega 2560</summary>
131+
<p>
132+
133+
| *SCD4X* | *SCD4X Pin* | *Cable Color* | *Board Pin* |
134+
| :---: | --- | --- | --- |
135+
| SCL | 1 | yellow | D21/SCL |
136+
| GND | 2 | black | GND |
137+
| VDD | 3 | red | 3.3V |
138+
| SDA | 4 | green | D20/SDA |
139+
140+
141+
142+
<img src="images/Arduino-Mega-2560-Rev3-i2c-pinout-3.3V.png" width="600px">
143+
</p>
144+
</details>
145+
146+
147+
148+
149+
<details><summary>ESP32 DevKitC</summary>
150+
<p>
151+
152+
| *SCD4X* | *SCD4X Pin* | *Cable Color* | *Board Pin* |
153+
| :---: | --- | --- | --- |
154+
| SCL | 1 | yellow | GPIO 22 |
155+
| GND | 2 | black | GND |
156+
| VDD | 3 | red | 3V3 |
157+
| SDA | 4 | green | GPIO 21 |
158+
159+
160+
161+
<img src="images/esp32-devkitc-i2c-pinout-3.3V.png" width="600px">
162+
</p>
163+
</details>
164+
165+
166+
167+
## Quick Start
168+
169+
1. Install the libraries and dependencies according to [Installation of the library](#installation-of-the-library)
170+
171+
2. Connect the SCD4X sensor to your Arduino as explained in [Connect the sensor](#connect-the-sensor)
172+
173+
3. Open the `exampleUsage` sample project within the Arduino IDE:
174+
175+
`File``Examples``Sensirion I2C SCD4X``exampleUsage`
176+
177+
178+
The provided example is working with a SCD41, I²C address 0x62.
179+
In order to use the code with another product or I²C address you need to change it in the code of `examples/exampleUsage`.
180+
You find the list with pre-defined addresses in `src/SensirionI2CSCD4X.h`.
181+
182+
183+
5. Click the `Upload` button in the Arduino IDE or `Sketch``Upload`
45184

46185
4. When the upload process has finished, open the `Serial Monitor` or `Serial
47-
Plotter` via the `Tools` menu to observe the measured CO2, Temperature and
48-
Humidity values. Note that the `Baud Rate` in the corresponding window has
49-
to be set to `115200 baud`.
186+
Plotter` via the `Tools` menu to observe the measurement values. Note that
187+
the `Baud Rate` in the used tool has to be set to `115200 baud`.
50188

51-
# Contributing
189+
## Contributing
52190

53191
**Contributions are welcome!**
54192

55-
We develop and test this driver using our company internal tools (version
56-
control, continuous integration, code review etc.) and automatically
57-
synchronize the master branch with GitHub. But this doesn't mean that we don't
58-
respond to issues or don't accept pull requests on GitHub. In fact, you're very
59-
welcome to open issues or create pull requests :)
60-
61193
This Sensirion library uses
62194
[`clang-format`](https://releases.llvm.org/download.html) to standardize the
63195
formatting of all our `.cpp` and `.h` files. Make sure your contributions are
@@ -66,12 +198,13 @@ formatted accordingly:
66198
The `-i` flag will apply the format changes to the files listed.
67199

68200
```bash
69-
clang-format -i *.cpp *.h
201+
clang-format -i src/*.cpp src/*.h
70202
```
71203

72204
Note that differences from this formatting will result in a failed build until
73205
they are fixed.
206+
:
74207

75-
# License
208+
## License
76209

77-
See [LICENSE](LICENSE).
210+
See [LICENSE](LICENSE).

0 commit comments

Comments
 (0)