0

members

Easy Basics: Project 008h Water level sensor and 5V relay module

of Acoptex.com in UNO

Basics: Project 008h

Project name: Water level sensor and 5V relay module

Tags: Arduino Uno, water sensor, water level sensor, 5V relay module

Attachments: sketch

WARNING – THIS PROJECT INVOLVES HIGH VOLTAGES THAT CAN CAUSE SERIOUS INJURY OR DEATH. PLEASE TAKE ALL NECESSARY PRECAUTIONS, AND TURN OFF ALL POWER TO A CIRCUIT BEFORE WORKING ON IT. WE ARE NOT RESPONSIBLE FOR ANY DAMAGE, INJURY, DEATH AND OTHER THINGS CAUSED BY THIS PROJECT IMPLEMENTATION. 

In this project, you needed these parts (Dear visitors. You can support our project buy clicking on the links of parts and buying them or donate us to keep this website alive. Thank you):

1.Arduino Uno R3 (you can also use the other version of Arduino)

2.Water level sensor module 1pc

3.Arduino IDE ( you can download it from here  )

4.Jumper cables F-M, M-M

5.Breadboard 1 pc

6. 5V relay module 1pc

General

We will learn how to connect water level sensor and 5V relay module to Arduino board and use them.

Understanding the 5V relay module

See more information here.

Understanding the water level sensor module

Water level sensor module is designed for water detection, which can be widely used in sensing the rainfall, water level, even the liquate leakage. The brick is mainly comprised of three parts: An Electronic brick connector, a 1 MΩ resistor, and several lines of bare conducting wires. This sensor works by having a series of exposed traces connected to ground and interlaced between the grounded traces are the sens traces. The sensor traces have a weak pull-up resistor of 1 MΩ. The resistor will pull the sensor trace value high until a drop of water shorts the sensor trace to the grounded trace. Believe it or not this circuit will work with the digital I/O pins of your Arduino or you can use it with the analog pins to detect the amount of water induced contact between the grounded andsensor traces. This item can judge the water level through with a series of exposedparallel wires stitch to measure the water droplet/water size. This item can easily change the water size to analog signal, and outputanalog value can directly be used in the program function, then to achievethe function of water level alarm.This item have low power consumption, and high sensitivity, which are the biggest characteristics of this module.

You can see datasheet here.

Features:

  • Working voltage: 5V
  • Working Current: <20ma3
  • Interface: Analog
  • Width of detection: 40mm×16mm
  • Working Temperature: 10℃~30℃
  • Weight: 3g
  • Size: 65mm×20mm×8mm
  • Arduino compatible interface
  • Low power consumption
  • High sensitivity
  • Output voltage signal: 0~4.2V

Signals and connections of the 5V relay module

The SRD-05 VDC-SL-C relay has three high voltage terminals (NC, C, and NO) which connect to the device you want to control. The other side has three low voltage pins (Ground, Vcc, and Signal) which connect to the Arduino.

NC: Normally closed 120-240V terminal

NO: Normally open 120-240V terminal

C: Common terminal

Signals and connections of the water level sensor

"S" stand for signal input (analog)

"+" stand for power supply (+5V)

"-" stand for GND

If you do not have marking on the back of water level sensor module - not a problem. You can print this marking

attach and cover it with silicon to the back of sensor. Just make sure that silicon is dry andbe careful do not use silicon on other side as it will damage the sensor.

Wiring

WARNING – THIS PROJECT INVOLVES HIGH VOLTAGES THAT CAN CAUSE SERIOUS INJURY OR DEATH. PLEASE TAKE ALL NECESSARY PRECAUTIONS, AND TURN OFF ALL POWER TO A CIRCUIT BEFORE WORKING ON IT. WE ARE NOT RESPONSIBLE FOR ANY DAMAGE, INJURY, DEATH AND OTHER THINGS CAUSED BY THIS PROJECT IMPLEMENTATION. 

Let us build a water level sensor controlled relay circuit that will turn on a pump when the water level will be high. The relay has two different types of electrical contacts inside – normally open (NO) and normally closed (NC). The one you use will depend on whether you want the 5V signal to turn the switch on or turn the switch off. The 120-240V supply current enters the relay at the common (C) terminal in both configurations. To use the normally open contacts, use the NO terminal. To use the normally closed contacts, use the NC terminal.We will use NO (Normally open)configuration, when the relay receives a LOW signal the 120-240V switch closes and allows current to flow from the C terminal to the NO terminal. A HIGH signal deactivates the relay and stops the current. So if you want the HIGH signal to turn ON the relay, use the normally open terminal.

Make sure that the high voltage connections to the 5V relay module are very well secured. Identify the hot power wire (red wire in the diagram above) in the cord leading to the PUMP and make a cut. Connect the side leading to the PUMP to the NO terminal of the 5V relay, and the side leading to the plug to the C terminal. This way the relay is on the hot side, and current is switched before it reaches the PUMP. It’s dangerous to put the relay on the neutral wire, since if the device fails current can still fault to ground when the relay is off.

The following picture shows the needed connections with the Arduino Uno 

1. For analog signal

2. For Digital signal


Code

The output can be a digital signal LOW or HIGH, depending on the water level. If the water level exceeds a certain predefined threshold value, the module outputs LOW, otherwise it outputs HIGH. 

The output can be a analog signal and so you’ll get a value between 0 and 1023.

Step by Step instruction

  1. Do wiring.
  2. Open Arduino IDE.
  3. Plug your Adruino Uno board into your PC and select the correct board and com port
  4. Open up serial monitor and set your baud to 9600 baud
  5. Verify and upload the the sketch to your Adruino Uno
  6. Do calibration. Take a paper and write down readings of the sensor and the water level in mm or inch  (for example, 0mm -0, 5mm - 223, 10mm - 251, 20mm - 294, 30mm - 314, 40mm - 333).
  7. Open the serial monitor and you will see water level sensor readings. If the water level exceeds a certain predefined threshold value, the pump will be on and switch off  if water level drops.

Summary

We learnt how to connect water level sensor and 5V relay module to Arduino board and use them.

Libraries:

  • No libraries required for this project

Sketch:

  • See attachment on the begining of this project


Other projects of Acoptex.com
Easy Merry Xmas to everyone of Acoptex.com, Not selected 24-12-2019

Published at 20-11-2017
Viewed: 3392 times