# Node based digital recognition

Discussion in 'General Electronics Chat' started by Gobaz, May 22, 2016.

1. ### Gobaz Thread Starter New Member

May 22, 2016
10
0
First of all im very green on electronics, also sorry if i posted in the wrong section.
So i have a proof of concept idea, but i dont even know if its doable.
There for i have this question:

Assume you have a bunch of nodes and you can connect these nodes togheter.

Example say there are four nodes; Node1, Node2, Node3, Node4.
And each of those has connection points "C1, C2, C3, C4"

Node1:
C1 connected to startpoint.
C3 connected to Node2 C1
Node2:
C1 connected to Node1 C3
C2 connected to Node3 C2
Node3:
C2 connected to Node2 C2
Node4:
C4 connected to Node1 C4

Here's an image to illustrate:

So what i want to be able to to with this is get a digital signal that indicates the "node hierarchy"
And it needs to be modular where i can add another node and i would get a diffrent output.
With the node hierarchy i mean which node is connected to what.

So i need to be able to get a signal out that i can interpret to know the exact connections.
My question is; is this possible?
Could anyone point me in the right direction as to where to start or what parts would be needed?
Or maybe tell me what i need to learn to be able to create something like this?

I know i dident explain very well, so if you have a question i could explain more.

Thx alot for your time to read this, and any help would be very much appreciated.

2. ### WBahn Moderator

Mar 31, 2012
17,457
4,701
How are you going to access the information about the "node hierarchy".

What are these "nodes"? If they are black boxes that can contain some arbitrary digital circuitry inside them, then the problem becomes a lot simpler.

How are two nodes connected together? By a single wire? By a two-wire cable? By a multi-wire cable, like a telephone cable or an Ethernet cable?

How is the "Starting Point" distinguishable to the node it is connected to?

Is there a limit to the number of nodes that the system could have?

3. ### Gobaz Thread Starter New Member

May 22, 2016
10
0
I was thinking you connect the "start point" to some sort of microcontroller?
That then connects via usb to a computer.
Then have a program "decode" the information.

The nodes are black boxes, or rather "cubes" so they can contain digital circuitry.

You connect the nodes/cubes togheter with just a plug, like legos, then you have the connector inside.
Or some sort of magnet construction, thats another part i have not figured out entirly.

Im not what type of wire connection there needs to be, but anything that would make the system work.

The ultimate where to be if there where no limit to the amounts of nodes.

I was just thinking maybe you needed some sort of starting point to connect to a chip of some sort to recive the data?
So maybe one node was "special" that connected to the chip.

So basicly i want to reproduce the node connections via software.

Last edited: May 22, 2016
4. ### WBahn Moderator

Mar 31, 2012
17,457
4,701
Having no limit on the number of nodes considerably complicates things.

How much memory does each node have?

How will changes be detected?

Can there be cycles in the connections? For instance, can Node G be connected to Node J which, in turn, is connected to Node G (possibly through an arbitrary number of additional intermediate nodes).

5. ### Gobaz Thread Starter New Member

May 22, 2016
10
0
Ok, well i understand there might have to be a limit then.

Memory, hm how do you mean?
Right now im sort of just trying to undestand what types of component would be needed.
As for a particular amount of memory im not sure.

Yeh nodes could cycle was the idea.
But if thats a to big of a problem, maybe it can be restricted.

6. ### Gobaz Thread Starter New Member

May 22, 2016
10
0
Also change would not need to be detected.
You would construct the node network, then connect in and read of the connection.
It woulden need to detect real time.

7. ### WBahn Moderator

Mar 31, 2012
17,457
4,701
There are a number of ways to go about it. If each node can't remember anything and can only detect who it is directly connected to, they you pretty much have to rely on the PC that is trying to build up the map (what is known as a "graph") asking each node who it is connected to. But, in doing so, it has to give routing information to the device in question.

So imagine that each node can respond to the following messages:

Message: WhoAreYou
Response: NodeID

Message: WhoCanYouSee
Response: NodeList

Message: Relay, Path, ReturnPath, Message
Response: None

Basically your PC asks the node it is connected to who it is. When asked who it is, the node immediately responds with its ID (which would be hardcoded in the node). This is the first point where you have to decide how many nodes you can have because it is easiest if the node IDs are fixed-width integers. But if you truly want the number to be unlimited, then you could have it be an arbitrary length string. An alternative is to allows nodes to answer with "Unknown" and then have the system tell them (using a YouAre message) who they are. This let's the system assign node IDs as it discovers them. It also means that the individual nodes don't have to be preprogrammed with unique a globally unique ID.

