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?
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.
@ 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.
@ 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.
@ 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.
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]
@ 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?
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.
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.
@ 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?