Even being bathing in technology, my sink still leaks, and I don’t know until it’s flooded in the cupboard. It’s almost ridiculous to NOT know when your basement is flooded. Tubs, washing machines, even the refrigerator could leak at any time.
Anxiety is the inspiration for this Micro:bit project.
This is version one of the water sensor. In other words, the simplest way of alarming someone when water is detected. A flashing light and buzzing speaker is what this project will do when water is detected. I suppose one would have to be in earshot to hear it. I figure you’ll eventually hear it at some point. If an old beeping watch used to have us hunting for the noise, this will work too!
The software works as follows:
- The Micro:bit sits and waits to detect a change is resistance, short to ground, on pin 3.
- Once the fluid is detected the LED screen will flash, and the buzzer or speaker will start sounding. That means something is flooded!
- You can reset the system by pressing one of the buttons. Or, of course, unplugging it.
First, let’s gather all the necessary components you’ll need to build this project.
Being able to place the sensor in a remote place might be important. I am recommending a battery pack. I used 2x AA rechargeable batteries out of curiosity; if rechargeable AA cells are usually at 1.2V, will it be enough to power everything at 2.4V or less, without issues? --- The answer is, yes, it’s fine.
However, if you want this thing to sit for a long time, you’ll need a bigger battery pack or a way to plug it in somewhere.
1x Buzzer from the Kitronik Inventor's Kit from above
Project Wires Female - Female (aka jumper wires)
Project Wires Female - Male
Video demonstration of the project:
Excuse the audio levels, I'm an engineer, not a filmmaker.
STEP 1
Load the code onto the Micro:bit.
I am providing the hex file you need to drag and drop onto the Micro:bit, and the python code as two separate files. For the below process, just use the hex file.
Plug the MicroUSB cable into the Micro:bit, and plug the other end of the cable to a PC or MAC.
At this point, you are going to copy over the code to the Micro:bit. I am providing the program (code) in this posts that needs to be copied over. When the Micro:bit plugs into a computer, it shows up as a USB flash drive. All you have to do is copy the file over to the Micro:bit, like it’s a USB Flash Drive, and the Micro:bit will reset, and the program is active.
You could leave it plugged into your computer for testing, or in case you want to an alert to your water cooling system leaking inside the case. Though, I would imagine you’d know if that happened right away without the sensor.
A little bit about the code:
● There is a variable called “RESISTANCE_LEVEL.” It is used to determine how sensitive the system is to water. At 1000, it would sound off to the conductivity of human skin.
The circuit acts as a voltage divider. The voltage is measured between the test source (water) and the 10k ohm resistor. The “sensor” is connected to the ADC input, showing voltages between 0 and 3.3V read in 0-1023 values.
Resistivity fun facts: Human skin is around 100k ohms on a dry surface. Broken or wet skin is around 1k ohms. Pure water, surprisingly, is up near 8 to 10M ohms per centimeter.
However, most water that would be leaking in a sink or basement isn’t pure, it’ll probably be around 10 to 30k ohms. In this project, that would read as a value of 500 to 800.
● No, I didn’t make the cool musical tones used in this project. They are from the existing BBC Micro:bit library.
A simple "import music" in the declaration will give you access to a lot of sounds.
STEP 2
I used jumper wires to connect everything quickly and cleanly. It’s great for testing and setting up where space and reliability isn’t an issue. I would recommend soldering all the wires together if where you are sensing water is critical. Wire fall out of breadboards all the time.
But for an initial build of the project, stick with the jumper wires.
Lay the Micro:bit and Kitronik Inventor’s Kit on a table. Insert the edge-card end of the Micro:bit into the Inventor’s Kit socket.
STEP 3
Wire up the schematic to the breakout board.
- Connect the buzzer to pins 0 and GND.
- Connect a 10k ohm resistor to pins 1 and VCC.
- Connect the wire test leads to pins 1 and GND.
STEP 4
Plug the battery pack or 5V wall adapter to the Micro:bit.
The system will turn on and make a tone, and it will immediately begin testing for water.
STEP 5
Get a cup of water and test it out. Touch the two water test leads to water in the cup.
The screen will animate, and the buzzer will go off. You’ve just detected the water!
Conclusion
It’s a brute force answer to the flood problem. I like it as a whole.
What size battery would I need for a year’s worth of monitoring? I calculate that I would need about 53,000 mAh. This isn't an impossibility. I have seen many USB battery packs that bolt 50,000 mAh. So, it's possible.
You could also do the following:
- Make a bunch of water probes, just connect them to the same pins on the Micro:bit. This way you can test a few different points with the same system.
Thanks for checking this out!
Top Comments