Go Down

Topic: L3G4200D needs constant reset [UPDATE - uncommunicative supplier] (Read 2 times) previous topic - next topic


Jun 27, 2013, 09:31 pm Last Edit: Jul 16, 2013, 10:58 am by acboother Reason: 1
Having done more tests on the whole device a GY-80 I'm convinced it is faulty. Okay so it happens. Have been trying to contact the eBay supplier but they don't reply... I should have looked more closely at the feedback :(

I know there is a risk with eBay but I also buy without problems as well from eBay. I will give them a bit longer to respond.

If I don't get a positive response from them do you think I should post the supplier's details so other people can be aware? I already posted a positive feedback on their eBay site because it turned up reasonably quickly etc etc... should have tested first :(

I have an L3G4200D that needs constant resetting because it 'sticks' on producing the same output irrespective of input.

I have little test rig to spin the gyro and the code is using the I2C interface. The values seem to be okay until I spin the gyro at high speed. It then outputs the same the values even though the rotation has changed/stopped. Here are two sets of values -3202, 294, 3845 and -3818, -678, 4088 for X, Y and Z rotations. You can see they don't stick at the same values.

I can get the gyro working again by having an initialization routine called and off it goes again. This doesn't seem like proper behaviour for a gyro. Can anyone advise. Is anymore information wanted?

Cheers Alan


What is spinning at high speed ?
If you hold it in your hand, you can achieve only very little spin.
If you hit it on a table, the g-forces are no problem for most sensors.

A few basic questions:
- Which Arduino board are you using ?
- How did you connect the sensor, at 5V or 3.3V ?
- Which library did you use ?


I can't tell you actual RPM but its 'finger spinning fast' = pretty speedy :)

Using 3.3v
Arduino Mega2560
Code is not using a library apart from 'Wire'. Essential elements taken from a number of sources.

Basic set up from Sparkfun/Jim Linblom

Code: [Select]
void GyroSetup(int scale){
  //From  Jim Lindblom of Sparkfun's code

    // Enable x, y, z and turn off power down:
  writeRegister(GyroAddress, CTRL_REG1, 0b00001111);

  // If you'd like to adjust/use the HPF, you can edit the line below to configure CTRL_REG2:
  writeRegister(GyroAddress, CTRL_REG2, 0b00000000);

  // Configure CTRL_REG3 to generate data ready interrupt on INT2
  // No interrupts used on INT1, if you'd like to configure INT1
  // or INT2 otherwise, consult the datasheet:
  writeRegister(GyroAddress, CTRL_REG3, 0b00001000);

  // CTRL_REG4 controls the full-scale range, among other things:

  if(scale == 250){
    writeRegister(GyroAddress, CTRL_REG4, 0b00000000);
  else if(scale == 500){
    writeRegister(GyroAddress, CTRL_REG4, 0b00010000);
    writeRegister(GyroAddress, CTRL_REG4, 0b00110000);

  // CTRL_REG5 controls high-pass filtering of outputs, use it
  // if you'd like:
  writeRegister(GyroAddress, CTRL_REG5, 0b00000000);

I'm checking the status register as well to see if I can find anything useful but nothing I can identify yet.

Have noted that the propensity is dependent upon Serial speed - more likely at lower ie 4800 that 115200. Also a delay in the loop of 50 millis reduces it.

Cheers Alan


After a period of inactivity I picked up the kit and spun it and the 'sticky' values are around these -32768   32752   -32534... Hmmm


I have not heard of the values sticking to the min and max.
So it might be the wiring or the sketch.
You use interrupts ?
Perhaps you can make a new minimal sketch, that does only the basic things.
It is very common (for me) to use about 4 or 5 different sketches to get something working.

The Mega has onboard 10k pull-up resistors on the SDA and SCL lines to 5V. That will lift the levels of the I2C too high for the sensor. Could you use an Arduino Uno or Arduino Leonardo ?
Or perhaps you should use an I2C level shifter.

This seems nice clean code, but the author writes about random values, http://bildr.org/2011/06/l3g4200d-arduino/

Go Up