I2C mesh network

Dear all,

I am new to this forum and have a question that has been bothering me for a while.
My approach might be wrong and your advise would be much appreciated.

I am trying to build a network of components with unique IDs where I can address on component and request its neighbouring component IDs. The network should work in a ‘plug and play’ manner.

I have been exploring the idea of using I2C as they are simple components that can have a unique identifier and a value that can be read or written. On connecting a component - is it possible to pass this component’s ID or values to its neighbouring I2C?

Basic example:
I2C/A (id: A, value: 0)
I2C/B (id: B, value: 0)

I2C is connected to an arduino
I2C/A is connected to I2C/B
I2C/A transfers its ID to I2C/B resulting in I2C/B (id: B, value: A)
I2C/B’s value is read via arduino as A.

@ andre.m - Many thanks for reply - reading now - hoping to this can help me get the ID of a neighbouring component :wink:

@ howard - I think a little bit more information about your project is needed. Building a mesh network implies that each node has multiple “network” interfaces. What is the maximum degree a node can have? Do nodes appear and disappear, or are we just talking about initial configuration?

Off hand, seems serial ports maybe a better transport assuming each node has sufficient UARTs to support the nodal degree.

1 Like

@ Mike - thanks for your response! Maybe a mesh network is the wrong term (I was thinking something like zigbee).
I will need to think a bit more about the serial setup you suggested. The key for me is to be able to probe any component (i.e. i2c) in the network and get its neighbours (as IDs). Nodes can appear and disappear. If the network was based on i2cs i guess the maximum would be about 120 nodes but I am anticipating around 50. I am trying to simplify the problem - so please excuse lack of detail.

@ howard - 50 nodes hard wired together for i2c might have a noise problem if the wires are long.

ZBee is a good solution. What about WiFi? must the network be physical?

@ Mike - Thanks again! Ok - I am expanding my description to include constraints (if we consider things like zigbees).

[ul]Each component must be small and fit into a block with dimension ~ 30 mm x 30 mm x 30 mm.
Blocks can interlock and this is what produces the ‘plug and play’ connection
When interlocking (or on request) I should be able to ask a block who it is connected to (e.g. its neighbour)
Any block should be able to connect to another block
I should be able to ask each block who its neighbour is and retrieve the complete relational structure.
Components should be as primitive as possible (e.g. simple components and cheap)
[/ul]

With zigbee the size/price of these components might be a concern but more important I am not sure if they can be organised in any order or if this order must be known a priori. The key is that I need to be able to extrapolate the relational structure.

Looking forward to hearing your thoughts!

Lots of challenges here!

Since each node is a cube, a node can be a degree of six, and physical connectivity is a variable. A wireless solution would not work.

I think i2c with dual multi master/slave modes will work. I don’t believe the GHI sdk supports this kind of operation.

if you can get the modules to communicate with an adjacent node, you can map an arbitrary topology. you need to look at network discovery protocols.

How are you going to power the cubes? physically connect them?

Yes blocks will be physically connected.
Some more thoughts on this process.

Original idea was to ask any I2C who what their neighbouring (assume some sort of serial connection) I2C is.
So given an ID I would know the neighbouring IDs.

Here is another idea - this may be very slow but could offer a solution.
[ul]Arduino reads all devices in list and identifies all connected I2Cs
Arduino sends signal to I2C (a)
For each neighbouring I2C send power of signal
Arduino reads through list and discovers who has been disconnected
When complete power all neighbours on and continue
Arduino continues to I2C (b) and repeats process 2 until list complete[/ul]

@ howard - Google network discovery protocols or route discovery protocols.

@ Mike - Ok - I have had a look and even though this makes sense. The problem I am having is that the blocks are quite small (each is about 35 mm x 35 mm x 35 mm. The suggested network would involve something like a wireless network (?) and components would be larger? Let me know if you think such a protocol would require some different components…or if you think it can be achieved with I2Cs?

Thanks again!

@ howard - you have me confused! :slight_smile:

Are we taking physical connections or electrical connections, or link protocols, or discovery protocols or .Net Micro Framework or Arduino?

I think i2c could be used to connect adjacent nodes.

With a physical connection between each adjacent block I2C would allow you to communicate with any/all of the blocks (assuming you address them correctly) but I cannot see a way of getting a block to determine which address is physically closest too it.

@ Mike - Physical and electrical connections. Adding a link to drawing to better explain.

Let me know if this helps…
H

How much smarts (and $) do you want to put in each block? Seems to me you’re going to have to put some kind of spi-capable mcu in each block if you want to build a working mesh with the capabilities you are describing.

@ howard - OK, I understand. What is your question?

@ Mike - so I think I got a bit further in coming up with a design and for the most basic test using PFC8574 i/o extender (more commonly used for multiplexing). I believe I am able to use this to determine the tree structure by switching on and off components and performing a search in software.

Here is a very basic sketch.

— The general idea:

Given a heap of known components (e.g. A, B, C, D, E, F) all capable of having up to 6 connections with any other component.

Let’s say A is connected to E through connections (pins) A3 and A6.

We can determine this by looking up A then for each pin we will switch power on and then run through the heap and see who is ‘new’ in the network. If any has been found we switch the pin off and continue to next pin.

We can then traverse the network by keeping E on and asking the same question until no more components are found. In the case of multiple components connected we then branch the search to produce the complete tree structure.


My questions are as follows:
Would this make sense and are there any potential issues?
The component has limitation in terms of the addresses it can have (as it’s address is set by 3 pins) - might there be a component with more addressing pins?
What I am not sure about it how to make sure this forms a proper circuit? I am still looking at this.
Are there any software that you could recommend for me to build a simulation of how this would operate?

@ howard - I suspect that powering a IC chip from a pin of another chip will have issues. best way to tell is do a prototype.

I /we will be happy to assist you with .Net Micro Framework and/or Gadgeteer issues.

@ Mike - Agreed - will see what I can get done this week once I get the components I need. Thanks again!

@ howard - You need a Controller Area Network.