STM32F103 and Gyro ITG3200
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-03-21 10:00 PM
Posted on March 22, 2015 at 06:00
Dear all,
I am doing a project with the quadcopter. At this time, I can read the data of accelerometer ADXL345 exactly but the gyro sensor ITG3 I use I2C to communicate the sensors, and the results of ITG3200 changes over the time even it does not move. This is how I initialize the sensor, with the sampling rate is 100Hz.writeDevice(0xD0,0x15,0x09);//sample rate divider
writeDevice(0xD0,0x16,0x1B);//DLPF, Full scale
and this is how I read the data
data1 = RI2C(0x1D);
data2 = RI2C(0x1E);
data = (data2<<8)|data1;
Gx = data/375/100;
(Gx means the rotation around the x-axis, roll)
And the result is fluctuated a lot.
Could you have some ideas about this problem ?
Thank you so much.
My Skype ID is ngohoainguyen, you can contact to me if necessary.
This discussion is locked. Please start a new topic to ask your question.
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-03-22 7:59 AM
Posted on March 22, 2015 at 15:59
I believe you swapped the high and low bytes. Try this:
data = (data1<<8) | data2; Cheers, HalOptions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-03-23 7:55 PM
Posted on March 24, 2015 at 03:55 Thank Baird Hal. It's my mistake.
