Table of contents
Abstract
A TDK USSM ultrasonic sensor paired with Arduino MKR 1010 to measure water levels, record data in Google Sheets, and send alerts when danger levels are detected.
Project
You ever stood by a river after a long night of rain?
The air smells like wet soil, frogs are losing their minds, and the water looks calm… until it’s not.
That’s where this project started.
One evening last monsoon, I watched a lot of news regarding river flood in some states , bikes were stalled, people were pushing carts through knee-deep water, and the power cut out.
So yeah, that’s what pushed me to build a river water monitoring and flood warning system using TDK Ultrasonic Sensors .
I came across the TDK In-Reach Ultrasonic Sensing Challenge on Element14 and thought, “Wait… that’s exactly the kind of tech that could help.”
Perfect for tracking how close the water is to trouble.it could give people a few extra hours to move to safety. And in a flood, a few hours can make a huge difference.
(Image: TDK kit photo)

Here’s what I’m building:
- A TDK USSM ultrasonic sensors mounted above a river or Water body.
- An Arduino MKR WiFi 1010 that reads water levels from sensors and sends data to Google Sheets (yep, good old Sheets—simple, free, works).
- A Google Apps Script that emails alerts when levels go past a threshold.
So basically, it’s a mini early warning station in a waterproof box that can be deployed in quick pace to any desired location for flood tracking.
Think of it as the river’s way of texting you: “Hey buddy, I’m rising fast.”
I’m not a big corporation or a disaster management expert. I’m just someone who got tired of watching small floods cause big chaos.
People lose things they can’t replace—photos, furniture, sometimes entire homes—because no one tells them in time.
If a simple sensor and a Wi-Fi board can give them that heads-up… why not build it?
What Makes This Special
This isn’t just about distance sensing. It’s about turning that distance into action.
Every reading is logged, timestamped, and compared against a threshold stored in a Google Sheet.That can be used as Data Analysis also in future to predict floods even before water level crosses the danger mark for flood.
Every good project needs a brain.
But the real magic? That’s in the flow — how information moves from sensors to the cloud and back.
This blog is all about that invisible choreography. The part you don’t really see but totally depends on.

Working of my Project
Let’s break it down.
Imagine water rising in a river.
Here’s what happens, step by step, inside my setup:
- TDK Ultrasonic Sensors measure water level distance from Sensor which is placed at Danger line marking.
- Arduino will Connect to wifi. If not connected it will keep trying until its connected.
- Once wifi connected it will fetch the google sheet Named “TDK-MKR-Logger’ tab “ConfigDetails”
- From there it will fetch the THRESHOLD_VALUE and POST_INTERVAL_MS parameter
- THRESHOLD_VALUE will define the alarming water level to send upcoming flood alert
- POST_INTERVAL_MS will tell the frequency of distance measurement i.e. interval after which distance is measured
- Arduino will keep measureing distance of water level from Danger mark at fixed time interval (POST_INTERVAL_MS ) from TKD Sensors. It packages that info into a neat little JSON payload .
- Then send this distance to Google sheet. payload is sent via HTTPS POST to my Google Apps Script Web App . The script logs it in Google Sheets under the “DataLog” tab.
- When distance from water level is received by google sheet it will check if Distance is less than threshold ?
if yes then it will send alert to Predefined Email addresses stored in “Email_list” Tab in sheet. - I keep configuration in google sheet so that in case if you want to change the threshold level or frequency of measurement taken , yoou don’t need to go to riverbed or waterbody and take Arduino out of box and reprogram it. Just simply change configuration details in google sheet and it will work . no need to reprogram Arduino for each time we change Flood parameters Configuration.
The System at a glance
So when the water rises, this happens in about 3–4 seconds:
- Sensor sees distance drop
- Arduino detects it’s below threshold
- JSON sent to script
- Sheet updates
- Email alert sent
- Arduino confirms
From splash to inbox — all automated.
Why This Flow Works
It’s modular, lightweight, and transparent.
- Change the cloud? Just update the endpoint URL.
- Change sensors? Code barely changes.
- No complex cloud subscription, no hidden dependencies.
- Can be created multiple such small packets of devices at different places of the water body or river with unique names so can be get more clear picture of flood estimation
It’s simple enough for DIYers, yet structured enough for scaling. But for now we will be focused only on our useful tiny Project.
Alright — time for the slightly nerdy, very satisfying bit.
This is where the sensors stop being lonely hardware and start sending real data to the cloud.
No smoke. No drama. Just packets, spreadsheets, and the occasional garbage value that makes you laugh and cry.
The simple goal — in one line
Read water level. Send it. Get an alert if things go wrong.
What I stitch together here
- Arduino MKR WiFi 1010 — the brain and Wi-Fi radio.
- TDK Eval board + USSM sensors — they do distance sensing.
- Google Sheets — the datastore and quick dashboard.
- Google Apps Script — the tiny web API that accepts posts and emails alerts.
Think: sensor → MKR → HTTPS POST → Apps Script → Sheet → emails.
That chain is the whole system.
Why Google Sheets? (Spoiler: Because it’s fast)
Sheets is free, easy, and everyone knows it.
You don’t need a server or a database yet.
For a prototype and a competition demo, it’s perfect.
Later we can swap it for a proper backend. But right now — speed wins.
Server-side: Apps Script doPost
On the Google side, doPost(e) checks:
- JSON parse ok?
- api_key matches?
- value is numeric?
- alert_requested true AND value compared vs THRESHOLD_VALUE in the sheet?
If conditions match, it sends email(s) and writes Alert Sent @ TIMESTAMP into the DataLog row.
Create a google sheet "TDK-MKR-Logger" with 3 tabs.
tab1 named "ConfigDetails"

Tab 2 "Email_list"

Tab 3 "DataLog"

Click on Extensions and select Apps Script

Copy and Paste code.gs Code into it. find it inside zip folder i have uploaded
Deploy
Select New Deployment> in description type any thing you want >in Who has access select anyone >Click Deploy > from there a web URL will be created. Copy it and save for next part of arduino mkr 1010 Programming.
So the fun part begins — wires, boards, and the faint smell of solder.
This is where the project goes from “cool idea” to “actual blinking lights.”
Here in this blog we will discuss the wiring of all components and the Code inside the Arduino Board.
Circuit Arrangement:

Required Hardware:
- TDK USSM Distance measurement sendor — the stars of the show.They send ultrasonic pings and measure how long it takes for echoes to come back.
- Arduino MKR WiFi 1010 — the brain that reads data, processes it, and sends it to the online google sheet for collection anf furture analysis as well as initiate warning email when danger mark is near.
- BS170 MOSFET , 15 k Ohm Resistance , used for logic level converter to safely operate our arduino
- LM2596S DC-DC Buck Converter Power Supply to poweup the sensor with 12 v
- A bunch of colorful jumper wires — because what’s a DIY project without a rainbow of cables?



Open Arduino IDE and Upload following code into it
use code early_flood_warning_monitoring_system.ino and arduino_secrets.h inside zip file uploaded
Testing the Flood Warning System by prototype assembly
So, this is it. The moment of truth.
After weeks of code, cables, and caffeine, it was time to see if my little flood warning system could actually handle the real world.
Spoiler: it didn’t catch fire. So, that’s already a win.


Setting the Scene
It was a Sunny morning — the perfect “let’s see what the water does” day. as this is winter time so not much changesin water level of river so decide to check it in a bucket filled with water. hwere i can rapidaly increase or decrease water level.
it is working good.
Google sheet Data LLog
email alert screen shot
.
For Now System is working good.