Hi, i have 2 esp32 reading pressure from two analog sensors and i want them to send the values to a slave esp32 and the slave will compare the values and give the order to turn relay on/off. For example if pressure1>pressure2 , the esp32 slave send a message to the #1 master to turn it's relay on and if pressure2>pressure1 the slave send a message to the #2nd master to turn it's relay on. How can i do to send sensor data from many to one , compare it on the receiver side and give order to the senders ?
Do you want to send it wirelessly?
yes, because it's for an industrial application. The boards are not close to each other.
How far apart? Longest distance from the main controller?
probably between 5-15m
Google ESP-NOW, loads of tutorials.
It will allow you to set which units can talk to each other, and send direct messages between them.
yes i know espnow, to send data to the slave but there is not tutorial to compare sent data on the slave side and give orders to the masters that's why i came to make this post.
What kind of data are you trying to compare?
pressure from analog sensors
So, you want to compare integers. What part is confusing?
In the main controller:
I'd consider writing a function for each unit.
Switch the id from each message to determine which function to run.
In the function process the rest of the message and compare the data as needed, then take the appropriate action, which for you sounds like sending a specific response back to the sender.
The sender code should be much easier, transmit on a predetermined interval or on a state change, receive a response and take action or don't.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.