I have a SparkFun's Openlog Qwiic connected to an Adafruit BNO055 sensor and an Adafruit QT PY (a basic SAMD21 chip).
All are linked through the I2C Qwiic / stemmaST connectors.
I can log data but I get random characters missing when I look at the log file.
Just for reference …. The sensor outputs the data to the serial monitor perfectly.
By my own admission .... I'm the worst coder and relatively new at this so any help / guidance much appreciated.
The attached code has been adapted from others sketches.
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BNO055.h>
#include <utility/imumaths.h>
#include "SparkFun_Qwiic_OpenLog_Arduino_Library.h"
OpenLog myLog; //Create instance
int ledPin = LED_BUILTIN; //Status LED connected to digital pin 13
Adafruit_BNO055 bno = Adafruit_BNO055(55);
void setup(void)
{
pinMode(ledPin, OUTPUT);
Wire.begin(); //Initialize I2C
myLog.begin(); //Open connection to OpenLog (no pun intended)
Serial.begin(9600);
Serial.println("Orientation Sensor Test"); Serial.println("");
/* Initialise the sensor */
if(!bno.begin())
{
/* There was a problem detecting the BNO055 ... check your connections */
Serial.print("Ooops, no BNO055 detected ... Check your wiring or I2C ADDR!");
while(1);
}
delay(1000);
bno.setExtCrystalUse(true);
}
void loop(void)
{
/* Get a new sensor event */
sensors_event_t event;
bno.getEvent(&event);
/* Display the floating point data */
Serial.print("X: ");
Serial.print(event.orientation.x, 4);
Serial.print("\tY: ");
Serial.print(event.orientation.y, 4);
Serial.print("\tZ: ");
Serial.print(event.orientation.z, 4);
Serial.println("");
/* Log the floating point data */
myLog.print("X: ");
myLog.print(event.orientation.x, 4);
myLog.print("\tY: ");
myLog.print(event.orientation.y, 4);
myLog.print("\tZ: ");
myLog.print(event.orientation.z, 4);
myLog.println("");
myLog.syncFile();
delay(100);
}
Just tried the appendfile sketch on its own and there is def something amiss.
Its only recorded fragments of what it should have.
This is all that was logged ....
In the sparkfun hookup guide under "troubleshooting" it does mention sticking a small delay in between the serial.print lines but from what you suggest you don't think this is needed ??
I may have found the issue ...... after posting (and then quickly deleting) about how a processor swap had no effect on the problem ..... I'm retesting again with an older UNO R3 to see if I was wrong.
I can get a chain of sensors (adxl375, bno055, bmp390) all connected to the Qwiic OpenLog and then to an UNO r3.
It all works perfectly on the r3 - logs data, records it to the sd card - no losses of data issues whatsoever.
I need to add gps to the mix which then creates a sketch too large for the diminutive memory of the r3.
I have tried with the long list of other processors - Adafruit QT PY M0 (SAMD21), Adafruit QT PY (rp2040), SparkFun thing Plus Artemis (Apollo3 cortex M4), Adafruit ItsyBitsy M4 (SAMD51) - and nothing works properly
I still get random data loss when writing to the sd card.
If anyone has ANY suggestions for boards that actually work with the Qwiic OpenLog - please can you post them here.