IMU stops working

Duh, herro !

And welcome myself to this amazing world of Arduino.

So I know just about nothing about electronics, but I'm reading a couple of books and I already can do some cool stuff like controlling leds and servos.

So for my next project I bought a 6-DOF IMU : www.sparkfun.com/products/10121

I'm following this tutorial:

http://bildr.org/2012/03/stable-orientation-digital-imu-6dof-arduino/

and I've come to what seems to be a serious problem that I can't quite solve yet:

The IMU stops working after a few seconds, it stops more often than not when I move it around, so my guess is that my wiring is flawed and the unit can't get back online once it loses a connection.

Could that be the reason? It would seem odd to me that it just doesn't magically keep sending the signal, but what do I know right?

If this is the case, is there a function that I could call to get it back online?

Also, what piece of hardware ( needles, pins ? ) do I need to get to prototype with ? What do I call them at the counter ? So I can get a reliable wiring.

Hope you guys can help me, and tty soon.

Oh! I'm using the Arduino Leonardo.

Most of the time it will work, but using it like that is outside the specifications of the datasheet.
The Leonardo is a 5V Arduino board, and the sensor are 3.3V with a 3.3V I2C bus. Using I2C level shifter is better.

Can you run the i2c_scanner for a while ? It should run without problem.
http://playground.arduino.cc/Main/I2cScanner

Thanks, quick question though while I try to test the scanner:

Do you have a link that I can follow to get the proper setup ?

The Leonardo has SDA and SCL at the end of the long header, near the usb connector.
The same SDA and SCL are at pin 2 and 3.

This differs from the Arduino Uno, which has them at A4 and A5.

Connect 3.3V to 3.3V
Connect GND to GND
Connect SDA to SDA
Connect SCL to SCL
Don't use the INT0 and INT1 yet. If you need those, you have to find an interrupt on the Leonardo board, and perhaps change the code to use that interrupt.

Oh no, sorry. I had already found out that the Leonardo had those SDA and SCL at a different position, thanks to the guy who wrote the tutorial. So I already had those connections:

3.3V to 3.3V
GND to GND
SDA to SDA
SCL to SCL

So my original questions still stand right ?

I'll test the scanner as soon as I finish off work.

edit: I meant my wiring might be flawed because it's not tight enough, hence me asking for some kind of attachment to make it more secure.... Sorry, english is not my first language.

I don't understand how you connect the wires. Could you make a photo of it ?

I use either a breadboard, or I solder the wires.
Some very cheap breadboards have bad contacts. I assume that Adafruit selected a good one : Half Sized Premium Breadboard - 400 Tie Points : ID 64 : $4.95 : Adafruit Industries, Unique & fun DIY electronics and kits

There are special wires for breadboards. I didn't have enough of them, so I used single-core wires of a telephone cable, as you can see in the attached picture.

air-cushion.jpg

Excuse the poor lighting. Please check the pics.

I just found out that it doesn't stop working when I temporarily remove a connection, but rather when I move the unit. ;(

last 2 pics

Thanks for the photos.
The Arduino board and breadboard are okay.

The wires to the module are not okay. Could you solder them ? Or solder a strip of pins to them. Then you can press the pins directly into the breadboard. Or use wires with clips.

If soldering or clips are not at hand, perhaps you can stick tooth picks firmly in the holes with the wires.

Tooth picks !!! Sounds like a plan.

I really rather not solder cause I'm just testing for the moment.

So I finally ran the i2c scanner, very useful !

It looks like when I move the module around it sometimes can't find it, but in the next iteration it does.

Is this known to happen ? Could this mean that it might be damaged ?

Maybe I can detect when it stops working and unfreeze it by running

Wire.endTransmission();
Wire.beginTransmission(address);

It should never stop. That is probably still a bad contact between the wire and the module. There is a small chance it requires a level shifter.
The actual sensor values has no influence on the i2c_scanner.

Hmm. I'll sum up some facts to help put it in perspective.

  • If I disconnect a wire and put it back the system keeps working.
  • If I disconnect the ground the system keeps working while disconnected ( !!!! WTF )
  • The system seems to freeze if I move the IMU around. Some times I have to hold the reset button to test again
  • When I run the I2C scanner it detects the unit most of the time, even when I move it around, except when one time I set the delay to 10 milliseconds, it froze.
  • I'll get some toothpics ASAP

Thanks a lot for your patience and help, much appreciated.

Perhaps three different things are going on.

The i2c_scanner should always detect it. If that is not 100% okay, you don't even have to try a sketch or library.
Can you get a I2C level shifter ?
Could you measure the 5V and 3.3V pin ? To detect the levels of a 3.3V I2C bus, the voltage of the 5V pin should be a little lower and the 3.3V should be a little higher.

Disconnection the ground and it still works ? That is not very weird. Those sensors use very little current, and I assume that the low level of the I2C bus via the sensor to the GND of the sensor might make it work.

Perhaps there is a bug in the sketch or library that you use. Or perhaps more data is requested when you move it around. That is hard to say if the i2c_scanner it not working 100%.
There is a lot of bad code. For good code I first check if Adafruit or i2cdevlib supports a sensor. They have good libraries and they maintain the libraries.