element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
microbit
  • Learn
  • Learning Center
  • STEM Academy
  • microbit
  • More
  • Cancel
microbit
micro:bit Blog [PROJECT] BBC Micro:bit – Water on the Floor - Sensor Alarm
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join microbit to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Catwell
  • Date Created: 18 Oct 2018 4:19 AM Date Created
  • Views 5126 views
  • Likes 7 likes
  • Comments 6 comments
  • learn
  • tutorial
  • project
  • microbit projects
  • microbit
  • on_campus
  • diy
  • bbc microbit
  • cabeatwell
  • stem projects
Related
Recommended

[PROJECT] BBC Micro:bit – Water on the Floor - Sensor Alarm

Catwell
Catwell
18 Oct 2018

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! image

 

 

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. image

 

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 BBC Micro:bit

1x Kitronik Inventor’s Kit

1x Buzzer from the Kitronik Inventor's Kit from above

Project Wires Female - Female (aka jumper wires)

Project Wires Female - Male

1x 10k ohm resistor

 

Video demonstration of the project:

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

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:

image

● 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.

image

 

 

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.

 

image

 

 

STEP 3

 

Wire up the schematic to the breakout board.

image

 

- Connect the buzzer to pins 0 and GND.

imageimage

 

- Connect a 10k ohm resistor to pins 1 and VCC.

imageimage

 

- Connect the wire test leads to pins 1 and GND.

imageimage

 

 

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.

image

 

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!

image

 

 

 

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!

http://twitter.com/Cabe_Atwell

Attachments:
microbit water sensor.zip
  • Sign in to reply

Top Comments

  • Catwell
    Catwell over 7 years ago in reply to shabaz +3
    That's what I'm saying, Shabaz. It's 2018.. we need sensors everywhere!
  • genebren
    genebren over 7 years ago +2
    Nice project. I could have certainly used something like this about a year ago. My kitchen sink developed a small link that went undetected until I noticed the water storage tank from my reverse osmosis…
  • neilk
    neilk over 7 years ago +2
    Hi Cabe, Nice project! Presumably with suitable electrodes you could adapt this to alarm when a potted plant gets too dry? Neil
  • Catwell
    Catwell over 7 years ago in reply to shabaz

    That's what I'm saying, Shabaz. It's 2018.. we need sensors everywhere!

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • shabaz
    shabaz over 7 years ago in reply to genebren

    We had a kitchen disaster about two months ago : ( Some tap had been replaced with a low-quality one (not my decision!) and the flexible pipe perished, and flooded everywhere! It was discovered within minutes, but by that time lots of water had been released! And there were mains sockets at a really bad location... a water sensor alarm could have helped!

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Catwell
    Catwell over 7 years ago in reply to genebren

    Gene,

     

    This is a good project to get familiar with the Micro:bit through.

    Let me know how it goes.

     

    C    

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Catwell
    Catwell over 7 years ago in reply to neilk

    I suppose so!

     

    You'd have to do some heavy testing with the code to make sure those plants don't suffer. image

     

    C

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • neilk
    neilk over 7 years ago

    Hi Cabe,

     

    Nice project!

     

    Presumably with suitable electrodes you could adapt this to alarm when a potted plant gets too dry?

     

    Neil

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube