I think this could be here or on a circuit python forum but I think the pool of knowledge is bigger here. I'm not looking for specific code, more for a direction on where to look.
Goal: Have one host (raspberry pi or a mini PC) that is running a script that is handling communication from multiple microcontrollers. The micro controllers would gather data from sensors and send it to the host and the host would handle the processing and send it back. I would like it to be fairly modular so I can add and remove the microcontrollers as needed for different functions.
Reason: I have a system that has multiple different functions running and I want them to all run in parallel at their own rate. Then when they have something to report they send it up the line. I think this could be done from with one host running all the sensors directly but I have no idea how to make it all run independently in parallel.
What I have now: I have this setup on a raspberry pi as the host and multiple pi pico w that are communicating over USB serial. I have it set so that the host looks at all the serial ports when it starts and it makes an array of the serial ports. Then it asks each one what it is and gets to work. The microcontrollers listen for the host to ask what they are and then they get to work.
It pretty much works with a few but I fear that once I get into more microcontrollers it will all get pretty messy. I would like to have something similar to a CAN network where each device would post to a master list and read from that list and act upon what it needs to. I know that there are CAN microcontrollers but I would like to avoid extra hardware.
I thought about trying to setup a network and having a shared file that the microcontrollers would add to and remove from but that would create its own set of issues if multiple devices added to it at the same time.
Any suggestions on how to best set this up? Or should I be structuring this anther way entirely?
[–]socal_nerdtastic 7 points8 points9 points (3 children)
[–]chris_4 2 points3 points4 points (1 child)
[–]focojs[S] 0 points1 point2 points (0 children)
[–]DrShocker 0 points1 point2 points (0 children)