Go Down

Topic: i2c speeds, buadrates, and bottlenecks - double check my thinking? (Read 464 times) previous topic - next topic

titous

hey everyone!

I'm working on a project that will have several (on the order of 12) Arduino Mini Pro (5V/16MHz) boards measuring orientation data through a 6DOF IMU chip and all connected through a i2c bus; I plan on having a master Arduino (such as a teensy) be the one that collects all the i2c data and sends it through serial to a computer.  I'm trying to run the numbers to make sure I'm not running into any bottlenecks, and I was hoping someone could double check my logic.  Here goes:

1 - the orientation IMU samples at 100Hz and spits out a 42-byte buffer with the info for each sample ( see lines 120-128 of https://github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/MPU6050_6Axis_MotionApps20.h)
2 - my mini pro processes this 42-byte buffer and sends it down the i2c bus as a 14-byte packet - here i'm assuming it can do it as fast as it's receiving data: 100Hz (so does it make sense that it's sending data down at 14 * 100 = 1.4 kbyte/s?)
3 - my i2c bus is running at an ~ideal 400 kbit/s = 50 kbyte/s
4 - so if I have 12 boards running the IMUs does that mean I'm sending 12 * 1.4 = 16.8 kbyte/s down the bus?
5 - if i'm still correct, does that mean i can send data from the master Arduino to the PC at a baud rate of 16.8 * 8 = ~135baud without causing a bottleneck?

Granted, all of these are ideal conditions, but I'm wondering if the reasoning and calculations are right.  Thanks for the help everyone!

Graynomad

I'll run some numbers and see if it seems to work out. I'll look at it from the time angle.

Every 10mS you send 14 bytes (say 140 bits) at 400kbps, that takes .35mS, so far so good.

12 boards means .35 x 12 or 4.2mS

Let's round up to 5mS to allow for overheads in the I2C protocol.

So in a nutshell every 10mS you have 5mS of data transfer.

That leaves 5mS to do other stuff. Sounds ok on the face of it so far, but then there's the serial link to the PC.

Assuming the same 14 bytes are sent up, 14 bytes  x 12 = 168 bytes or 1680 bits.

At 115200bps that's 8.7uS per bit or 14.6mS...oops you need to do that every 10mS.

So it looks like you have to up the PC link speed, or reduce the data being sent. Is it still 14 bytes per IMU at this stage?

Please apply a sanity test to the above, it wouldn't be the first time I was a decimal point out.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

titous

Thanks Rob!  Your reasoning makes sense and in all actually I think we came up with the same rough values.  The only place I went wrong was the last step:


5 - if i'm still correct, does that mean i can send data from the master Arduino to the PC at a baud rate of 16.8 * 8 = ~135baud without causing a bottleneck?


I dropped the 'kilo' on that calculation; the correct value should have been 135kbps instead of 135bps

I think I'll have to look into feeding the i2c feed directly into the PC & sending a smaller byte package across.  Thanks for the help!

Go Up