Skip to content

Commit

Permalink
Adding better support for SCD30 power on
Browse files Browse the repository at this point in the history
  • Loading branch information
nseidle committed May 5, 2020
1 parent 1f605ea commit e240a4e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Change Log
======================

v1.3
---------

* 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.
* Add 2000ms startup time to SCD30. This sensor requires significant time to boot. See issue #4.

v1.2
---------

Expand All @@ -16,7 +22,6 @@ v1.1
* 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.
* 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.


v1.0
---------
Initial release.
2 changes: 1 addition & 1 deletion Firmware/OpenLog_Artemis/OpenLog_Artemis.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/

const float FIRMWARE_VERSION = 1.2;
const float FIRMWARE_VERSION = 1.3;

#include "settings.h"

Expand Down
16 changes: 14 additions & 2 deletions Firmware/OpenLog_Artemis/menuAttachedDevices.ino
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,12 @@ bool detectQwiicDevices()

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.

//Setting the Pullups to 24k causes the SGP30 to fail to detect.
// 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.
//24k causes a bunch of unknown devices to be falsely detected.
//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.

//Depending on what hardware is configured, the Qwiic bus may have only been turned on a few ms ago
//Give sensors, specifically those with a low I2C address, time to turn on
delay(100); //SCD30 required >50ms to turn on

for (uint8_t address = 1 ; address < 127 ; address++)
{
Expand Down Expand Up @@ -248,6 +252,14 @@ bool testDevice(uint8_t i2cAddress)
case ADR_SCD30:
if (co2Sensor_SCD30.begin(qwiic) == true) //Wire port
qwiicAvailable.SCD30 = true;
else
{
//See issue #4: https://github.com/sparkfun/OpenLog_Artemis/issues/4
//Give it 2s to boot and then try again
delay(2000); //1s works but datasheet specs <2s so we'll go with 2000ms.
if (co2Sensor_SCD30.begin(qwiic) == true) //Wire port
qwiicAvailable.SCD30 = true;
}
break;
case ADR_MS8607:
if (pressureSensor_MS8607.begin(qwiic) == true) //Wire port. Tests for both 0x40 and 0x76 I2C addresses.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,13 @@ void loop()
qwiicPowerOn();
//delay(1000); //SCD30 acks and responds
//delay(100); //SCD30 acks but fails to start
delay(900); //
delay(100); //
Serial.println("On!");
Serial.flush();

bool somethingDetected = false;

for (uint8_t address = 1 ; address < 127 ; address++)
for (uint8_t address = 0x60 ; address < 127 ; address++)
{
qwiic.beginTransmission(address);
if (qwiic.endTransmission() == 0)
Expand Down Expand Up @@ -253,17 +253,11 @@ bool testDevice(uint8_t i2cAddress)
}
case ADR_SCD30:
if (co2Sensor_SCD30.begin(qwiic) == true) //Wire port
{
qwiicAvailable.SCD30 = true;
Serial.println("SCD30 found!");
}
else
{
Serial.println("SCD30 failed to respond");

//Give it 2s to boot and then try again
delay(2000);

if (co2Sensor_SCD30.begin(qwiic) == true) //Wire port
{
qwiicAvailable.SCD30 = true;
Expand Down

0 comments on commit e240a4e

Please sign in to comment.