United Kingdom
Asked — Edited

Questions With Reading From Gyro Using I2c

Hi I'm trying to integrate gyro data to give angle of rotation but am having difficulty getting a high enough sample rate. For instance I've tried timing how long the following line takes to execute using the Diagnostics.Stopwatch


System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch(); 
timer.Start(); 

byte gyro_xvalh = ezb0.I2C.Read(gyro,0x1D); // read from x value register address msb

timer.Stop(); // 
MessageBox.Show(string.Format("Elapsed time is: {0}", timer.ElapsedMilliseconds));


Its around 60ms which seems a long time, I'm running and compiling the test script from the c# script in ARC. I could really do with a much faster read time as I want to get as accurate rotation angle as possible.

If anyone knows what the limiting factors are that are resulting in this delay that would be a great help.

Thanks

Tom


ARC Pro

Upgrade to ARC Pro

Get access to the latest features and updates before they're released. You'll have everything that's needed to unleash your robot's potential!

United Kingdom
#9  

Ok I've just got an MMA7455 to check that its not an issue with my i2c device. A read from the x data register using the tutorial example is still taking 50ms so I guess thats as fast as I can expect? Whats the reason for this duration as I know using Arduino's etc you can get much faster readings in order to use gyro data properly?

PRO
Synthiam
#10  

On an Arduino, you program the microcontroller directly. With EZ-Robot, your computer speaks to the microcontroller over a wireless communication protocol - which introduces a delay.

There is a new firmware coming out with some enhancements to the i2c protocol. It will be quite a bit faster. Also, there is a new bluetooth module that will be on the store shortly with a faster communication speed.:)

Both of those will help you greatly:D