Zumo v1.2 L3G20H issue

Howdy All,

I’ve been trying to recreate Brian Douglas’ rudimentary control algorithm for a Zumo Robot with a L3G gyro sensor, but I’ve been running into problems with the gyro-- it seems that it’s registering an angular input about the z axis of the robot, even when it’s completely still. When I ran his code (which can be found at 10:25 of this YouTube video Robotic Car, Closed Loop Control Example - YouTube), the Zumo would spin its left tread (wrt to a top-down view of the robot pointing forward) at a greater rate, which seemed wack.

I investigated further by running a code that’s supposed to show a graphical input for each axis of the sensor, and when I ran that, it seemed that the sensor registered an input about the z-axis. Here’s the link to that set of code (Quick-and-dirty IMU Sensor Graphing · GitHub), as well as a screenshot of my serial monitor while I was running the test.

Does this seem fishy, and is there any way I can fix the gyro? I’m new to all of this coding business. Thanks!


In general, it’s common for gyros like these to have some zero-rate offset that needs to be calibrated and compensated for to get the best results. Could you try running the “Serial” example from our L3G library and pasting a sample of its output here (with the Zumo stationary)? That should make it easier to see what the gyro is doing and whether its zero-rate level is typical or if there’s something else going on.


No problem. Here’s a snippet of the output from the “Serial” example. Does this seem normal?

With the default full scale of +/- 245 dps, a raw value of 600 translates to just over 5 degrees per second, and the L3GD20H is specified to have a typical zero-rate level of +/- 25 dps, so I think that is normal.

As I mentioned, you might look into doing calibration and offset correction to improve your results. We don’t have any examples showing how to do this for the Zumo Shield/Zumo Robot for Arduino, but we have some examples for the similar Zumo 32U4 robot. The general approach is to spend a few seconds at the beginning of the program averaging some stationary readings to determine the offset, then subtract the offset from subsequent readings.


Great; I’ll give it a wack. Thanks!