Skip to content

Commit e240a4e

Browse files
committed
Adding better support for SCD30 power on
1 parent 1f605ea commit e240a4e

File tree

4 files changed

+23
-12
lines changed

4 files changed

+23
-12
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Change Log
22
======================
33

4+
v1.3
5+
---------
6+
7+
* Add 100ms startup time to Qwiic auto-detection. Lack of SD card was causing some sensors to be pinged before they had enough time to power on and ack.
8+
* Add 2000ms startup time to SCD30. This sensor requires significant time to boot. See issue #4.
9+
410
v1.2
511
---------
612

@@ -16,7 +22,6 @@ v1.1
1622
* Add ability to turn on/off power on Qwiic bus when time between sensor readings is > 2s. By default the bus powers down to save power but there may be instances where user wants to keep sensors powered up and running between reads. This can be accessed via the Attached Devices menu.
1723
* Add ability to limit I2C bus speed. Most devices operate at 400kHz I2C. Some (MCP9600) are automatically limited by OLA to 100kHz. There may be instances, because of bus length or other, where the user may want to artifically limit the bus speed. This can be access via the Attached Devices menu.
1824

19-
2025
v1.0
2126
---------
2227
Initial release.

Firmware/OpenLog_Artemis/OpenLog_Artemis.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
1818
*/
1919

20-
const float FIRMWARE_VERSION = 1.2;
20+
const float FIRMWARE_VERSION = 1.3;
2121

2222
#include "settings.h"
2323

Firmware/OpenLog_Artemis/menuAttachedDevices.ino

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,12 @@ bool detectQwiicDevices()
134134

135135
qwiic.setPullups(1); //Set pullups to 1k. If we don't have pullups, detectQwiicDevices() takes ~900ms to complete. We'll disable pullups if something is detected.
136136

137-
//Setting the Pullups to 24k causes the SGP30 to fail to detect.
138-
// qwiic.setPullups(24); //Set pullups to 24k. If we don't have pullups, detectQwiicDevices() takes ~900ms to complete. We'll disable pullups if something is detected.
137+
//24k causes a bunch of unknown devices to be falsely detected.
138+
//qwiic.setPullups(24); //Set pullups to 24k. If we don't have pullups, detectQwiicDevices() takes ~900ms to complete. We'll disable pullups if something is detected.
139+
140+
//Depending on what hardware is configured, the Qwiic bus may have only been turned on a few ms ago
141+
//Give sensors, specifically those with a low I2C address, time to turn on
142+
delay(100); //SCD30 required >50ms to turn on
139143

140144
for (uint8_t address = 1 ; address < 127 ; address++)
141145
{
@@ -248,6 +252,14 @@ bool testDevice(uint8_t i2cAddress)
248252
case ADR_SCD30:
249253
if (co2Sensor_SCD30.begin(qwiic) == true) //Wire port
250254
qwiicAvailable.SCD30 = true;
255+
else
256+
{
257+
//See issue #4: https://github.com/sparkfun/OpenLog_Artemis/issues/4
258+
//Give it 2s to boot and then try again
259+
delay(2000); //1s works but datasheet specs <2s so we'll go with 2000ms.
260+
if (co2Sensor_SCD30.begin(qwiic) == true) //Wire port
261+
qwiicAvailable.SCD30 = true;
262+
}
251263
break;
252264
case ADR_MS8607:
253265
if (pressureSensor_MS8607.begin(qwiic) == true) //Wire port. Tests for both 0x40 and 0x76 I2C addresses.

Firmware/Test Sketches/Sensor Autodetect/I2C_Detector/I2C_Detector.ino

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,13 @@ void loop()
138138
qwiicPowerOn();
139139
//delay(1000); //SCD30 acks and responds
140140
//delay(100); //SCD30 acks but fails to start
141-
delay(900); //
141+
delay(100); //
142142
Serial.println("On!");
143143
Serial.flush();
144144

145145
bool somethingDetected = false;
146146

147-
for (uint8_t address = 1 ; address < 127 ; address++)
147+
for (uint8_t address = 0x60 ; address < 127 ; address++)
148148
{
149149
qwiic.beginTransmission(address);
150150
if (qwiic.endTransmission() == 0)
@@ -253,17 +253,11 @@ bool testDevice(uint8_t i2cAddress)
253253
}
254254
case ADR_SCD30:
255255
if (co2Sensor_SCD30.begin(qwiic) == true) //Wire port
256-
{
257256
qwiicAvailable.SCD30 = true;
258-
Serial.println("SCD30 found!");
259-
}
260257
else
261258
{
262-
Serial.println("SCD30 failed to respond");
263-
264259
//Give it 2s to boot and then try again
265260
delay(2000);
266-
267261
if (co2Sensor_SCD30.begin(qwiic) == true) //Wire port
268262
{
269263
qwiicAvailable.SCD30 = true;

0 commit comments

Comments
 (0)