Is the OpenLog Artemis (Red board) compatible with any I2C Sensors?

Hi All,

Can the OpenLog Artemis (Red) be configured to log data from any I2C Sensors? or is it strictly compatible with the sensors listed on the website? If it is possible to configure OpenLog Artemis with other sensors, what would be involved?

I am building a remote datalogger and will be using a the following sensor to measure hydrostatic pressure (https://bluerobotics.com/store/sensors- … sor-r1-rp/) .

Kind regards

EMG_WE

Hi @EMG_WE,

Yes, it is possible to add your own additional sensors. The checklist we use when adding a sensor is available here:

https://github.com/sparkfun/OpenLog_Art … SENSORS.md

Very best wishes,

Paul

Don’t forget that the OLA does support this micro-pressure sensor. Maybe one of these and some tubing would do what you need?

https://www.sparkfun.com/products/16476

Hi Paul,

Thanks for you prompt reply, much appreciated. That is great news. This platform look very good for my application as I am required to collect a wide range of data. It would be great to change and adjust sensors as my project is set to evolve.

Can I clarify/confirm a few things:

  1. the firmware for the OpenLog Artemis is a series of .ino sketches that can be modified and uploaded to the board.

  2. Sensors can added and remove by adjusting the sketches accordingly and uploading.

  3. The format (i.e. sample rate and selection) of data that is saved to the SD card and displayed to the serial port be adjusted to my needs. I require a consistent sample rate for 30 minute intervals. (This is important for post processing the data).

  4. Does the IMU require calibration similar to other IMUs like the BNO005?

The sensor you have attached is interesting (along with the SparkFun GPS-RTK2 Board - ZED-F9P) and will fit into the project perfectly. Albeit I will still need to include the original pressure sensor as it is waterproof and designed the measure the depth of remotely operated submersible vehicles (ROVs).

Thanks again

EMG_WE

Hi @EMG_WE,

  1. It’s more of a ‘collection’ of sketches. OpenLog_Artemis_ino is the main one, the others are included automatically.

  2. You can add new sensors to the firmware by following the checklist. I’m not sure why you would want to remove any? The OLA detects which sensors are connected and adjusts accordingly.

  3. Yes, the sample rate and selection of which parameters are logged can be adjusted. Yes, you can choose to open a new log file every 30 minutes too.

  4. It works well without calibration, but, yes, there is a calibration procedure that could be added to the firmware - if required. That would be an upgrade though.

Best wishes,

Paul

Thanks again for your help Paul.

Hi Paul,

I am now convinced that the out of the box OLA firmware has a bug with regards to the SCD30. Firmware will not recognize the sensor. SFE (Paulhva) got me some code changes and I got the sensor up and running and I am looking at data on serial monitor (sorry but I still do not understand what changes he made vs. OLA code). This .ino he sent is simple version that just got the SCD30 running. But now I need to get the datalogging back running. So I tried the V19 beta binary for the full OLA code set and this does not fix the issue. So two things. One is to let you know that there is most likely some bug in the basic OLA firmware with regards to SCD30 that need to be fixed, 2nd is to better understand your comment above. I have looked at the library of OLA.ino sketches. I just want to confirm that if I collect all of these sketches into a folder, and then am successful adjusting the SCD30 related issues in one of those files. And then all I would need to do is to compile and load the openlog_artemis.ino file upto the OLA and it will automatically bring in all the other .ino files including the one I modified? Could you confirm I have the process correct? Thx Jim

Hi Jim,

I’ve opened an Issue on the OLA repo to track this:

https://github.com/sparkfun/OpenLog_Artemis/issues/67

Could you please try the following:

Open the Serial Monitor and press a key to see the Main Menu.

Press “d”.

This will open the hidden debug menu.

Enable the debug messages.

Quit out of the menus.

Restart the OLA by closing and reopening the Serial Monitor.

Please copy and paste the messages you see and post them in the OLA Issue (use the link above).

This will give me some clues about what is going wrong and why the SCD30 is not being detected properly.

I have tested the SCD30 and it was working fine for me. We need to figure out why it is not working correctly for you.

To answer your other question:

You can download the OLA source code using the green download button on the front page of the GitHub repo.

Place all of these files into a single Arduino folder:

https://github.com/sparkfun/OpenLog_Art … og_Artemis

You then need to install all of the libraries needed by the OLA code. You will find helper links in OpenLog_Artemis.ino to help you do this:

https://github.com/sparkfun/OpenLog_Art … #L189-L208

Make sure you have the SparkFun Apollo3 boards v1.2.1 installed via the boards manager. Make sure it is 1.2.1 - not 2.0+. Select “SparkFun RedBoard Artemis ATP” as the board in the SparkFun Apollo3 boards.

You can then build your own version of the code and upload it to your OLA.

If you find a fix for the SCD30 before I do, then please tell me about it using the Issue link above. Thank you!

Best wishes,

Paul

HI Paul,

The issue on the SCD30 is that during begin() it will start the SCD30 to produce results every 2 seconds. However the OLA code is checking immediately after begin to see whether results can be read.

from autodetect.ino

        //Confidence: Medium - Begin doesn't confirm anything, but a readMeasurement() must pass CRC check
        SCD30 sensor1;
        if (sensor1.begin(qwiic) == true) //Wire port
          if (sensor1.readMeasurement() == true) //This reads the measurement register and calculates a CRC on the interchange
            return (DEVICE_CO2_SCD30);

I have you had done a warm reset, the SCD30 MIGHT still have a result from a previous begin() and as such pass the test. However with a cold reset (after power-off), it will often not have results and thus the test will fail. To demonstrate attached an ino in zip for the OLA. After a cold boot it often takes some loops “Waiting for new data”. After a warm reset it might be there immediately.

To solve :

a) wait longer for result

