1
- # Sensirion I2C SCD4x Arduino Library
1
+ # Sensirion I²C SCD4X Arduino Library
2
2
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.
4
5
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 " >
6
7
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.
9
9
10
- # Installation
11
10
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.
14
14
15
- Sketch => Include Library => Add .ZIP Library...
16
15
17
- Don't forget to ** install the dependencies** listed below the same way via `Add
18
- .ZIP Library`
19
16
20
- Note: Installation via the Arduino Library Manager is coming soon.
17
+ ## Supported sensor types
21
18
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** |
23
23
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
24
48
* [ Sensirion Core] ( https://github.com/Sensirion/arduino-core )
25
49
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
+
26
102
27
- # Quick Start
28
103
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 >
32
107
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
37
108
38
- 2 . Open the ` exampleUsage ` sample project within the Arduino IDE
39
109
40
- File => Examples => Sensirion I2C Scd4x => exampleUsage
41
110
42
- 3 . Click the ` Upload ` button in the Arduino IDE or
111
+ <details ><summary >Arduino Micro</summary >
112
+ <p >
43
113
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 `
45
184
46
185
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 ` .
50
188
51
- # Contributing
189
+ ## Contributing
52
190
53
191
** Contributions are welcome!**
54
192
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
-
61
193
This Sensirion library uses
62
194
[ ` clang-format ` ] ( https://releases.llvm.org/download.html ) to standardize the
63
195
formatting of all our ` .cpp ` and ` .h ` files. Make sure your contributions are
@@ -66,12 +198,13 @@ formatted accordingly:
66
198
The ` -i ` flag will apply the format changes to the files listed.
67
199
68
200
``` bash
69
- clang-format -i * .cpp * .h
201
+ clang-format -i src/ * .cpp src/ * .h
70
202
```
71
203
72
204
Note that differences from this formatting will result in a failed build until
73
205
they are fixed.
206
+ :
74
207
75
- # License
208
+ ## License
76
209
77
- See [ LICENSE] ( LICENSE ) .
210
+ See [ LICENSE] ( LICENSE ) .
0 commit comments