I am trying to get my new OpenLog device working, and it logs data only intermittently. Below are the bulleted facts for easy reading.
42,26,3,0
i2c_address,escape,esc#,mode
Any ideas are much appreciated.
I am trying to get my new OpenLog device working, and it logs data only intermittently. Below are the bulleted facts for easy reading.
42,26,3,0
i2c_address,escape,esc#,mode
Any ideas are much appreciated.
Hi Aaron,
I have a couple of quick suggestions here. First, I am a bit confused by your description of the STAT LED. Are you sure you are looking at the correct LED? The STAT LED should be green and will blink when the SPI interface is active so you should only see it blink on startup and when a log is created. If your STAT LED is red then something else is going on here and photos of that would be very helpful.
Next, the BrandX Card is not going to be a very reliable card for logging since it is Class 4 and its transfer speeds only go up to 4 MB/s. Do you know what Class your SanDisk card is? The OpenLog works best with Class 10 cards like [this but can work with anything down to Class 6 cards.
Finally, the issue might just be trying to write data to the card too quickly. Depending on what all you are logging, you may want to add delays in your code like we demonstrate in the [Troubleshooting section of the Hookup Guide.](Qwiic OpenLog Hookup Guide - SparkFun Learn)](microSD Card - 16GB (Class 10) - COM-15051 - SparkFun Electronics)
I apologize for the confusion. It was the red power LED, not the status LED I was referring to. I have a few more questions:
I think I have the problem solved. I added a 1 second delay immediately at startup, and then another 2 second delay on a command to the I2C bus to my display before initiating the OpenLog. I think there was a race condition of some sort on the I2C bus on start-up. If I insert the card before power-up and power down before removing the card, everything seems happy with those delays added (for now).
#include <Wire.h> //I2C Library
#include <SerLCD.h> //Serial LCD Library
#include "SparkFun_Qwiic_OpenLog_Arduino_Library.h" //Data logger library
#include <SparkFun_RV1805.h> //RTC Library
SerLCD lcd; //Initialize the library with default I2C address 0x72
OpenLog myLog; //Initialize data logger
RV1805 rtc; //Initialize real time clock
const int windRawADCInput = A0; //Sensor wind analog output to board analog input pin A0
const int tempRawADCInput = A1; //Sensor temperature analog output to board analog input pin A1
const float tempCoef = 0.0195; //Temp sensor coefficient, volts per degC
const float temp0C_V = 0.400; //Temp sensor voltage at 0deg C
const int zeroWindRaw = 416; //Value determined experimentally
uint8_t lastSecond = 60; //Initialize the seconds compare variable as something that will always be !=
void setup() {
delay(1000); //Start-up delay makes things run more consistantly
Wire.begin(); //Join I2C bus as master
lcd.begin(Wire); //Initialize LCD display on I2C
lcd.clear(); //Clear the display - this moves the cursor to home position as well
lcd.setBacklight(255,150,150); //Set backlight to bright white
rtc.begin(); //initialize RTC
//Output on LCD that initializations are complete
lcd.print("OpenLog Start");
delay(2000);
myLog.begin(); //Open connection to OpenLog
Hi again Aaron,
That’s good to hear adding a couple of delays fixed the issue for now. Let us know if it crops up again and we can troubleshoot further. As for your other questions, I will answer them below:
What happens if I power down or eject the card in the middle of a write?
When does the config.txt get written?
Does config.txt get written by the RedBoard, or by the OpenLog board?
Which command do I use to poll the OpenLog to check that it is reading the card OK (not flashing red LED 3 times)?
I hope this answers your questions thoroughly. As always, if you run into any other issues or have any other questions about the Qwiic OpenLog, let us know and we would be happy to help as much as we can.