Sparkfun IMU shield

Has anyone got the sparkfun IMU shield working with the sparfun library:

The library seems to be a couple of years old and refers to application.h rather than Particle.h.

The board (IMU and photon are both pre-soldered units). But when I use the sparkfun example code I just get “Failed to communicate with LSM9DS1.” sent to the serial comms.

I ran a scan of all I2C devices using some example code on this forum and that successfully identifies the two I2C devices on the IMU board, 0x1E and 0x6B.

Nope, I don’t have any problems with that shield and the library published on Build
I used this library sampel
which gave me these readings

>particle serial monitor --follow
Polling for available serial device...
Opening serial monitor for com port: "COM3"
Serial monitor opened successfully:
G: -1.34, -0.45, 2.29 deg/s
A: 0.53, -0.47, 0.67 g
M: 0.46, 0.03, 0.07 gauss
Pitch, Roll: -32.88, -35.21
Heading: 192.49

G: -2.47, -0.68, 3.72 deg/s
A: 0.53, -0.47, 0.67 g
M: 0.47, 0.04, 0.08 gauss
Pitch, Roll: -33.03, -35.39
Heading: 193.04

G: -2.44, -0.73, 1.62 deg/s
A: 0.53, -0.48, 0.68 g
M: 0.46, 0.03, 0.07 gauss
Pitch, Roll: -32.74, -35.17
Heading: 192.60

Just to make sure - although you already said you get the I2C addresses - all your jumpers are still in default (uncut) I2C setting?

Yes, totally out of the box for both the IMU and photon. No jumpers have been altered. I’ll try pulling down the library and example and running that directly, rather thanuse the GitHub version. The library I pulled was directly from GitHub. Do you know where this library (the one hosted on has come from and when it was last changed?

I’ve used v1.1.3 which is from here

When select a library in Web IDE (Build) you’ll usually get a GitHub icon near the library name. That’s the link to the origin.

Oh yes, I see it now. Actually that GitHub repo has more recent changes to the .cpp file than the one linked to on the SparkFun product website, so hopefully will be more successful.


That PR I filed there in Nov. 2015 mainly applied to SPI and should not change a lot or I2C.

Yeah, the code looks the same. However, when i use that library by referencing the hosted library, rather than bringing in code directly from github, it works. Possibly a failure to copy and paste, I’m not sure, either way it works now.


1 Like

@ScruffR, I have the same problem. I have a photon with well soldered headers, and brand new Sparkfun IMU shield out of the box. I ran an i2c scanner, which failed. When I push Basic_i2c.cpp, it in fact bricks my photon. I gotta flash the tinker again. Any inputs here? Thanks :slight_smile:

If you actually have the same problem I’d expect the outcome to be the same as for slicc :wink:

Can you provide an image of your setup?
It is possible that the shield has an issue. I once had one that was DOA for SPI but worked with I2C. Maybe yours is the other way round.
If you can try activating SPI and use that.

BTW, bricking would actually mean dead for good. If you can revive it by any means it’s not bricked :wink:

For me, both I2C and SPI give me “Failed to communicate” error. When I flash the I2C, the photon goes into this weird state (I’m not sure what it’s called), in which flashing a new program from cloud doesn’t change the program internally. For example, I flash try flashing Blink LED program, and I get back the “Failed to communicate” error on the serial monitor. The only work around I found for this was to do “particle --usb tinker”.

Can you post a higher resolution image of the bottom side of the shield. On the pic you posted there the solder jumpers look somehow oddly setup.

This is the default setup for I2C as it should come out the box

Sorry, my browser previously had done a bad job loading the image. I now see your image in hi-res. So scrap what I said.
However, in order to test SPI, you’d need to alter the jumper setup by cutting traces and soldering others.

Sure! Here you go. But these look pretty similar to me.

I’m no soldering expert, but sure I can try this. Can you further explain what cutting traces and soldering others?

If you can, measure the resistance between the middle pads of the SCL/SDA solder jumpers and D0/D1 and the resistance between D0/D1 and 3v3.
The former should be near zero and the later near 10k.
With the Photon plugged in and set in Safe Mode test the voltage at D0/D1. This should be at 3.3V.

Also are you using the online library provided via Web IDE or any other source?
What system version are you targeting?

The guide how to set the jumpers for SPI can be found here under "Setting Jumpers"

My photon’s running 0.63 and I’m using the online library provided by Web IDE (v1.1.3). I’ve also checked out the github library

Also, I had the same problem with 2 different photons. Do you think my shield’s DOA? Do you think I should a new shield?

I have several of these shields and all but one (as mentioned above) worked out the box without any software or hardware tweaks needed.
So it sounds like DOA. I’d get in contact with your dealer to get a replacement.

For that reason I usually order at least two of each kind (if not too expensive) to have a reference as two DOAs aren’t that likely.

Sure, I can try and return this. So ideally, I just fit in the shield, flash the basic I2C example from GitHub and I’m good to go right? Just wanna make sure I’m not missing something before I order/return.

That’s how it worked for me. Maybe make sure you flash the correct firmware - possibly with the Photon not plugged into the shield.