Introduction: Water Level Monitoring System
As a DIY Maker, I always try to find a way to make my life and other's life easier and safer. On the 30 march 2013, at least 11 people have died after sudden rain caused flooding in the Mauritian Capital Port louis. On the same day several houses were flooded while many villagers assets were damaged. As I live few kilometers where this tragedy happens, I decided to build a water level monitoring system. Together with a fantastic and motivated team, we were able to build it.
The project is quite easy to replicate it compose of an arduino MKR WAN 1310, ultrasonic sensor, DHT11 sensor and some leds and push button to make the project cool.
Supplies
Material :
- Arduino MKR WAN 1310
- Ultrasonic Sensor
- DHT11 J
- ump wires
- Plexo box
- Gateway
- Leds
- Push button
Tools :
- Hand drill
- 5mm bit
Step 1: Preparing the Plexo Box
For the enclosure, i'm using a 80x80mm plexo box as it is strong and durable. Firstly I removed the the caps for the ultrasonic sensor and the power cable. This is very easy as the diameter of the hole is same as the diameter of the ultrasonic sensor.
Secondly, I drill a 5mm hole on the top of the case for the antenna. For this, you can use a drilling machine or a hand drill as in my case.
Step 2: Putting the Components
I had to trim the length of the ultrasonic sensor wire as it was too long to fit in the box and finish it with female pin header at the end for connection. The sensor can then be push inside the case and lock itself with the built in lock system.Then i added the mkr wan 1310 board and the sensors module.
I put the waterproof side connector for power outlet as i do not want water to come inside.
Step 3: Tinkercad Circuit
During the past 3 years, I have made a lot of circuit. But i did not have an arduino. Tinkercad was the only way for me to learn and develop arduino circuit and simulating them. Even after I got my arduino uno, I still use tinkercad circuit to simulate my project first.Tinkercad circuit allow you to use a multiple of component and troubleshoot them. I highly recommend tinkercad circuit for beginner and arduino user as it will prevent you from burning your arduino when trying new circuit.
Step 4: Connecting the Wire
You can follow the tinkercad circuit as above or you can follow the bellow connection.
DHT11
+ > 5v
Out > pin13
- > ground
Ultrasonic sensor
+ > 5v
Trigger > pin7
Echo > pin8
- > ground
Using jumper wires you can make the connection easily and attached them with zip ties.
Step 5: Adding Leds and Push Button for Troubleshooting
I'm using a red and green led to show the state of the device and a push button to reset the device. As my design has work on tinkercad circuit, i pretty sure it will be in real life. So i have made a small pcb so that i can reduce the amount of wires.
Step 6: Coding
I'm using the online IDE and the code are as below file
Attachments
Step 7: The Thing Network Setup
You can follow these steps on that link . It is super easy with detail explanation. I added the payload decorder in the image above and the text.
function Decoder(bytes, port) {
var decoded = {};
var result = "";
for (var i = 0; i < bytes.length; i++) {
result += String.fromCharCode(parseInt(bytes[i]));
} return {
field1: result,
};
}
This is very important in order to get a readable alue
Step 8: Receive Data
You can see on the above screenshot how i'm receiving data via TTN on my phone.I'm also using the IFTTT integration to display the data in my google sheet.comment down below if you want to know how I made it.
Step 9: Final Solution
The product is still in the phase of development. I 3d print a new enclosure but need to reinforce it. It is using a 12v solar panel to power it. I'm currently testing it before I install it at the river bank. I will soon publish an instructable to show how i will place the device at precise location.