Distributed networking / multiple level networks and processors

Hi all,

I need a little help in understanding what options are available to build a distributed system of 3 levels of processing and separate networks. I've been unable to find much online for this type of system architecture, I may be searching for the wrong terms, but I am at the point of asking for help.

Background:

This is the basis for a scalable and modular system for a flight simulator using flightgear.

The project is the interface for real-world 1950's / 1960's cockpit equipment to the PC. Some of this equipment is insanely complex, so for a given indicator, I need to build a local system to interface with mid centrury technologies such as: quadrature phase motors, synchro transmitters and receivers, Desynn indicators, most of which operate at 110Vac 400Hz or 28Vdc.

The idea is that the local system (TERTIARY level processors) deal with the final interface to the hardware, send raw data to the SECONDARY level processors who collate from a few TERTIARY processors and produce sensible data to send back to the PRIMARY processor for passing back to the PC. (This is 2 way communication at all levels).

Concept:

I have been thinking about building a hierarchical distributed control system where multiple Arduino boards / compatible processors can communicate such as this:

(Please ignore the . . . dots, the forum erases a string of spaces, they are just for formatting).

PC
|
PRIMARY processor
|
________________________________________ (Network level A)
| . . . . . . . . . . . . . . . | . . . . . . . . . . . . . . . |
| . . . . . . . . . . . . . . . | . . . . . . . . . . . . . . . SECONDARY N...
| . . . . . . . . . . . . . . . SECONDARY 2
| . . . . . . . . . . . . . . . |
| . . . . . . . . . . . . . . . ______________________________________ (Network level B)
| . . . . . . . . . . . . . . . | . . . . . . . . . . . . . . . | . . . . . . . . . . . . . . . |
| . . . . . . . . . . . . . . . | . . . . . . . . . . . . . . . | . . . . . . . . . . . . . . . TERTIARY 2-N
| . . . . . . . . . . . . . . . | . . . . . . . . . . . . . . . TERTIARY 2-2
| . . . . . . . . . . . . . . . TERTIARY 2-1
|
SECONDARY 1
|
______________________________________ (Network level B)
| . . . . . . . . . . . . . . . | . . . . . . . . . . . . . . . |
| . . . . . . . . . . . . . . . | . . . . . . . . . . . . . . . TERTIARY 1-N
| . . . . . . . . . . . . . . . TERTIARY 1-2
TERTIARY 1-1

The PRIMARY processor really is just there to direct data between the PC and the correct SECONDARY processors, no real processing is required in the PRIMARY.

instead data will be passed to the PRIMARY from the SECONDARY processors after some processing has been carried out at the, saving loading up the PRIMARY processor. As this is a scalable system, I'd rather the "work" for a particular piece of equipment was done by local processors, dedicated to the task.

By having sub-networks it helps me to keep this project truly modular, I'd rather not have it all hanging off just one I2C network, saving clogging up the PRIMARY processor with communications that can be handled locally between the SECONDARY and TERTIARY levels.

It would be good to have at least one of the network levels as I2C to utilise I/O expanders such as the MCP23008 for I/O such as switches and lamps.

So my main questions are:

  1. Do any Arduino boards or compatible processors can support two I2C networks? Or are there any libraries to utilise ordinary I/O pins for additional networks?

  2. If not many, can I use serial to connect more than two slave processors (Arduino pins marked TX/RX) instead of I2C?

  3. Can I implement a multi-drop serial network like RS485?

  4. Is serial (TX/RX) better where cabling is involved between processor boards? I am aware of the issues of I2C regarding cable capacitance / inductance limiting distance and speed. My max length of any run will be about 2m.

Any tips are much appreciated as it may save me hours of experimenting with a system that won't work.

Cheers, Scott.

Have you considered wired ethernet or WiFi?

You could certainly do I2C from your secondary layer to a number of tertiary processors. I'm not sure if you can do multiple busses.

There are a number of Arduinos or equivalent with four serial ports, so you can use those to create a hierarchy of controllers.

RS485 is plausible too, but you'll need extra hardware. I'll guess given the cost of the flight instruments, that's a rounding error though.

Hi, thanks for replying..

I did consider Ethernet, as I could dispense with the PRIMARY processor and address the SECONDARY boards directly from the PC, but having previously had a go with an UNO Ethernet shield, resulting in total failure I went back to serial which works nicely from flightgear. Plus the Ethernet shields are quite expensive...

I2C is quite attractive as it requires minimal additional hardware, and it can do multi-drop. However it's the multiple I2C bus issue that's the potential show stopper there. It would only be the SECONDARY processors that would need to interface with two I2C buses. i'm up for keeping the hardware as simple as possible, as you say RS485 would require extra components as shown here:

But RS485 may be more robust / reliable than I2C for the longer runs, so it's one to consider.

Yes, the real cockpit equipment can be expensive when you look at ebay, but luckily I have a few bits and pieces lurking from my years volunteering looking after old jets, and know a few people with stashes of stuff!

Have you looked at the RPi Pico? It has 2 x I2C, 2 x SPI2 x Uart and much more memory than an Uno - and not expensive! You can use the Arduino IDE for development I believe - I don't have one yet so am not 100% sure on the IDE usage.

Hi, that's a fab idea thanks! I hadn't seen the Pico until you said that, and there are a few tutorials about using the Arduino IDE... Thanks, that's another option now!

One of the main reasons I want to have a smattering of processors is to be able to sample multiple analogue signals simultaneously, at exactly the same time, thought about using 3x ATtiny85's as TERTIARY processors for the analogue reads, triggered be a common hardware interrupt, then send the measurements to the SECONDARY for processing. As most Arduino processors multiplex their analogue inputs to one or two ADC's, they don't read at exactly the same time. These analogue signals fluctuate rapidly, and simultaneous sampling is important in this application....

One further question....

RS485 is well documented by Michael Jonker using the MAX13085E (or similar) IC for line driving cables of significant length (see link in previous post). However, as most of my connections are only a few inches from board to board, while it's a very good solution, it may be a bit overkill.

There are also other well documented examples of two Arduino boards communicating serially using Tx/Rx pins, the same pins used by the above RS485 solution, but with direct connections, no extra line drivers, however I can't find a multi-drop example online.

So my question is:

Can the board-to-board serial communications (Tx/Rx pins) be used for multi-drop (single master, multi slave) systems as per the RS485 method? But with less additional hardware... Ie: a way to connect all slave Tx's together and to the master Rx, and all slave Rx's together and to the master Tx? Or am I barking up the wrong tree?

I don't think the RS485 example could be implemented without the external IC as it utilises the RE/DE pins to enable receive / drive.

Has anyone tried anything like this? Maybe I need to be less of a cheapskate and just use these IC's!

Thanks, Scott.

The Atmega328P on the Uno supports multi-processor communication mode on its UART port. This allows you to address each Atmega328P individually much like I2C in an RS485 bus. The Attiny85 does not have a UART port so you are better off with one that support this feature.

Hi @hzrnbgy , that's much appreciated, and sounds like it may well be my solution.

Since your post I have been searching "UART multi processor" and similar, but not yet found a working example (but plenty of questions), if anyone knows of any reliable guides to follow (ie: declared as "tested and working"), please let me know.

I don't have may free hours to be experimenting, I would rather adapt a known working example to save time.

Thanks again, Scott.

If you are looking for an Arduino library for it, I don't think anyone made one yet

Here the section on the datasheet

1 Like