0
\$\begingroup\$

I am quite new to electronics , in my project I am trying to connect large number of MPU6050s(about 10 sensors) I2C devices and try to get the reading 'simultaneously'.

Some questions that I am not very clear:

  • Someone suggested that the device address will be problem but someone doesn't, which only two device address is possible to use (HIGH and LOW).If device address won't be a problem how I connect them?

I have search the solution online but I am still not quite clear of how to do it, and I got an simple (might be silly) idea of how to approach it however I thought it's not the best solution.

Here is my idea: enter image description here

  • I am using two multiplexer MUX-A and MUX-B.
  • I use MUX-A C0-C15 slot to connect each individual MPU6050's AD0 slot , so when I select one of these MUX-A will pass 5V to it .
  • I use MUX-B C0-C15 slot to connect each individual MPU6050'S INT slot , since if I connect them serially FIFO buffer will be overflow.
  • I connect I2C buses serially ,ASA VCC and GND.
  • I control both MUX-A and MUX-B together by using S0-S3 slot, for example if I try to connect device-0 then I will pass 0000 to both MUX-A and MUX-B, MUX-A will pass AD0 a HIGH voltage which marks it as an 0x69 ;MUX-B will make it connect to GND; and rest of other devices will remain disconnected .
  • I loop through every device from 0000 to 1111 as fast as possible, and using Jeff Rowberg's MPU6050 DMP code to fetch the data ,and stored.
  • Which means it's not perfectly 'simultaneous' but asynchronised, however if my requirement data only need to be lower frequency like 50Hz which means I probably could fetch all of these device's data in the same time.

Here is the requirements of my project :

  • My project involve with machine learning so I should gathering data as synchronised as I can otherwise I will be worry about the accuracy issues.

And my question:

  • Is there any better idea to approach my target?

I will be so appreciated for any helps ..

=========Intresting Picture I found online========== enter image description here

\$\endgroup\$
  • \$\begingroup\$ It's difficult to understand a lot of what you're proposing. Can you post a schematic instead? \$\endgroup\$ – Nick Johnson Apr 20 '15 at 15:07
  • \$\begingroup\$ Hi Nick sorry about the confusion I will draw it by hand. \$\endgroup\$ – Yank Apr 20 '15 at 15:09
  • \$\begingroup\$ There's no need to do that - there's a schematic tool in the editor. Just click 'edit' on your post, then click the 'schematic' icon in the editor toolbar. \$\endgroup\$ – Nick Johnson Apr 20 '15 at 15:10
  • \$\begingroup\$ Sorry Nick the schematic is too complex for me so I just drawed .. :) \$\endgroup\$ – Yank Apr 20 '15 at 15:30
  • \$\begingroup\$ Well, the schematic shows pull-up resistors built-in the each module, I believe that 10 resistors will force more current than device can be drive: courses.cs.washington.edu/courses/cse466/14au/labs/l4/… \$\endgroup\$ – user3394963 May 22 '18 at 3:18
3
\$\begingroup\$

It seems the problem you have is that you want to connect 10 devices to a IIC bus, but these devices can only be configured to one of two addresses. I'm ignoring your proposed solution because the description is too confusing and too long.

One way to deal with this is if each of the devices has a enable line. You can configure the devices into two groups of 5, one address for each group. You then have to have 5 separate enable lines, with only one device from each group being enabled at a time. One way to generate the enable lines is with a 3 to 8 line decoder. Or you can use up to 5 I/O lines for a data bus and another as a clock, then run those into a octal flip-flop. There are various tradeoffs between pins of the micro used and external hardware.

Another possibility is to actively control the address bit of each device. Keep them all at one address except the device you want to use. That device is switched to the second address, which is the only address you ever send over the IIC bus. This effectively uses the address setting line as a enable line. This time you'd need 10 different enable lines one way or the other eventually.

\$\endgroup\$
  • \$\begingroup\$ Hi Olin thank you very much for your kindness reply. I think I get an overall idea of your solution . So the 'enable line' means the choice been decided by multiplexer right ? Sounds like your first solution will have higher synchronise rate because I could fetch a pair of sensors' data in the same time. \$\endgroup\$ – Yank Apr 20 '15 at 15:43
  • \$\begingroup\$ @Yank: In no case can you read from two devices at the same time. That's not how IIC works, regardless of how the devices are addressed and enabled. \$\endgroup\$ – Olin Lathrop Apr 20 '15 at 16:17
  • \$\begingroup\$ Thank you very much ! If I found a way to differ their address should I just looping through the address and get the result? \$\endgroup\$ – Yank Apr 20 '15 at 16:31
  • \$\begingroup\$ Hi Olin, I've just check the official document of 6050, it's only got 2 fixed address so it's not possible to allocate different address with them. I am going to use one of your solution , there is only one question I didn't clear : when I doing switch , it seems need to establish the connection again , if so, will it become the bottle neck of the synchronous speed? \$\endgroup\$ – Yank Apr 20 '15 at 17:55
  • \$\begingroup\$ @Yank: You switch the select lines before starting the IIC sequence. Switching select lines should take a tiny fraction of the time the IIC messages take to get the data. \$\endgroup\$ – Olin Lathrop Apr 20 '15 at 17:59

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.