The OpenHumidor Wireless Protocol - sharst/OpenHumidor GitHub Wiki
OpenHumidor uses a simple protocol to transfer information from a sensor to a receiver and the other way round. In normal use, the receiving board is always listening to incoming messages. Every few minutes, the sensor will wake up and send a message to the receiver. It will then go to listening mode and wait a few seconds for an answer. If it receives an answer or a timeout occurs, the sensor will power down again.
If you're using the OpenHumidor board as a receiver, it will simply output the sensors' messages on the UART. If you want to respond to a message, you will first have to send the address of the recipient device to the UART, followed by the full base message. Once you have sent the 5-byte device address to the receiver board, it will go into transmitting mode and consequently transmit the 18-byte-long message that you transmit to the UART.
All 2-byte values are MSB unsigned integers.
###Sensor --> Base
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
0xCA | 0x55 | Module Address | Error flags | Temperature | Humidity | Supply voltage | Signal Quality | Message ID | 0xFF |
Explanation:
- 0-1: The first two bytes are always the same start bytes.
- 2-6: The address of the module that is sending this message (i.e. the reply-to-address)
- 7: Error flags, bit field with error codes (see below)
- 8-9: Temperature, coded as a 2byte MSB integer; same as below
- 10-11: Humidity, coded as a 2byte MSB integer; eg. 0x1C 0x35 --> 7221 --> 72.21 %
- 12-13: Supply voltage, coded as a 2byte MSB integer; 3467 --> 3.467V
- 14: Signal quality, from 0-255. Shows how often the NRF24L01 has attempted to send the message before it got through
- 15-16: An increasing message ID. The receiver responds with the same message ID. Can be used to see if messages have been lost.
###Base --> Sensor
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
0xCA | 0x56 | Open Humidifier | Start Fan | Pause duration | Message ID | 0xFF (ignored) |
Explanation:
- 0-1: The first two bytes are always the same start bytes.
- 2: Ignored
- 3: Tell the sensor how much to open the humidifier (if attached)
- 4: Tell the sensor whether to start the fan (0=OFF, 255=ON)
- 5-6: How much time the sensor should go to sleep for before sending the next message, coded as a 2byte MSB integer. If the message gets lost, the sensor will sleep as long as the last time it went to sleep.
- 7-8: Message ID; should be the same as in the preceding sensor message.
- 9-17: Nothing.
This is basically a representation of the different errors the DHT22 library can throw. Only RECEIVED_NOTHING is new: It means that after sending the last message, the sensor did not receive a response.
bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
meaning | DHT_TOO_QUICK | DHT_CHECKSUM | DHT_DATA_TIMEOUT | DHT_SYNC_TIMEOUT | DHT_ACK_TOO_LONG | DHT_NOT_PRESENT | DHT_BUS_HUNG | RECEIVED_NOTHING |