Which Protocol to choose for connection of sensors and servers on the avr or stm?

Want to do a little automation in the garden. I need to associate multiple devices to the network, the distance of 15-20 meters. It will be sensors, actuators and server. The basis of device I want to make on the microcontroller (avr or stm). Advise the exchange Protocol between all these economies. Know what you can and wireless network to stir, for example, on the nRF24, but is a fallback. Modbus it seems not a bad Protocol, but I would like to retain minimal functionality, if the server stops working. For example, the humidity sensor detects a critical level of humidity and will give the command to turn on irrigation.
July 12th 19 at 17:10
2 answers
July 12th 19 at 17:12
If the sensor can directly influence the contractor's team, what is the role of the server? To collect data? Manage by manually?
If the performer can listen to the sensors and to recognize their testimony is to commit certain actions, the server, either only listens to the network state and can also give commands to the performers and sensors, or is absolutely necessary.
In networks where there is a need to listen on the network and occasionally to affect the operation of the network elements is preferable protocols that work similarly to TWI. Each unit constantly listens to the network and when receiving the network packet with the device address and the request waits for a free box in the network and broadcast or broadcast a reply or response intended for a specific device in the network.
Physically, such a network can be implemented on RS-485, for example. Or on any other physical exchange Protocol that satisfies the requirements on range and noise immunity.
The server is definitely needed, as it will execute a certain program. And the possibility the sensor will return to the Executive unit directly will help to avoid critical situations. I know about RS-485, Modbus Protocol this bus up and running, but it works on the master-slave principle, and if in a network there will be several masters, will be conflicts with simultaneous transmission. Need a Protocol that is spared from this. - Estel37 commented on July 12th 19 at 17:15
: "a certain program" is not the answer. However, your case.
Read about TWI and arbitration between masters in the network, to make it clear how to avoid conflicts and attempts at simultaneous transmission from two devices on the same network. - Delfina_Tillman74 commented on July 12th 19 at 17:18
Well, I will explain. The server, of course, will do most of the work (collection of information from sensors, processing and decision) and, even if it stops working, it is unlikely in the garden collapse, when you are there live. And if it is giving? Therefore providing uninterrupted power, I want the network could save some performance in the absence of the server (I assume a bug in the firmware and made firmware "hangs"). About TWI: it's the same I2C only the name atmelovsky, ibid maximal line length not 15-20 meters. Can be CAN? But the implementation at the hardware level on the avr seems to be no, and this speed of this bus no good to me. - Estel37 commented on July 12th 19 at 17:21
: I TWI has been cited as an example implementation of the arbitration between master devices on the same network. - Delfina_Tillman74 commented on July 12th 19 at 17:24
: >>(I say bug in firmware made firmware "hangs")
For this is watchdog. - Willis.Shiel commented on July 12th 19 at 17:27
July 12th 19 at 17:14
Use modbus to poll all of the logic to make a MK. about tcp/ip on MK - forget. don't need it there, there are no resources in the MK for this.

Find more questions by tags STMRS-485ModbusAtmel AVR