b) In May 2020 SCD30 documentation additional commands were documented. These have not been included in the Sparkfun Library. One of them is to be able to read the firmwarelevel. I had already included all the new functions : https://github.com/paulvha/scd30. Maybe we should update the Sparkfun SCD30 library as well.

sketch_jan03a.zip (1.28 KB)

Many thanks Paul - that’s really helpful,

I’ll update the library and the OLA firmware as soon as I can.

Thanks again,

Paul

Hi Paul and Paul,

Thanks. Over the weekend I was able to figure out how to download the OLA SW so I could modify it. And I got that up and running. As a debug step I had taken Paulvha code (in zip above) that he had provided me earlier and inserted it into the bottom of the setup() in the Openlog_artemis.ino file. Concept was to independently try to make this code work within the framework as a test (few debugging steps needed code mods, see below, but I tested all this code standalone and sensor was working). I can’t get past the "“Air sensor not detected. Please check wiring. Freezing…”. It just stays there. I also tried this after commenting out the autodetect step, (so code skipped the autodetect step). And this did not affect problem. I also tried doing a power off of the sensor and restart as I saw that in some earlier versions of SCD30 code. Very mysterious…

I will reload the base version of OLA code and select ‘d’ to see what I get. I will also confirm I am at V1.2.1 of Apollo 3. Code I inserted into Setup() below: (sorry it has other mods in it that I was working on but pay attention to setup().

#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”);

// Power up QWIIC interface: needed on OLA board

pinMode(PIN_QWIIC_POWER, OUTPUT);

digitalWrite(PIN_QWIIC_POWER, HIGH);

qwiic.begin();

qwiic.setPullups(qwiicBusPullUps); //Just to make it really clear what pull-ups are being used, set pullups here.

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)

;

}

// Code from Github for setting SCD30 (much commented out, and can be commented in)

//airSensor.setMeasurementInterval(4); //Change number of seconds between measurements: 2 to 1800 (30 minutes)

//Read altitude compensation value

unsigned int altitude = airSensor.getAltitudeCompensation();

Serial.print("Current altitude: ");

Serial.print(altitude);

Serial.println(“m”);

//My desk is ~1600m above sealevel

//airSensor.setAltitudeCompensation(1600); //Set altitude of the sensor in m, stored in non-volatile memory of SCD30

//Pressure in Boulder, CO is 24.65inHg or 834.74mBar

//airSensor.setAmbientPressure(835); //Current ambient pressure in mBar: 700 to 1200, will overwrite altitude compensation

//Read temperature offset

float offset = airSensor.getTemperatureOffset();

Serial.print("Current temp offset: ");

Serial.print(offset, 2);

Serial.println(“C”);

//airSensor.setTemperatureOffset(5); //Optionally we can set temperature offset to 5°C, stored in non-volatile mem of SCD30

// Autoselfcalibration on off

int autocal1 = airSensor.getAutoSelfCalibration();

Serial.print("Autocal = ");

Serial.print(autocal1);

Serial.println(“”);

//airsensor.setAutoSelfCalibration(1); set to on or off

// bool setForcedRecalibrationFactor(uint16_t concentration);

//}

//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(1000);

//}

}

Confirmed that I am on 1.2.1 Apollo, and programming under ATP. Reloaded V1.8 OLA firmware. Put enable debug on, but no additional useful messages. I posted them in the issues.

