Pages: [1] 2   Go Down
Author Topic: L3G4200D needs constant reset [UPDATE - uncommunicative supplier]  (Read 1645 times)
0 Members and 1 Guest are viewing this topic.
UK
Offline Offline
Full Member
***
Karma: 13
Posts: 241
pt
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

[UPDATE]
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 smiley-sad

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 smiley-sad
[/UPDATE]

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
« Last Edit: July 16, 2013, 03:58:51 am by acboother » Logged

sig

Offline Offline
Edison Member
*
Karma: 58
Posts: 2078
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 ?
Logged

UK
Offline Offline
Full Member
***
Karma: 13
Posts: 241
pt
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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:
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);
  }
  else{
    writeRegister(GyroAddress, CTRL_REG4, 0b00110000);
  }

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

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
Logged

sig

UK
Offline Offline
Full Member
***
Karma: 13
Posts: 241
pt
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

sig

Offline Offline
Edison Member
*
Karma: 58
Posts: 2078
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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/
Logged

UK
Offline Offline
Full Member
***
Karma: 13
Posts: 241
pt
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'll try a UNO tomorrow.

My code is essentially the same as in http://bildr.org/2011/06/l3g4200d-arduino/ which is basically a loop that reads the gyro and prints out the values - I think my code has come from basically the same source. Can't make it any simpler.

The problem is observed when all three sensors 'stick'. There are occasions when consecutive readings produce the same as the previous loop but its not that often (thanks to the 'noise'/chaos that's happening) but I do some checks to see how many loops that the readings don't change and it is obvious when something has gone wrong.

I don't have an issue with a sensor maxing out but it should recover on its own.


Logged

sig

UK
Offline Offline
Full Member
***
Karma: 13
Posts: 241
pt
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Okay, tried the UNO and same problem.
Logged

sig

Offline Offline
Full Member
***
Karma: 2
Posts: 213
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tested the sensor recently with sparkfuns SPI-based sketch on a Arduino nano. I've experienced a lot of sensor drift, but never a lockup.
SPI uses the Int2 ( labelled DR on my board ) .


 

* L3G4200D.rar (38.29 KB - downloaded 13 times.)
Logged

It's not my fault when my Posts are full of Errors. This stupid autocorrection from my browser is set up for german grammar.

Offline Offline
Edison Member
*
Karma: 58
Posts: 2078
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

acboother, I have no idea what could be wrong.
You could try another sensor. Perhaps this one is broken (I don't think that is likely).
Could you post a link to the sensor breakout board you have, or make a photo of it ?
Logged

UK
Offline Offline
Full Member
***
Karma: 13
Posts: 241
pt
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is the link to the eBay purchase...

http://www.ebay.co.uk/itm/140987205970?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649

I am reluctant to spend nearly £17 just to find out if the sensor is faulty smiley-sad
Logged

sig

Offline Offline
Edison Member
*
Karma: 58
Posts: 2078
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is more information about the GY-80, http://www.uctronics.com/gy-80-bmp085-axis-magnetic-acceleration-gyroscope-atmospheric-pressure-module-p-1493.html

That one has a voltage regulator and I2C level shifters and pull-up resistors for the I2C.
So there is no problem connecting it to a Uno or Mega.
When connected to the Uno or the Mega, use 5V for VCC_IN.
Don't use the VCC_3.3V.

Can you run the i2c_scanner for an hour or so ?
http://playground.arduino.cc/Main/I2cScanner
If that is stable, it might be a damaged sensor.
If you accidently have connected the VCC_3.3V pin to 5V, that could damage it.
Logged

UK
Offline Offline
Full Member
***
Karma: 13
Posts: 241
pt
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote

I can't see what additional information this link supplies. Can you tell me what I missed?

I don't think I've mis-connected the 3.3 and 5v

How does running the scanner for an hour successfully show or not the correct functioning of the device. What would I be looking for in the scanner output? Obviously I'm not going to log and look through 1 hours output so I would filter the output to something useful - what would that be? I'm thinking of the simple i2c_scanner.pde that just tries to find the devices with

Code:
    Wire.beginTransmission(address);
    error = Wire.endTransmission();

The other devices on the breakout board seem to be fine (accel, compass, pressure). I'm beginning to favour that the gyro device is faulty in the absence of some rational explanation as to why 'sticking' is working as designed (albeit not what I would design it to do). What do others think?
Logged

sig

Offline Offline
Edison Member
*
Karma: 58
Posts: 2078
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The page in the link has a schematic.

I mentioned the i2c_scanner to test the I2C bus.
If the other sensors are okay, the I2C bus is probably good.

It seems indeed that the sensor has a problem.
You could buy another one to compare.
http://www.ebay.com/sch/i.html?LH_BIN=1&_sop=15&_from=R40&_sacat=0&_nkw=L3G4200&LH_PrefLoc=2

I don't know what tests you could do to determine if it is faulty or how to fix it. Sorry.

The MPU-6050 is cheaper, but it is a complicated chip. If software and using libraries is no problem for you, you could use the MPU-6050 with the I2Cdevlib.
http://www.i2cdevlib.com/
Logged

UK
Offline Offline
Full Member
***
Karma: 13
Posts: 241
pt
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Poor old device seems unwell smiley-sad
Logged

sig

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I had the similar problem, due to accidentally enabling the sleep mode due to improper conversion from binary to hex. Be very carefull to check that you are setting the registers that controll the power management functions by reading the datasheet sections on the ctrl_regX.
Logged

Pages: [1] 2   Go Up
Jump to: