Blog Post

Rainfall Alert


The mindsensors Grove Sensor Adapter makes it easy to use a variety of unique Grove sensors with the EV3. Our custom block makes it easy to read the sensor from your program. Here is an example of using it with the water sensor.


This project uses the Grove Water Sensor and the Grove Sensor Adapter. It's very simple to connect the sensor, adapter, and start displaying numbers on screen. Here we have one EV3 with the sensor connected. It records the detected water number and displays it on screen. A second EV3 acts as the remote monitor. It receives the water data over Bluetooth and displays an image based on that reading.

1023 is the maximum value the sensor will return, denoting absolutely no water detected. The number will decrease as more water reaches the sensor.

The idea is to leave the first EV3 outside, putting the water sensor in a small container. When it rains the container will start to fill with water, and the water sensor will detect that. Then the second EV3 (inside, on your desk) would get the message and show you the current water level. It wasn't raining today so we just used a mug of water to demonstrate.

Without water...

With water!

Now lets take a look at the program, one for each EV3.



First, we read the raw value from the sensor. This is the default Mindsensors GroveSensorAdapter block, no options need to be changed. Then we have a switch to display "Read error" if the sensor is not connected. Otherwise, we display the number on screen. If the value is less than 1000 we'll send True (water found), or False if it's above 1000 (no water). This value is sent to the EV3 named "Alarm" with the message name "Rain detected". Finally we wait a moment because the rain level shouldn't be changing that quickly. The hope is this will help save battery, by taking a longer break between readings. You may want to leave this delay low for flash floods! 


The Alarm program is also very simple. In an infinite loop, it reads the "Rain detected" message from the Sensor EV3. If it receives a True value then it Displays the full water graphic, otherwise it Displays the empty water image. Again, we use a Wait block because we don't need to be constantly checking.


While you can set up Bluetooth from your EV3 program, we found it more reliable to do so through the EV3 menu. First, go over to the settings menu (4th tab) and scroll down to Bluetooth.

Press Enter. Make sure both EV3s have Bluetooth on and Visibility set.

Select Connections and press Enter on Search.

Wait a moment while the EV3 searches for other Bluetooth devices.

Select the second EV3 from the list.

Select Connect.

Press Enter on both EV3s to confirm the connection.

Leave the default password on each, just press Enter.

Done! Your EV3s are now paired.

Go back to the programs tab and start the Sensor and Alarm programs on the EV3s.


Why not try adding a buzzer or some other from of alert when it starts to rain? You can find a related blog post here.


  • EV3 Block
    EV3 Block
  • EV3 Program
    EV3 Program
  • Grove Sensor Adapter product page
    Product Page
  • Grove Sensor Kit product page
    Product Page

Comments (2)

Allen M 05.12.2017
Hi Seth, this is another nice project. Thanks for sharing all of these. I only have one EV3, but maybe I can pair it to my NXT and use them together. I did have 3 NXTs, but the screen just went out on one and a puff of smoke came out of the other. I works, but there is a black area on the screen. I know the code will run on the NXT. I was thinking about using a cell phone with the EV3 or NXT. It would have to be paired by Bluetooth. I already have an app I wrote using MIT App Inventor for remote controlling my NXT. I could modify it to display the water alarm. I was originally thinking about the PIR Motion sensor after you had mentioned maybe using a cell phone at the end of that post.
Seth T 05.15.2017
Thank you! I'm not sure about the extent of the EV3's Bluetooth capabilities, but that definitely seemed to be a feature LEGO was pushing. Consider submitting a blog post of your own if you make something! For your NXT with a broken screen, you may want to consider trying "NeXT Screen" from BricxCC.
Please Login to add your comments

Featured Posts

The mindsensors Grove Sensor Adapter makes it easy to use a variety of unique Grove sensors with the...

Read more

The mindsensors Grove Sensor Adapter makes it easy to use a variety of unique Grove sensors with the...

Read more


  • What do you use to program your FRC Robot?