Skip to content

Commit b9d22ac

Browse files
committed
Merge branch 'post-generation-updates' into 'master'
Post generation updates See merge request MSO-SW/drivers/arduino/arduino-i2c-scd30!1
2 parents 3c255ad + 63853cb commit b9d22ac

File tree

9 files changed

+57
-59
lines changed

9 files changed

+57
-59
lines changed

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,21 @@ The default I²C address of [SCD30](https://sensirion.com/products/catalog/SCD30
1616

1717
### Connecting the Sensor
1818

19-
Your sensor has the 7 different connectors: VDD, GND, SCL, SDA, RDY, PWM, SEL.
19+
Your sensor has the 5 different pins you need to connect to your Arduino Board: VDD, GND, SCL, SDA, SEL.
2020
Use the following pins to connect your SCD30:
2121

2222
<img src="images/scd30_pinout.jpg" width="300px">
2323

2424
| *Pin* | *Cable Color* | *Name* | *Description* | *Comments* |
2525
|-------|---------------|:------:|----------------|------------|
26-
| 1 | |VDD | Supply Voltage | 3.3 to 5.5V
27-
| 2 | |GND | Ground |
28-
| 3 | |SCL | I2C: Serial clock input |
29-
| 4 | |SDA | I2C: Serial data input / output |
30-
| 5 | |RDY | | High when data is available
31-
| 6 | |PWM | |
32-
| 7 | |SEL | Interface select | Interface select; Pull to ground or floating for I2c
26+
| 1 | red |VDD | Supply Voltage | 3.3 to 5.5V
27+
| 2 | black |GND | Ground |
28+
| 3 | yellow |SCL | I2C: Serial clock input |
29+
| 4 | green |SDA | I2C: Serial data input / output |
30+
| 5 | |RDY | High when data is available | do not connect
31+
| 6 | |PWM | | do not connect
32+
| 7 | blue |SEL | Interface select | Pull to ground or floating for I2c
33+
3334
You can find the pinout for specific boards under following links:
3435
* [Arduino Uno](pinouts/arduino-uno-rev3.md)
3536
* [Arduino Nano](pinouts/arduino-nano.md)

examples/exampleUsage/exampleUsage.ino

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ void setup() {
5353
Wire.begin();
5454
sensor.begin(Wire, SCD30_I2C_ADDR_61);
5555

56+
sensor.stopPeriodicMeasurement();
5657
sensor.softReset();
5758
delay(2000);
5859
uint8_t major = 0;
@@ -64,7 +65,7 @@ void setup() {
6465
Serial.println(errorMessage);
6566
return;
6667
}
67-
Serial.print("major: ");
68+
Serial.print("firmware version major: ");
6869
Serial.print(major);
6970
Serial.print("\t");
7071
Serial.print("minor: ");
@@ -83,10 +84,10 @@ void loop() {
8384

8485
float co2Concentration = 0.0;
8586
float temperature = 0.0;
86-
float humidiy = 0.0;
87+
float humidity = 0.0;
8788
delay(1500);
8889
error = sensor.blockingReadMeasurementData(co2Concentration, temperature,
89-
humidiy);
90+
humidity);
9091
if (error != NO_ERROR) {
9192
Serial.print("Error trying to execute blockingReadMeasurementData(): ");
9293
errorToString(error, errorMessage, sizeof errorMessage);
@@ -99,7 +100,7 @@ void loop() {
99100
Serial.print("temperature: ");
100101
Serial.print(temperature);
101102
Serial.print("\t");
102-
Serial.print("humidiy: ");
103-
Serial.print(humidiy);
103+
Serial.print("humidity: ");
104+
Serial.print(humidity);
104105
Serial.println();
105106
}

pinouts/arduino-mega-2560-rev3.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
| *SCD30* | *SCD30 Pin* | *Cable Color* | *Board Pin* |
44
| :---: | --- | --- | --- |
5-
| VDD | 1 | | 3.3V |
6-
| GND | 2 | | GND |
7-
| SCL | 3 | | D21/SCL |
8-
| SDA | 4 | | D20/SDA |
9-
| RDY | 5 | | |
10-
| PWM | 6 | | |
11-
| SEL | 7 | | GND |
5+
| VDD | 1 | red | 3.3V |
6+
| GND | 2 | black | GND |
7+
| SCL | 3 | yellow | D21/SCL |
8+
| SDA | 4 | green | D20/SDA |
9+
| SEL | 7 | blue | GND |
1210

1311

1412
<img src="Arduino-Mega-2560-Rev3-pinout.png" width="700px">

pinouts/arduino-micro.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
| *SCD30* | *SCD30 Pin* | *Cable Color* | *Board Pin* |
44
| :---: | --- | --- | --- |
5-
| VDD | 1 | | 3.3V |
6-
| GND | 2 | | GND |
7-
| SCL | 3 | | ~D3/SCL |
8-
| SDA | 4 | | D2/SDA |
9-
| RDY | 5 | | |
10-
| PWM | 6 | | |
11-
| SEL | 7 | | GND |
5+
| VDD | 1 | red | 3.3V |
6+
| GND | 2 | black | GND |
7+
| SCL | 3 | yellow | ~D3/SCL |
8+
| SDA | 4 | green | D2/SDA |
9+
| SEL | 7 | blue | GND |
1210

1311

1412
<img src="Arduino-Micro-pinout.png" width="700px">

pinouts/arduino-nano.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22

33
| *SCD30* | *SCD30 Pin* | *Cable Color* | *Board Pin* |
44
| :---: | --- | --- | --- |
5-
| VDD | 1 | | 3.3V |
6-
| GND | 2 | | GND |
7-
| SCL | 3 | | A5 |
8-
| SDA | 4 | | A4 |
9-
| RDY | 5 | | |
10-
| PWM | 6 | | |
5+
| VDD | 1 | red | 3.3V |
6+
| GND | 2 | black | GND |
7+
| SCL | 3 | yellow | A5 |
8+
| SDA | 4 | green | A4 |
119
| SEL | 7 | | GND |
1210

1311

pinouts/arduino-uno-rev3.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
| *SCD30* | *SCD30 Pin* | *Cable Color* | *Board Pin* |
44
| :---: | --- | --- | --- |
5-
| VDD | 1 | | 3.3V |
6-
| GND | 2 | | GND |
7-
| SCL | 3 | | D19/SCL |
8-
| SDA | 4 | | D18/SDA |
9-
| RDY | 5 | | |
10-
| PWM | 6 | | |
11-
| SEL | 7 | | GND |
5+
| VDD | 1 | red | 3.3V |
6+
| GND | 2 | black | GND |
7+
| SCL | 3 | yellow | D19/SCL |
8+
| SDA | 4 | green | D18/SDA |
9+
| SEL | 7 | blue | GND |
1210

1311

1412
<img src="Arduino-Uno-Rev3-pinout.png" width="700px">

pinouts/esp32-devkitc.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
| *SCD30* | *SCD30 Pin* | *Cable Color* | *Board Pin* |
44
| :---: | --- | --- | --- |
5-
| VDD | 1 | | 3.3V |
6-
| GND | 2 | | GND |
7-
| SCL | 3 | | D21/SCL |
8-
| SDA | 4 | | D20/SDA |
9-
| RDY | 5 | | |
10-
| PWM | 6 | | |
11-
| SEL | 7 | | GND |
5+
| VDD | 1 | red | 3.3V |
6+
| GND | 2 | black | GND |
7+
| SCL | 3 | yellow | D21/SCL |
8+
| SDA | 4 | green | D20/SDA |
9+
| SEL | 7 | blue | GND |
1210

1311

1412
<img src="esp32-devkitc-pinout.png" width="800px">

src/SensirionI2cScd30.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* THIS FILE IS AUTOMATICALLY GENERATED
33
*
4-
* Generator: sensirion-driver-generator 0.9.0
4+
* Generator: sensirion-driver-generator 0.9.1
55
* Product: scd30
66
* Version: None
77
*/
@@ -61,13 +61,13 @@ int16_t SensirionI2cScd30::awaitDataReady() {
6161

6262
int16_t SensirionI2cScd30::blockingReadMeasurementData(float& co2Concentration,
6363
float& temperature,
64-
float& humidiy) {
64+
float& humidity) {
6565
int16_t localError = 0;
6666
localError = awaitDataReady();
6767
if (localError != NO_ERROR) {
6868
return localError;
6969
}
70-
localError = readMeasurementData(co2Concentration, temperature, humidiy);
70+
localError = readMeasurementData(co2Concentration, temperature, humidity);
7171
return localError;
7272
}
7373

@@ -98,6 +98,7 @@ int16_t SensirionI2cScd30::stopPeriodicMeasurement() {
9898
if (localError != NO_ERROR) {
9999
return localError;
100100
}
101+
delay(10);
101102
return localError;
102103
}
103104

@@ -115,6 +116,7 @@ int16_t SensirionI2cScd30::setMeasurementInterval(uint16_t interval) {
115116
if (localError != NO_ERROR) {
116117
return localError;
117118
}
119+
delay(10);
118120
return localError;
119121
}
120122

@@ -162,7 +164,7 @@ int16_t SensirionI2cScd30::getDataReady(uint16_t& dataReadyFlag) {
162164

163165
int16_t SensirionI2cScd30::readMeasurementData(float& co2Concentration,
164166
float& temperature,
165-
float& humidiy) {
167+
float& humidity) {
166168
int16_t localError = NO_ERROR;
167169
uint8_t local_buffer[18] = {0};
168170
SensirionI2CTxFrame txFrame = SensirionI2CTxFrame::createWithUInt16Command(
@@ -181,7 +183,7 @@ int16_t SensirionI2cScd30::readMeasurementData(float& co2Concentration,
181183
}
182184
localError |= rxFrame.getFloat(co2Concentration);
183185
localError |= rxFrame.getFloat(temperature);
184-
localError |= rxFrame.getFloat(humidiy);
186+
localError |= rxFrame.getFloat(humidity);
185187
return localError;
186188
}
187189

@@ -199,6 +201,7 @@ int16_t SensirionI2cScd30::activateAutoCalibration(uint16_t doActivate) {
199201
if (localError != NO_ERROR) {
200202
return localError;
201203
}
204+
delay(10);
202205
return localError;
203206
}
204207

@@ -237,6 +240,7 @@ int16_t SensirionI2cScd30::forceRecalibration(uint16_t co2RefConcentration) {
237240
if (localError != NO_ERROR) {
238241
return localError;
239242
}
243+
delay(10);
240244
return localError;
241245
}
242246

@@ -276,6 +280,7 @@ int16_t SensirionI2cScd30::setTemperatureOffset(uint16_t temperatureOffset) {
276280
if (localError != NO_ERROR) {
277281
return localError;
278282
}
283+
delay(10);
279284
return localError;
280285
}
281286

@@ -335,6 +340,7 @@ int16_t SensirionI2cScd30::setAltitudeCompensation(uint16_t altitude) {
335340
if (localError != NO_ERROR) {
336341
return localError;
337342
}
343+
delay(10);
338344
return localError;
339345
}
340346

src/SensirionI2cScd30.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* THIS FILE IS AUTOMATICALLY GENERATED
33
*
4-
* Generator: sensirion-driver-generator 0.9.0
4+
* Generator: sensirion-driver-generator 0.9.1
55
* Product: scd30
66
* Version: None
77
*/
@@ -94,22 +94,22 @@ class SensirionI2cScd30 {
9494
*
9595
* @param[out] co2Concentration
9696
* @param[out] temperature
97-
* @param[out] humidiy
97+
* @param[out] humidity
9898
*
9999
* @return error_code 0 on success, an error code otherwise.
100100
*/
101101
int16_t blockingReadMeasurementData(float& co2Concentration,
102-
float& temperature, float& humidiy);
102+
float& temperature, float& humidity);
103103

104104
/**
105-
* @brief Start continuous measurement of CO2, relative humidiy and
105+
* @brief Start continuous measurement of CO2, relative humidity and
106106
* temperature.
107107
*
108108
* Starts continuous measurement of the SCD30 to measure CO₂ concentration,
109109
* humidity and temperature. Measurement data which is not read from the
110110
* sensor will be overwritten. The CO₂ measurement value can be compensated
111111
* for ambient pressure by feeding the pressure value in mBar to the sensor.
112-
* Setting the ambient pressure will overwrite previous settings of
112+
* Setting the ambient pressure will overwrite previous settings of
113113
* altitude compensation. Setting the argument to zero will deactivate
114114
* the ambient pressure compensation(default ambient pressure = 1013.25
115115
* mBar). For setting a new ambient pressure when continuous measurement is
@@ -176,12 +176,12 @@ class SensirionI2cScd30 {
176176
*
177177
* @param[out] co2Concentration
178178
* @param[out] temperature
179-
* @param[out] humidiy
179+
* @param[out] humidity
180180
*
181181
* @return error_code 0 on success, an error code otherwise.
182182
*/
183183
int16_t readMeasurementData(float& co2Concentration, float& temperature,
184-
float& humidiy);
184+
float& humidity);
185185

186186
/**
187187
* @brief Activates or deactivates continuous automatic self calibration.

0 commit comments

Comments
 (0)