Sparkfun IMU Shield Default Code Not Working

Hello and thanks for any help you can offer:

I am trying to get the default code for the SparkFun IMU Shield to run on my Photon.

The frustrating thing is that it DID work once but never again… : (

Here is what I can report:

  • I have the Photon mounted (correctly) on top of the IMU shield…
  • USB from my mac laptop (which is plugged in).
  • Photon is online and works with other sketches no problem (like blink LED)
  • I have the latest firmware (4.9)
  • I load LSM9DS1_BASIC_I2C
  • Code seems to flash onto device OK
  • Photon breaths blue 5 times
  • Then Photon breathes green
  • Serial port reads:

Failed to communicate with LSM9DS1.
Double-check wiring.
Default settings in this sketch will work for an out of the box LSM9DS1 Breakout, but may need to be modified if the board jumpers are.

I see all this in the code but I am stumped…

I have also tried providing power to the the IMU shield from my Arduino just in case the USB isn’t providing enough power but no luck…

Thanks again,

Sam

Can you try the SPI sample?
Just in case at some point you altered the jumpers.


Just tested the code on my own Photon 0.4.9 and IMU set for I2C and it works just as expected, so it’s not the library sample.

Hi,

Thanks for replying! I did just receive this and I haven’t made any modifications to the board.

I tried loading the SPI code (from Github)

The board now does NOT switch from breathing blue to green - it stays blue!

However - the serial monitor still reports:

Failed to communicate with LSM9DS1.
Double-check wiring.
Default settings in this sketch will work for an out of the box LSM9DS1 Breakout, but may need to be modified if the board jumpers are.

Thanks,

Sam

Does anyone else have any ideas?

I have spent hours and hours trying everything I can. I even bought two different SparkFun ADXL breakout boards and tried hooking them up to the Photon bit no luck.

In those cases the board always returned 0,0,0 on the serial port. However the photon breathed blue the entire time.

Back on the SparkFun IMU Photon IMU shield I still keep getting the same error:

Failed to communicate with LSM9DS1.
Double-check wiring.
Default settings in this sketch will work for an out of the box LSM9DS1 Breakout, but may need to be modified if the board jumpers are.

If anyone has any ideas I would be so grateful!

Thanks,

Sam

The person in this thread here had a very similar experience and ended up switching to Arduino. I REALLY want to stay with the Photon as I need the easy web connectivity.

I don’t understand how to even test the board. I have a simple digital multimeter but that’s it.

I am powering from a usb port on my macbook laptop.

Are there any tests I can run?

Thanks for any help!

Sam

I’ve no idea what can be wrong there.
I tooe my two boards, plugged the preprogrammed (with unaltered I2C sample) Photon in, plugged the Photon into my PCs USB port and off it went.

So my only suggestions left are rather stupid and might seem insulting (sorry, but I can’t see any other options :blush:)
Double check that the Photon is plugged in correctly.
Try a different USB port and/or PC.
Shoot a photo of your setup and post here.
Have you got another Photon to try?
Have a test on the I2C pins (D0/D1) if they still work as standard D pins.
You don’t happen to have a Particle Internet Button (which also sports an ADXL), to test your Photon?

I know how frustrating this must be, so we do want to get you out of this pickle.

@Samsterism, the IMU board is setup for I2C by default so trying SPI code will not work UNLESS you have modified the board. Did you?

I also have one of these shields so I will test with the latest firmware. One thing I usually do when I have I2C problems is first check that there are pull-ups on the I2C lines. The IMU board has them so that should be ok. Second, I run an I2C device scanner to make sure the addresses used in the library are actually the correct ones. This also tells me if the device can be “seen” on the bus. You can find some scanner code here:

What are you developing with - web IDE, Particle CLI or DEV? I should be able to test tonight and report my findings. :wink:

1 Like

He tried SPI because I asked him to (just in case the setup had been changed ;-))

1 Like

Hi All:

Thanks very much for your continued help!

I just ran the IC2 scanner from the Arduino site and it returns:

Scanning…
No I2C devices found

The Photon is breathing blue after running this code.

I am using the web IDE at build.particle.io

I am using CoolTerm on a MacbookAir to make the serial connection.

I have managed to get the particle CLI working through Terminal.

My setup is just the IMU shield mounted on a breadboard and the Photon on top with a set of breakaway headers on either side connecting the two:

Thank you again for your help!

Sam

I would start by soldering the Photon to the breakaway headers to ensure a good electrical connection. This is more than likely your issue.

2 Likes

Also - I should say that the Arduino code when I cut and paste into the web IDE has an include at the top:

#include <Wire.h>

When I cut and paste this into the Web IDE I get this error on verify:

ic2scanner.cpp:30:18: fatal error: wire.h: No such file or directory

So then I searched for “Wire” in the libraries part of the IDE and found OneWire

I opened that and found OneWire.h and included that in my sketch so it now says:

#include "OneWire/OneWire.h"

I don’t know if that was right… (Sorry - I’m a real beginner with this).

Thanks

OK - I will try soldering them on. I obviously should have just ordered the photon with the headers already on! Rookie mistake.

I’ll report back - thanks

@Samsterism, I had given you a link to working code!! The Wire library is included in the Particle firmware and dosen’t need to be included like Arduino. The OneWire library has nothing to do with Wire so you can remove that.

As @joe4465 pointed out, you cannot expect a board with headers to work without soldering those headers. Make sure you place the short side of the header pins UNDER the board and solder the pins on the TOP side of the IMU board and NOT the bottom side. The way you have the headers in your pictures is incorrect.

Here is the code I had linked to, just to be sure we are testing with the same code:

// --------------------------------------
// i2c_scanner
//
// http://playground.arduino.cc/Main/I2cScanner
//
// Version 1
//    This program (or code that looks like it)
//    can be found in many places.
//    For example on the Arduino.cc forum.
//    The original author is not know.
// Version 2, Juni 2012, Using Arduino 1.0.1
//     Adapted to be as simple as possible by Arduino.cc user Krodal
// Version 3, Feb 26  2013
//    V3 by louarnold
// Version 4, March 3, 2013, Using Arduino 1.0.3
//    by Arduino.cc user Krodal.
//    Changes by louarnold removed.
//    Scanning addresses changed from 0...127 to 1...119,
//    according to the i2c scanner by Nick Gammon
//    http://www.gammon.com.au/forum/?id=10896
// Version 5, March 28, 2013
//    As version 4, but address scans now to 127.
//    A sensor seems to use address 120.
// 
//
// This sketch tests the standard 7-bit addresses
// Devices with higher bit address might not be seen properly.
//

void setup()
{
  Wire.begin();

  Serial.begin(9600);
  delay(10000);
  Serial.println("\nI2C Scanner");
}


void loop()
{
  byte error, address;
  int nDevices;

  Serial.println("Scanning...");

  nDevices = 0;
  for(address = 1; address < 127; address++ ) 
  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();

    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.print(address,HEX);
      Serial.println("  !");

      nDevices++;
    }
    else if (error==4) 
    {
      Serial.print("Unknow error at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");
  else
    Serial.println("done\n");

  delay(5000);           // wait 5 seconds for next scan
}

:grinning:

1 Like

OK! Sorry to make such a rookie mistake - thanks so much for your guidance.

I just soldered it together (with the correct setup - thx!) and now everything is working.

Thanks again!

Sam

1 Like

@Samsterism, glad to hear it’s working!! If only every problem was that easy to fix :stuck_out_tongue:

That shows that a pic often helps finding issues noone would ever think of asking for, especially after

So I wasn’t too wrong to ask

1 Like