This solution shows how to create a water level monitor node. The monitor node measures the water level from a sensor with a 0 to 5V analog interface. It then transmits this data frequently over LoRaWan® to a LoRaWan® server.
At the LoRaWan® server the data arrives in the following format
Byte1 | Byte2 | Byte3 |
---|---|---|
7 | D1 | D2 |
where |
- Byte 1 is a marker for the data type, here always 7
- Pressure is sent as
D1D2
e.g. 1009 cm (would be 0x03 0xF1 in the data package)
To build this system, the following hardware are required:
-
WisBlock Base RAK5005-O * 1pcs
-
WisBlock Core RAK4631 * 1pcs
-
WisBlock IO RAK5811 * 1pcs
-
ULB16 - A Water Level sensor with 0-5V interface * 1pcs
Note: To send the data of sensor node to LoRaWan® server, a LoRaWan® gateway is also needed. If you don't have one, we recommend you use RAK7243.
The assembly of sensor node is as follows:
We chose a water level sensor with a voltage of 3v3, so we can use the board to supply power directly. The test scenario is shown as follows:
- Arduino IDE
- RAK4630 BSP
- SX126x-Arduino library
The code for the water level monitor node can be found in the sketch file
The log of sensor node is shown as follows:
14:44:19.043 -> =====================================
14:44:19.043 -> Welcome to RAK4630 LoRaWan!!!
14:44:19.043 -> Type: OTAA
14:44:19.043 -> Region: EU868
14:44:19.043 -> =====================================
14:44:24.244 -> OTAA Mode, Network Joined!
14:44:45.264 -> Sending frame now...
14:44:45.264 -> -------depths------ = 66 mm
14:44:45.264 -> lmh_send ok count 1
14:45:05.250 -> Sending frame now...
14:45:05.250 -> -------depths------ = 66 mm
14:45:05.285 -> lmh_send ok count 2
14:45:25.255 -> Sending frame now...
14:45:25.255 -> -------depths------ = 66 mm
14:45:25.289 -> lmh_send ok count 3
14:45:45.264 -> Sending frame now...
14:45:45.264 -> -------depths------ = 66 mm
14:45:45.264 -> lmh_send ok count 4
14:46:05.272 -> Sending frame now...
14:46:05.272 -> -------depths------ = 66 mm
14:46:05.272 -> lmh_send ok count 5
14:46:25.263 -> Sending frame now...
14:46:25.263 -> -------depths------ = 66 mm
14:46:25.297 -> lmh_send ok count 6
We use Chirpstack as LoRaWAN® server in this solution, the data sent to LoRaWAN® server is shown as follows:
LoRa® is a registered trademark or service mark of Semtech Corporation or its affiliates. LoRaWAN® is a licensed mark.