Rain Notifier using Arduino

Here in the Philippines it always rain spontaneously. This learning guide will show you on how you can create your rain notifier using an Arduino board. So that, before you go out, the device will inform you that it is raining and it is time to bring your umbrella. Or if you have clothes that left hanging out outside, you can now store inside.

Components

We have used a SIM800 shield for easy mounting on the Arduino board. SIM808 is a GSM and GPS two-in-one module. It is produced by SIMCOM, supports GSM/GPRS Quad-Band network and combines GPS technology for satellite navigation.

Connecting Everything

Since we will be using a shield, all we need to do is to mount the shield on top of the Arduino Uno board. Make sure that headers are aligned when placing it on top.

Next is the DFRobot’s rain sensor, we have opted to use a module instead. Since this module has 3 wires namely; Power, Ground, Signal. The power pin goes to the 5V of the Arduino board. The ground goes to GND pin of the board. Lastly, the Signal pin goes to the A0 pin.

We need power-up everything. 2 sets of 18650 battery in series making it 7.2 volts. The batteries is placed on a dual holder.

Using a DC Male Power adapter, we can easily plug the power to the Arduino power supply. Remember that the red wire is for + side and the black wire is for – side of the adapter. The Arduino board is center-positive DC Male Power Adapter.

The whole setup will look like this.

Codes

We need to use a sim808 library, assign the recipient’s number, and create the message.

See also  Location GPS Tracker Meeo IoT

Don’t forget the sim card and it should have credits!


#include <DFRobot_sim808.h>
#include <SoftwareSerial.h>

//Mobile phone number,need to change
#define PHONE_NUMBER "+639000000000" // number of your simcard  
 
//The content of messages sent
#define MESSAGE "rain detected !"

DFRobot_SIM808 sim808(&Serial);

int rainSteamPin = A0;
boolean haveRain = false;

void setup() {
  Serial.begin(115200);
 
 //******** Initialize sim808 module *************
  while(!sim808.init()) {
      delay(1000);
      Serial.print("Sim808 init error\r\n");
  }  
  Serial.println("Sim808 init success");

}

void loop() {
  int rainSteamSensor = analogRead(rainSteamPin);
 
  if(rainSteamSensor >= 150){
    if(!haveRain){
      Serial.println("send sms");
      haveRain = true;
      sim808.sendSMS(PHONE_NUMBER,MESSAGE); 
    }
  }else{
    if(haveRain){
      haveRain = false;
    }
  }
}

Is that an easy thing to do?

Now that you have learned to use the GSM capabilities of an Arduino board, it is time that you can extend this project. You can make your own notifier on other weather conditions or something indoor like someone opened the light switches on your room.

Leave a Reply