Go Down

Topic: L3G4200D Output Locks up after drop (Read 713 times) previous topic - next topic

bjosephs

High folks,


I have a Chipkit "PMOD" Gyro board that is basically just a breakout board for an L3G4200D.  I'm using it via I2C with an Aduino Mega as part of a balancing robot.  I am powering it from the 3.3vDC supply and I believe from the schematic that he inputs are 5v tolerant (zener diode clamps).  I've been using it for weeks (months) and noticed that after a while my robot would go haywire... I thought this was Gyro drift.... but I noticed during some tests last night that the output values of the sensor lock up after a sudden jolt (like what would happen when a balancing robot fails to "balance").  I've been using the code from http://bildr.org/2011/06/l3g4200d-arduino/.  Below is an example of the readout - you can see half way down the values that indicate me tilting the robot a bit and then letting is drop back into place.  After the drop the values lock up and never change.  If I reset the program the values are normal again until I give it another jolt.  The repeating values are never the same from test to test.  I believe I have interrupts disabled if anyone thinks that might be related... I'm open to theories.


Code: [Select]
starting up L3G4200D
X:19 Y:-138 Z:53
X:9 Y:-145 Z:59
X:8 Y:-148 Z:66
X:18 Y:-148 Z:36
X:6 Y:-146 Z:55
X:19 Y:-133 Z:51
X:20 Y:-146 Z:64
X:8 Y:-152 Z:56
X:5 Y:-160 Z:63
X:25 Y:-129 Z:55
X:17 Y:-147 Z:62
X:20 Y:-148 Z:66
X:18 Y:-139 Z:67
X:24 Y:-140 Z:42
X:19 Y:-143 Z:75
X:40 Y:-155 Z:61
X:16 Y:-193 Z:50
X:25 Y:-139 Z:49
X:26 Y:-135 Z:41
X:20 Y:-144 Z:51
X:25 Y:-144 Z:56
X:39 Y:-150 Z:49
X:22 Y:-161 Z:77
X:14 Y:-144 Z:77
X:36 Y:-135 Z:46
X:-3 Y:-130 Z:572
X:-76 Y:33 Z:300
X:-4969 Y:2750 Z:867
X:-5784 Y:2169 Z:1655
X:-752 Y:550 Z:-623
X:2702 Y:-655 Z:-2064
X:7136 Y:-3829 Z:-848
X:77 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552
X:-2227 Y:-3525 Z:1552



Thanks for any help!

Brian

Erdin

It seems as if you lost the I2C communication.

The 3.3V I2C bus might be too low for the Mega. Could you add a i2c level shifter to your circuit ?

bjosephs

Erdin,


Thanks for replying.  A level converter might take some doing but it's a starting point.  By the way, I have an accelerometer on the same I2C bus that also communicates at 3.3v.   When the Gyro fails the accelerometer keeps on delivering good data.  Does that change your assessment at all?



Brian

Erdin

Using a 3.3V I2C bus with a Arduino Mega is working most of the times, but not always.
The Mega is one of the older avr chips and it requires good signals.
Do you have 4k7 pull-up resistors from the I2C lines to 3.3V ?
The return value of some functions show if the I2C was okay. For example the endTransmission() returns an error. You could check those return values.

Go Up