Hi Awneil
Apologies for my lack understanding, i am a amature so limited on knowledge.
Ok ill do my best here goes! What im about to explain i have achieved with ESPNOW.
I will explain my project as you may understand more what im trying to accomplish.
I have one master PCB that receives sensor data from 4 other PCB boards and saves received data as variables , this data is then processed with if statements and check sums then issues a command back to each of the 4 boards using simple x = 0 & Y = 1.
The master PCB is linked to my GUI that i have build in processing as user interface that allows me in real time to monitor data and issue commands.
See below each board explained with some examples of data transmitted and received.
Board 1 Power module:-
Monitors Battery Cells
Monitor's Battery Temperature
Monitors 24v bus voltage and current
Monitors 5v bus voltage and current
Moset to enable 24v Bus
Moset to enable 5v Bus
All Monitored data is transmitted to the master PCB, for any reason the MPU if statements are checked then a command is issued back to this board via the master baord for example to disable a serving a bus.
Board 2 Solenoid Valve Board:-
Mosef to enable 24bus to each solenoid valve (12nr mosfets in total)
Monitors if mosfets are enabled and voltage and current is detected when mosfets are enabled.
If the master PCB if statements are checked then the master board will issue a command back to enable or disable mosfets, i can also manually enable or disable mosfet via my GUI. An if statement example if pressure sesnor exceed a vaule then X = 0 , this means close valve.
Board 3 Sesnor Module:-
This board is stacked with all different sensors from pressure , temperature, barometers, accelerometers, GPS, etc
All data is transmitted to the master baord , some data is just monitored, others serve if statements and check sums.
The code i have written has state functions within the loop, each state has different loop codes different tasks being asked for.
The master board issues command to this board to change the state function for example of x = 1 then state 1, if x = 2 then state 2.
Board 4 telemetry:-
This board receives all data received and transmitted data on the master board as a packet and saves to data logger. In addition transmits and receives all data from my GUI over LoRA.
When i use the word simultaneously i refer to when the the master board receives any data from each of the other board it can issue back any command i.e. X = 0 during the same loop to that particular board.
I understand that i cant transmit between all boards simultaneously due to data clash. Hence why i like the SPI function as i understand it should be simple due to the CS pin.
For example
If CS pin to board 1 is low then receive data and transmit back. Store all data into variables
Followed by
If CS pin to baord 2 is low then receive data and transmit back. Store all data into variables.
And so on for the remaining 2 boards.
Lastly wether is this right or wrong i transmit all data as Arrays, i find it simple and easy to break apart the data. If there is a better way i will listen to those more experienced.
Sorry for the long repsonse, trying to give you as much information as possible , i can share some of my code but its hundres of lines long on my smallest board.
Again thanks for your patience.
Thanks