Once it know who the node is, it asks the node who it is connected to. For simplicity, the node could then just go through every port it has asking WhoAreYou and return the list of IDs. This would include the NodeID of the node making the request, which allows the requester to learn which port of connected node it is connected to.

Once the PC knows which node it connects to and which nodes that node connects to (some of which may be Unknown), it can then ask the node it is connected to relay WhoAreYou, YouAre, and YouCanYouSee messages to each of the ports that connects to a node that it hasn't already mapped. The node making the request has to send a string of PortIDs that map out the complete path to the end node. A node receiving a relay message strips off its port number and adds the port number that it received the request from to the ReturnPath list. When the message reaches the destination, the recipient detects this and creates a new Relay message using the ReturnPath as the Path and the response as the message and then sends that back to the port that it received the request on.

I'm just dreaming this up on the fly, so there may be things I've overlooked. The goal has been to keep the nodes very stupid -- they only know how to do a couple of things and they don't need to remember more than a small amount of data at any given time. The PC is controlling everything based on the graph it is incrementally constructing.

8. ### Gobaz Thread Starter New Member

May 22, 2016
10
0
That sounds amazing : )
Im happy its possible atleast.
So what types of components do you think i need to get to be able to make a prototype?

Like what hardware would be needed to send messages from a computer to the node and back?

And since its a just a prototype is there something i could use to make it as simple as possible? like an arduino?

Thanks for your help : )

9. ### WBahn Moderator

Mar 31, 2012
17,457
4,701
An Arduino is probably more than sufficient. It may have communications capabilities built in, though you need several ports. I've never used the Arduino (and have no plans to start), so I'm not a good source of information. Since you have one USB-connected node, one of the first things is to successfully establish two-way communications between a PC and a node via USB. After that is to successfully establish two-way communication between two nodes. "Success" in this case might be just toggling an LED on and off. In other words, break down the problem into tiny tasks and implement solutions to the tiny tasks separately before combining them together to solve the bigger tasks. For a similar reason, I would simulate the nodes in software (an object-oriented programming language is well suited to this) and work out the messaging scheme that way before you start trying to implement in in hardware.

10. ### Gobaz Thread Starter New Member

May 22, 2016
10
0
Very good idea, i know how to program so ill do it in code first.
Also i do have the arduino uno and it has a few ports.
Just out of interest what electric component exists that can communicate back?
I know how to send signals from a port to, lets say a LED but it would not send data back?

11. ### WBahn Moderator

Mar 31, 2012
17,457
4,701
You would most likely simply connect one port on one Arduino to a port on another Arduino.

12. ### Gobaz Thread Starter New Member

May 22, 2016
10
0
So i need an arduino for every node?
Dont think that would work..
Then i need a few hundred and thats costly.
Also the board would be abit big to fit in my "black box"

I guess i could use something like this:
https://www.arduino.cc/en/Main/ArduinoBoardNano

13. ### Gobaz Thread Starter New Member

May 22, 2016
10
0
Was looking around abit.
Maybe something like this could work?

Microchip offers a unique programming service, where
a few user-defined locations in each device are
programmed with different serial numbers. The serial
numbers may be random, pseudo-random or
sequential.
Serial programming allows each device to have a
unique number, which can serve as an entry code,

14. ### WBahn Moderator

Mar 31, 2012
17,457
4,701
That's an option down the road, but you indicated that you are at the prototyping stage. Do you really want to pay the kind of fee is involved in having devices sequentially IDed?

You haven't given any indication of how large these nodes are or how they are going to be powered.

Using an Arduino for each node is a reasonable option for a proof of concept prototype since such prototypes are typically very small in scale. Why are you doing a prototype with hundreds of nodes instead of, say, six or ten.

15. ### Gobaz Thread Starter New Member

May 22, 2016
10
0
You are correct its just a prototype.
No i dont think i want to, and also the programmer was very expensive.

Your right i should probably start really small : )

Mainly the reason i have been looking at hardware is because of inexperience.
I wanted to know that its possible hardware wise.

Im writing some code in c# now to get the behaviour right.

The size of the nodes are really up for debate.
But in the range of 3-8cm cubed

Last edited: May 23, 2016
16. ### Gobaz Thread Starter New Member

May 22, 2016
10
0
Im really struggling with this.
Im not sure how to detect the neighbour node.
I know i can use the arduino with I2C or SPI communication to talk to diffrent nodes in the chain.
But i have no way of knowing a nodes neighbours

Any help would be great.

17. ### WBahn Moderator

Mar 31, 2012
17,457
4,701
One way is to make it so that each node can ONLY talk directly to nodes that it is directly connected to. Any communication with nodes further away have to be relayed through the intervening nodes.