HI folks,
A little history first...
https://forum.allaboutcircuits.com/threads/home-automation-network-protacol.134415/#post-1121743
https://forum.allaboutcircuits.com/...rordcast-packet-protacol.134588/#post-1122189
Much useful advice in these, followed by much more reading and thinking.
Now I think I have a plan and would apriciate a critique.
Sailiant points.
1. I want something simmilar to I2C in multi master mode. Simmilar because I dont actually want to address any hosts.
2 The Passive pull-up used by I2C is not going to work for me as my lengts could be considderable.
3. A star topology is my goal so some sort of hub is going to be required to avoid reflections and multiple paralell terminations.
4. I am unsure how / if multi master is implemented properly in the Arduino wire lib but It may be useful as a starting point.
5. I2C line drivers are not cheap especially when you considder each host needs two, on on board and one at the hub.
6. Given that I plan to use a hub each device will essentally be P2P so I can use push pull drivers
6. I dont need to talk to standard I2C devices
7. I dont want a single master or to have to program hosts when changes are required.
I think I have a plan now but would apriciate comments, good or bad.
The idea is to have all the hosts, 20 or so, host soft devices that may be inputs or outputs. These will be virtual devices and a host could, and will, carry several of them in many cases.
When a devise has something to say it will say it, see collisions/scheduling later, and everything will listen.
There are two active lines lines and a ground, implemented as two pare, TX and RX, relative to the hub.
A host can drive its TX low or high, actively, and the hub will respond by driving all RX lines to a reciprocal state.
In addition the hub will drive the RX lines with a free running, asymmetrical clock.
Data will be encoded by clock stretching which will work with bipolar signals because the hub, internally, will be using passive pull-ups.
The clock pulse will be 25%, 0's 50% and 1's 75% of the clock frequency. Stop will be encoded with 0's with a null between them for 5 cycles.
I have yet to decide on error checking but that aside...
Any host can transmit a devices data after a stop and 3 null clock pulses or n seconds of quiet buss.
Every message will start with a priority code, initially 1 and a device address in n bits, I haven't decided how many yet, sent MSb first. Obviously there will be occasions when two hosts attempt to transmit at the same time. Since each hosted device will have a unique address and the hub will echo whatever a device sends two devices will continue to transmit, synchronised by the clock untill one of them detects a 1 when it sent a 0 at which point it will abort an increment its priority code. This will ensure that only the device with the highest priority code and device address combination, in that order will send a full packet and any devices that have failed to send will now have a higher priority than a device that has completed a packet.
If several devices start taking simultaneously, all with a 1 priority the one with the highest address will prevail.
Given that even the most proliffic devices will only be reporting data, temperature, light level and the like, every few seconds I do not think this strategy will create much latency. And of course I a device has something critical to report once in a while it can start with an enhanced priority in the first place, switch events for example.
Every host will maintain a table of device mappings that will define which device is passed data from that arrives based on the address of the sender.
This table will be a device in its own right and will listen for commands from the programmer, a tablet probably, that will update the table or report its contents. to get the data from the tablet onto or off the bus a master protacol converter/buffer will sit in the hub and use 232 over bluetooth, or wifi tcp raw packets, to comunicate with the tablet/HMI allowing it to show the status of all devices, command anything and modify device mappings.
What am I missing?
Anyone have a better plan or an enhancement?
Anyone up for a bit of colaberation?
Timescales are not tight but I am keen to make a start, once I have read through any advice and ordered a few parts.
I was planning on using totempole drivers, 2904/2906 BJT's for the drivers but I am up for suggestions if anyone can offer a chip, provided we are talking p not £. I will use ULN2003A's for the recievers at the hub and probably single transistors for the one on each host.
Physically I have RJ45 sockets and breakout boards. Power will be on pare 1&4 with the data on 2&3
The only other enhancement I van think of if to use diferential lines, 485 esque but again drivers seem a bit OTT, comparators perhaps?
Anyone have an opinion as the weather the enhabcenent is worth the effort, cable runs will be less than 20m in most cases but I want to plan for twice that.
I would be interested to know what you suggest RE signal level. Power will be 24, the hub will supply that from a large boost converter fed from my batteries.
I would prefer the signal level to be the same as the supply, or the Arduino supply @5, so that I dont have to go mucking about with a third rail.
Looking forward to being educated...
Al
A little history first...
https://forum.allaboutcircuits.com/threads/home-automation-network-protacol.134415/#post-1121743
https://forum.allaboutcircuits.com/...rordcast-packet-protacol.134588/#post-1122189
Much useful advice in these, followed by much more reading and thinking.
Now I think I have a plan and would apriciate a critique.
Sailiant points.
1. I want something simmilar to I2C in multi master mode. Simmilar because I dont actually want to address any hosts.
2 The Passive pull-up used by I2C is not going to work for me as my lengts could be considderable.
3. A star topology is my goal so some sort of hub is going to be required to avoid reflections and multiple paralell terminations.
4. I am unsure how / if multi master is implemented properly in the Arduino wire lib but It may be useful as a starting point.
5. I2C line drivers are not cheap especially when you considder each host needs two, on on board and one at the hub.
6. Given that I plan to use a hub each device will essentally be P2P so I can use push pull drivers
6. I dont need to talk to standard I2C devices
7. I dont want a single master or to have to program hosts when changes are required.
I think I have a plan now but would apriciate comments, good or bad.
The idea is to have all the hosts, 20 or so, host soft devices that may be inputs or outputs. These will be virtual devices and a host could, and will, carry several of them in many cases.
When a devise has something to say it will say it, see collisions/scheduling later, and everything will listen.
There are two active lines lines and a ground, implemented as two pare, TX and RX, relative to the hub.
A host can drive its TX low or high, actively, and the hub will respond by driving all RX lines to a reciprocal state.
In addition the hub will drive the RX lines with a free running, asymmetrical clock.
Data will be encoded by clock stretching which will work with bipolar signals because the hub, internally, will be using passive pull-ups.
The clock pulse will be 25%, 0's 50% and 1's 75% of the clock frequency. Stop will be encoded with 0's with a null between them for 5 cycles.
I have yet to decide on error checking but that aside...
Any host can transmit a devices data after a stop and 3 null clock pulses or n seconds of quiet buss.
Every message will start with a priority code, initially 1 and a device address in n bits, I haven't decided how many yet, sent MSb first. Obviously there will be occasions when two hosts attempt to transmit at the same time. Since each hosted device will have a unique address and the hub will echo whatever a device sends two devices will continue to transmit, synchronised by the clock untill one of them detects a 1 when it sent a 0 at which point it will abort an increment its priority code. This will ensure that only the device with the highest priority code and device address combination, in that order will send a full packet and any devices that have failed to send will now have a higher priority than a device that has completed a packet.
If several devices start taking simultaneously, all with a 1 priority the one with the highest address will prevail.
Given that even the most proliffic devices will only be reporting data, temperature, light level and the like, every few seconds I do not think this strategy will create much latency. And of course I a device has something critical to report once in a while it can start with an enhanced priority in the first place, switch events for example.
Every host will maintain a table of device mappings that will define which device is passed data from that arrives based on the address of the sender.
This table will be a device in its own right and will listen for commands from the programmer, a tablet probably, that will update the table or report its contents. to get the data from the tablet onto or off the bus a master protacol converter/buffer will sit in the hub and use 232 over bluetooth, or wifi tcp raw packets, to comunicate with the tablet/HMI allowing it to show the status of all devices, command anything and modify device mappings.
What am I missing?
Anyone have a better plan or an enhancement?
Anyone up for a bit of colaberation?
Timescales are not tight but I am keen to make a start, once I have read through any advice and ordered a few parts.
I was planning on using totempole drivers, 2904/2906 BJT's for the drivers but I am up for suggestions if anyone can offer a chip, provided we are talking p not £. I will use ULN2003A's for the recievers at the hub and probably single transistors for the one on each host.
Physically I have RJ45 sockets and breakout boards. Power will be on pare 1&4 with the data on 2&3
The only other enhancement I van think of if to use diferential lines, 485 esque but again drivers seem a bit OTT, comparators perhaps?
Anyone have an opinion as the weather the enhabcenent is worth the effort, cable runs will be less than 20m in most cases but I want to plan for twice that.
I would be interested to know what you suggest RE signal level. Power will be 24, the hub will supply that from a large boost converter fed from my batteries.
I would prefer the signal level to be the same as the supply, or the Arduino supply @5, so that I dont have to go mucking about with a third rail.
Looking forward to being educated...
Al