I have a redboard artemis OLA and an SCD30 CO2 sensor. Wired up an SCD30 to an OLA. I had previously updated OLA firmware to V18.bin. The logger was working correctly and I was able to see data from IMU on the OLA. I took the next step and plugged in the SDC30 (I have checked and rechecked to see that SDL and SDA are correct polarity). SCD30 has a slow on and off orange LED, so it powered up. But on OLA power up or on reset the SCD30 is not recognized by the OLA. I get this error: “Known I2C address but device failed identification at address 0x61”. When I try to configure/detect the sensor manually, I get the same error. I tried diddling with the I2C resistors, (1.5k default) and this did not change outcome. I have no way of knowing if I have a defective OLA or defective SCD or some other issue. Suggestions?
I can find SCD30 with an I2C scanner but Sparkfun SCD30 has also tried another library, which also does not work. I have ordered an SCD30 and had the first look at the driver. This is part of the I2C protocol to allow a slower I2C slave device
Hi, can any of the moderators respond to this? I am dead in the water without some guidance. Thanks!
I had a look at the OLA code before. Here is what happens :
-
The OLA detects a device on address 0x61 (that means SDA and SCL are working).
-
The next step is to check whether a device with address 0x61 is known to the OLA code.
-
If so do a begin() to see whether the sensor response to initialize. If that fails it will assume it is NOT that known sensor. I expect however that begin() will work.
-
As a next step for the SCD30 it tries immediately a readMeasurement(), if no data is available it will return false and the OLA will assume that 0x61-device is not SCD30. I expect this readMeasurement() to fail as the SCD30 is set in begin() to perform a measurement every 2 seconds, so NO data available immediately.
-
If either begin() or readMeasurement() fails it will check whether there are more sensors known with address 0x61 it will try the next, else you get your error message.
What you can try is a reset (without removing power) of the OLA. Maybe you are lucky that there is data.
You can check / simulate with the following sketch. A fresh start (after power on/off) will cause the message “Waiting for data” after pressing reset you often get immediately data (because the SCD30 was still in the measurement state)
#include <Wire.h>
#include "SparkFun_SCD30_Arduino_Library.h" //Click here to get the library: http://librarymanager/All#SparkFun_SCD30
SCD30 airSensor;
void setup()
{
Serial.begin(115200);
Serial.println("SCD30 Example");
Wire.begin();
if (airSensor.begin() == false)
{
Serial.println("Air sensor not detected. Please check wiring. Freezing...");
while (1)
;
}
//The SCD30 has data ready every two seconds
}
void loop() {
if (airSensor.dataAvailable())
{
Serial.print("co2(ppm):");
Serial.print(airSensor.getCO2());
Serial.print(" temp(C):");
Serial.print(airSensor.getTemperature(), 1);
Serial.print(" humidity(%):");
Serial.print(airSensor.getHumidity(), 1);
Serial.println();
}
else
Serial.println("Waiting for new data");
delay(500);
}
If you have the OLA source you can try add delay for 2 seconds before trying readmeasurement() call in testDevice
Thanks Paul, I have fixed some issues (sorry I am re-learning arduino). I now have the correct board selected and support downloaded. (I have board selected as ‘red board artemis’ as artemis OLA is not a choice) 115kb. I had downloaded SCD30 support for the include file. I then again tried the auto detect but got the same error (note SCD30 internal LED is flashing). So I uploaded your sketch and got a Begin() error. But it turns out with this sketch power is not getting applied to the sensor so of course it is not responding… so I have some sort of error, perhaps with wire()?
As part of my further re-education, if I want to eventually get the datalogger back to factory original with the menu’s and etc, what is the name of the sketch for that? (or do I do a firmware reload?)
Select the ATP board instead of " red board artemis" . . good catch the QWIIC power on the OLA board. It needs beginQwiic(); before Wire.begin(); in the sketch inn order to turn on the power.
There are a large number of libraries to download and include before you can compile the 1.8 version from scratch. Personally I think Sparkfun should do that, but you can find the source code on github.
thanks Paul, almost there. Doesn’t seem to recognize beginQwiic(); and i didn’t see a library to include: here is what I have:
#include <Wire.h>
#include “SparkFun_SCD30_Arduino_Library.h” //Click here to get the library: http://librarymanager/All#SparkFun_SCD30
SCD30 airSensor;
void setup()
{
Serial.begin(115200);
Serial.println(“SCD30 Example”);
beginQwiic();
Wire.begin();
if (airSensor.begin() == false)
{
Serial.println(“Air sensor not detected. Please check wiring. Freezing…”);
while (1)
;
}
//The SCD30 has data ready every two seconds
}
you needed to include the relevant code from the original sketch.
Below should work now.
// OLA special to test SCD30
#include "SparkFun_SCD30_Arduino_Library.h" //Click here to get the library: http://librarymanager/All#SparkFun_SCD30
SCD30 airSensor;
//Setup Qwiic Port
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#include <Wire.h>
TwoWire qwiic(1); //Will use pads 8/9
const byte PIN_QWIIC_POWER = 18;
uint32_t qwiicBusPullUps = 1; //Default to 1.5k I2C pull-ups - internal to the Artemis
//Define the pin functions
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//Depends on hardware version. This can be found as a marking on the PCB.
//x04 was the SparkX 'black' version.
//v10 was the first red version.
#define HARDWARE_VERSION_MAJOR 1
#define HARDWARE_VERSION_MINOR 0
void setup()
{
Serial.begin(115200);
Serial.println("SCD30 Example");
beginQwiic(); // needed on OLA board
delay(100); // give time for SCD30 to start-up now power has been applied
//The SCD30 has data ready every two seconds
if (airSensor.begin(qwiic) == false)
{
Serial.println("Air sensor not detected. Please check wiring. Freezing...");
while (1)
;
}
}
void loop() {
if (airSensor.dataAvailable())
{
Serial.print("co2(ppm):");
Serial.print(airSensor.getCO2());
Serial.print(" temp(C):");
Serial.print(airSensor.getTemperature(), 1);
Serial.print(" humidity(%):");
Serial.print(airSensor.getHumidity(), 1);
Serial.println();
}
else
Serial.println("Waiting for new data");
delay(500);
}
void beginQwiic()
{
pinMode(PIN_QWIIC_POWER, OUTPUT);
qwiicPowerOn();
qwiic.begin();
qwiic.setPullups(qwiicBusPullUps); //Just to make it really clear what pull-ups are being used, set pullups here.
}
void qwiicPowerOn()
{
pinMode(PIN_QWIIC_POWER, OUTPUT);
#if(HARDWARE_VERSION_MAJOR == 0)
digitalWrite(PIN_QWIIC_POWER, LOW);
#else
digitalWrite(PIN_QWIIC_POWER, HIGH);
#endif
}
void qwiicPowerOff()
{
pinMode(PIN_QWIIC_POWER, OUTPUT);
#if(HARDWARE_VERSION_MAJOR == 0)
digitalWrite(PIN_QWIIC_POWER, HIGH);
#else
digitalWrite(PIN_QWIIC_POWER, LOW);
#endif
}
Working! Thanks! Not really clear to me why it wasn’t working right out of the box… but I can get where I need to go from here.