for now you can keep make a workaround much more simple. In the original autodetect.ino, change the detect code for the SCD30 to include a delay. Watch that you need to add brackets as well in the code as I have done !! A start will take longer (3 seconds) … but it should work.

SCD30 sensor1;
        if (sensor1.begin(qwiic) == true) {        //Wire port
          delay(3000);         // wait 3 seconds (the measurement results should now be there)
          if (sensor1.readMeasurement() == true) //This reads the measurement register and calculates a CRC on the interchange
            return (DEVICE_CO2_SCD30);
         }

Hi Paul,

I inserted this mod and code is working!. THX Looks like I am good to go.

BTW before I got the mod above, I downloaded the paulhva_scd30 library referenced above. I then replaced the include statement from Sparkfun…SCD30, to paulhva_scd30.h . But this will not compile without massive errors (seem to be related to ‘private’ variables). That was probably a naive attempt… but FYI. I set the include back to original include for the mod above.

Hi Paul and Paul

One more issue… So I advanced my design and added a qwiic multiplexer (8 input) and now have 2 SCD30’s. With the code mod above the program recognized both sensors at turn on and data was coming into the serial monitor as expected. Now I moved to stand alone mode to log data without connection to USB, and running on battery. I set up the device and then select q option to shut down, then disconnect USb, then hit reset pin to start logging. (this seems the smartest way to get a clean power up when stand alone). I have also implemented the switch on pin 32 for controlled file close and system shutdown. The problem occurs when I hit the reset pin to start. Sometimes the startup recognized the mux, and SCD’s and logs correctly. More often on power up it seems to miss the mux and the SCD’s. When I reconnect later to look at logged files, I only get the IMU information, and SCD data is not there (and SCD data is not referenced in header line). I can kind of see this in the way the LED flash. If correct, it takes longer, if incorrect it happens faster the the blue led does not flash except in beginning. (when system powers up correctly, the blue LED gives a flash on a regular basis). This one is difficult to debug as I can’t watch the startup process on the serial monitor. Any ideas?

Maybe it is a power issue. At start there might be short drop in the supply from the battery . I don’t have a mux so I can not try it.

Try the following to diagnose and maybe it helps

  • if you have a USB power only cable , try to do the same, but keep the power supply connected.

  • Else at begin in setup(), set a delay of couple of seconds, giving the battery more time to stabilize.

  • Make sure you battery is fully loaded and strong enough.

  • Try to do the same, but with only ONE SCD30 attached and see what happens.

Hi Paul,

After further debugging, I am getting the error equally with USB power or battery power. The autodetect for the SCD is working only sometimes. I increased the delay time in autodetect.ino to 5 sec, but this has not fixed the problem. In some cases one SCD is detected and one is not (I am doing all this debugging with USB power). 50% of the time detection works and 50% not. Suspecting a mux issue, I tried moving positions on the mux and this does not seem to impact problem, nor does changing ‘number of mux bytes’ variable in openlog_artemis.ino from 3 to 7. My best theory now is that the SCD detect is not reliable still, (and this must be some flaky interface that have on the SCD for it to be so finicky). I have implemented a crappy work around, I flash the status LED if SCD detected, if I see two set of flashes for two SCDs then I am good, else I abort and restart.

Sorry to hear. This week I am busy. Can you try with Mux and ONLY ONE SCD30 BOTH connected directly to the same SCL / SDA as the MUX is connected on the QWuic. I still wonder about power and MUX issue.

Hi Jim (@jimbrookline) and Paul (@paulvha),

Paul was completely correct. The readMeasurement was indeed causing problems…

Paul: I’ve updated the SCD30 library to version 1.0.11 and have incorporated some of the corrections and suggestions from your version of the library. I wasn’t able to merge everything as some of your changes break backward-compatibility, but I have incorporated the most important changes.

I only have one SCD30 here, so I can’t fully replicate what Jim was seeing, but the OLA does now seems to detect it OK - on its own or through a mux.

I’ve added an extra feature which I hope will help: if the OLA finds multiple SCD30s it delays by 375ms before starting the second and subsequent ones. This is to try to de-sync their measurements so they are no all pulling maximum current at the same time. Jim: this should mean that the orange glow from the sensors should now be out of sync? Please let me know if that is true.

The new OLA code is in the release_candidate branch:

https://github.com/sparkfun/OpenLog_Art … _candidate

But I have updated the v1.9 BETA binary on the main branch with the latest code changes:

https://github.com/sparkfun/OpenLog_Art … r/Binaries

Jim: please give it a try and let me know if it solves your issue?

Paul: thanks again for all your help - much appreciated.

Best wishes,

Paul

Thanks for the update! I will try it this week and let you know.