I am doing a project which require an mpu9250 accelerometer to be connected to a Raspberry pi. Both are kept at a distance of 20m apart. What is the easiest way of data transfer without losses?

  • Ah, let me see. MPU9250 talks I2C, so you start with 30cm long I2C wires. If everything goes well, you can extend the wires to 60cm. Usually the impedance reaches the limit of 400pF, and logic signal becomes distorted and noisy,and you start getting transmission error messages Then you can consider using I2C buffers and extenders. If you start with level shifters to talk at 5V, then you can do better. But the whole project is very tricky, not for the faint of heart newbies. – tlfong01 Feb 16 '20 at 14:05
  • I would suggest newbies be humble, forget 9-DOF, and start with 2-DOF, perhaps using 3-DOF ADXL345 accelerometer. The good thing with ADXL345 is that you can use either I2C or SPI. SPI can talk louder over longer distance, so you have a second chance when you decide to give up I2C, the learning curve of which is much steeper than SPI. Good luck and cheers. – tlfong01 Feb 16 '20 at 14:08
  • I have tried MPU 6050 and ADXL 335. But MPU9250 was better and easier to calibrate. Which way would be easier for a newbie like me, going the wireless way with Esp32 or wired way using extenders or any other wireless communication protocols? – EspPiProject Feb 16 '20 at 17:24
  • 1
    I²C is designed for short distance inter chip communication preferably on the same board. – Milliways Feb 16 '20 at 21:21
  • Ah, sorry, I might have misunderstood you question which you did not specify wired or wireless, not to mention if I2C is a requirement. So I would suggest to look at the big picture first. I have roughly introduced the stumbling blocks of I2C. Perhaps we can sit back to stare at the big picture, and also into the future. I am glad that you suggested ESP32, not the no future ESP8266-12. ESP32 or not, and if ESP32, NodeMCU LUA, which has a very steep learning curve (if not eating can food), or MicroPython, which is only for "small" projects, ... – tlfong01 Feb 17 '20 at 1:32

why not use RS485 or RS422 as transfer layer. it will be more reliable, I think wireless can not ensure the stability, if your application has request on that, it's not a good idea. what you need is design a adaptor transfer message from i2c to uart or vice versa.



It is basically axiomatic that can't achieve "without losses". The best you can do is reduce them.

Have a CPU local to the MPU9250 that reads the data. Read it repeatedly to ensure you got the right values. (Drat. I forgot to do this! Time to consider more updates.)

Use a communication link between the local CPU and the controlling PI that uses at least CRC32 for error detection, and includes receipt confirmation and retransmission.
(Note that Ethernet and WIFI both do the former, and TCP does the later. This can simplify implementation. But don't feel yourself restricted to these protocols.)

Finally, if you are really paranoid, use redundant devices: two (or more) MPU9250s, local CPUs, power supplies, and communication links. If you are really really paranoid, even redundant PIs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.