Ultrasonic IoT sensor to measure water level in a well
My dad and I needed a way to ensure the water level in a rain water collection well doesn't drop too low and that a pump actually uses the water as scheduled. So, as a fun end-to-end IoT project, I put together a sensor, serverless backend, and web UI.
The field-deployed sensor uses a hc-sr04-like ultrasonic ranger to measure the water level from above. The measurements from this are collected by an ESP32-S2 WiFi microcontroller. Because we don't - yet - have WiFi available though, I also added a SIM7600E cellular breakout board with a prepaid SIM. The microcontroller is programmed in C++ using the PlatformIO toolchain. This entire system is powered by two 2500 mAh @ 3.7 V LiPo batteries for a battery life of hopefully at least ~3 weeks @ 1 measurement/hour.
The sensor periodically sends its measurements and remaining battery capacity to a serverless HTTPS API deployed to AWS Lambda. The lambda then saves these measurements to a DynamoDB table and notifies an SNS topic for SMS and email notifications. It also has an endpoint to query the table and to save and retrieve configuration values. This cloud infrastructure is all defined and deployed as Terraform code.
Finally, a Svelte web app hosted on GitHub pages queries the lambda backend and presents the data in a graph using Chart.js. The app also allows you to configure the sensor remotely.
The sensor with white ultrasonic ranger, green SIM7600E cellular breakout board, and red ESP32-S2 microcontroller. The water well with the sensor - for now - attached to pvc pipes. The web app showing the water level and battery voltage over time. CAD model of the case for the sensor with snap close tabs. I haven't been able to produce a proper print yet due to bed adhesion issues.