Rain Detector Using Arduino And Raindrop Sensor

About the project

In this tutorial we will learn how to detect a rain using a rain sensor and make a sound using a buzzer module and OLED Display and Visuino.

Project info

Difficulty: Easy

Platforms: ArduinoSparkFunVisuino

Estimated time: 1 hour

License: GNU Lesser General Public License version 3 or later (LGPL3+)

Items used in this project

Hardware components

Breadboard (generic) Breadboard (generic) x 1
Jumper wires (generic) Jumper wires (generic) x 1
Buzzer Buzzer x 1
ElectroPeak 0.96" OLED 64x128 Display Module ElectroPeak 0.96" OLED 64x128 Display Module x 1
Arduino UNO Wifi Rev.2 Arduino UNO Wifi Rev.2 x 1
SparkFun Rain sensor module SparkFun Rain sensor module x 1

Software apps and online services

Visuino Visuino
Arduino IDE Arduino IDE

Story

In this tutorial we will learn how to detect a rain using a rain sensor and make a sound using a buzzer module and OLED Display and Visuino.

Watch the video.

Step 1: What You Will Need

1 / 5

Arduino UNO (or any other Arduino) 

Rain sensor module, 

Jumper wires

Breadboard 

OLED Display

Piezo buzzer 

Visuino program: Download Visuino

Step 2: The Circuit

  • Connect OLED Display pin[VCC] to Arduino pin[5V]
  • Connect OLED Display pin[GND] to Arduino pin[GND]
  • Connect OLED Display pin[SDA] to Arduino pin[SDA]
  • Connect OLED Display pin[SCL] to Arduino pin[SCL]
  • Connect Arduino 5V to piezo buzzer module pin VCC
  • Connect Arduino GND to piezo buzzer module pin GND
  • Connect Arduino digital pin 2 to piezo buzzer module pin S (signal)
  • Connect Arduino 5V to rain sensor module pin VCC
  • Connect Arduino GND to rain sensor module pin GND
  • Connect Arduino analog pin 0 to rain sensor module pin A0

Step 3: Start Visuino, and Select the Arduino UNO Board Type

1 / 2

To start programming the Arduino, you will need to have the Arduino IDE installed from here: https://www.arduino.cc/.

Please be aware that there are some critical bugs in Arduino IDE 1.6.6. Make sure that you install 1.6.7 or higher, otherwise this tutorial will not work! If you have not done follow the steps in this tutorial to setup the Arduino IDE to program Arduino UNO! The Visuino: https://www.visuino.eu also needs to be installed. Start Visuino as shown in the first picture Click on the "Tools" button on the Arduino component (Picture 1) in Visuino When the dialog appears, select "Arduino UNO" as shown on Picture 2

Step 4: In Visuino ADD Components

1 / 3

  • Add "OLED Display" component
  • Add "Digital (Boolean) Inverter (Not)" component
  • Add "Delay" component

Step 5: In Visuino Set Components

1 / 3

  • Double click on the DisplayOLED1 and in the elements window drag "Draw text" to the left side..
  • In the properties window set size to 2, text to: RAINING! and Y to 20Close the elements window
  • Select Delay1 and in the properties window change interval to 3000000

Step 6: In Visuino Connect Components

1 / 2

  • Connect Arduino analog pin 0 to Inverter1 pin In
  • Connect Inverter1 pin Out to Delay1 pin Start and DisplayOLED1>Draw Text1 pin Clock and Arduino Digital pin 2
  • Connect Delay1 pin Out to DisplayOLED1>Fill Screen1 pin Clock
  • Connect DisplayOLED1 pin I2C Out to Arduino board pin I2C In

Step 7: Generate, Compile, and Upload the Arduino Code

In Visuino, at the bottom click on the "Build" Tab, make sure the correct port is selected, then click on the "Compile/Build and Upload" button.

Step 8: Play

If you power the Arduino UNO module, and drop some water on the rain sensor the LED display should start showing the text "RAINING!" and the buzzer module should make a sound.

Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this tutorial, you can download it here and open it in Visuino: https://www.visuino.eu

Rain-sensor-oled.zip

Schematics, diagrams and documents

Visuino File

Code

Visuino File

Credits

Photo of Ron

Ron

Arduino Developer

   

Leave your feedback...