Hello,
I’ve been working on getting my Photon to read acceleration and gyro data from an Addafruit LSM9DS0. Its wired up to D0 and D1 per this link. I’ve used the library through Build, but then have done most my work in particle dev.
With this configuration the Photon will startup and start logging through the serial monitor for a few seconds, then the cyan light quits “breathing” and stays solid. No more serial output occurs and the Photon appears offline in particle dev, build and the dashboard.
I followed this thread which suggests only the accelerometer will work. Changed the ino code to use lsm.readAccel()
and lsm.readGyro()
rather than the do-it-all lsm.read()
. In this configuration if I comment out the gyro call, the Photon will keep running and logging. If I add gyro back in, it hangs again.
I continued looking at the Adafruit_LSM9DS0.cpp code and noticed its begin logic:
bool Adafruit_LSM9DS0::begin()
{
if (_i2c) {
Wire.begin();
}
...
} else {
// Sofware SPI
pinMode(_clk, OUTPUT);
pinMode(_mosi, OUTPUT);
pinMode(_csxm, OUTPUT);
...
The _i2c
is set to false
by default. I found the constructor that sets it to true
which takes a sensor id. Per the Adafruit docs this is 0x40
(unless you’ve soldered the jumpers).
Under this configuration (using hardware SPI) I can gather both gyro and accel data without crashing for minutes instead of seconds.
Any help on how to make use of I2C and the LSM9DS0 board?