Parallax L3G4200D gyroscope with Arduino Due
chughtai538
Posts: 3
Hi
I'm working on an autopilot unit for fixed wing RC aircraft. I'm using the parallax L3G4200D to determine my angular rates, the board I'm using for the MCU, is the Arduino Due. I'm having trouble getting data from the gyro. My pin connections seem okay:
Gyro-->Due
SCL-->Pin 21(SCL)
SDA-->Pin 20(SDA)
Vin--> 5 V
GND--> GND
Im using the code for Arduino as posted here on the bottom of this page:
http://learn.parallax.com/KickStart/27911
Im getting a semi strange output in the Serial window. The rates seem correct when rotated in the CCW direction but when rotated CW, instead of getting a negative rate i get a rate in the range of 500-600 degrees/second.
Is anybody else having the same issue with this board? I've tried this sensor with the arduino uno and it works like a charm so the sensor itself is fine. Any help would be appreciated.
I'm working on an autopilot unit for fixed wing RC aircraft. I'm using the parallax L3G4200D to determine my angular rates, the board I'm using for the MCU, is the Arduino Due. I'm having trouble getting data from the gyro. My pin connections seem okay:
Gyro-->Due
SCL-->Pin 21(SCL)
SDA-->Pin 20(SDA)
Vin--> 5 V
GND--> GND
Im using the code for Arduino as posted here on the bottom of this page:
http://learn.parallax.com/KickStart/27911
Im getting a semi strange output in the Serial window. The rates seem correct when rotated in the CCW direction but when rotated CW, instead of getting a negative rate i get a rate in the range of 500-600 degrees/second.
Is anybody else having the same issue with this board? I've tried this sensor with the arduino uno and it works like a charm so the sensor itself is fine. Any help would be appreciated.
Comments
The Due is a 3.3V device. As noted on their pages*, it is not 5V tolerant. The specs say that the 4200D can be operated at 3.3V, so there is no need to operate it at 5V.
* The warning regarding I/O voltage is here:
http://arduino.cc/en/Main/arduinoBoardDue
Unfortunately, you may have already damaged your board. Try another circuit and sketch to check.
Should your board check out, you could try adding pullups to both I2C lines. Something on the order of 1.8K to 4.7K is often recommended.
So have I just damaged the i2C line on my Due? I don't think the pins 20, and 21 need pull ups, they have them built in
the module already have pull-ups? Should be possible to check with a hand lens if the schematic's ellusive.
If there's been damage to the Due it'll probably show up as problems with I/O 20 and 21 in general, so a basic LED and switch circuit on those pins might work. There are software I2C libraries for the Arduino if you'd like to try other pins. In any case, by your description of what's happening I don't think your Due was damaged. In the future, be sure not to apply 5V to any pin without level translation!
If there's an issue with the format of the return values, as ChrisGadd notes, it doesn't appear to happen on the Uno. Someone with a Due, which is based on a completely different chip than the AVR-based Arduinos (and therefore the Wire implementation may vary), will hopefully chime in. I don't have one to test.