Electronic Project 31: A simple guide on how to use Humidity –Temperature sensor as a rain sensing device with a buzzer alarm

in #utopian-io7 years ago (edited)

What Will I Learn?

At the end of this tutorial:

♦ The readers will be able to create a circuit using the humidity – temperature sensor in detecting rain

♦ The readers will be able to know how the circuit works.

♦ Learn to apply the circuit in the future electronic projects

Introduction

In this tutorial, we will know how to use the humidity –temperature sensor in sensing rain. You can use this rain sensing circuit in your future electronic projects that needs the function of this circuit. When there is rain, a sound signal or a light signal will be displayed.

You can read more about Humidity –Temperature Sensor Here

image

Requirements

Electronic Components

♦ Arduino Uno

♦ Humidity – Temperature Sensor

♦ Resistor

♦ Transistor

♦ LED

♦ Buzzer/Speaker

♦ Breadboard

♦ Connecting wires

Software

♦ Fritzing application

Difficulty

♦ Advance

Tutorial Contents

Using the fritzing software, we will create our circuit diagram, arduino codes and prototype using the breadboard

Part I. Schematic Diagram

So first let us construct our circuit diagram.

image

Select the electronic components needed for the circuit in the fritzing library. We need 1 arduinouno, 1 Humidity Temperature Sensor, 1 LED, 1 Buzzer, 1 transistor, 1 buzzer and 4 resistors.

image

Arrange the components before constructing the circuit.
In arranging the components, place all the components for the input side (left side) of the arduino and the components for the output side (right side).
In this tutorial the input component will be the humidity –temperature sensor that will be connected to our microcontroller.

image

Now let us construct our circuit diagram.

At the input side of our circuit, we have the humidity temperature sensor. This sensor has three pins, 1 for source voltage, one for the output data signal and for ground terminal. So we will connect these three respectively, source voltage from the arduino, data signal for pin A2 and resistor directed to the ground.

image

While at the output side of our circuit, we have the pin output number 13. This pin will be connected to our amplifier circuit as an input signal. We need to amplify the output signal so that it can drive our external circuit.

image

Our external circuit is consist of an LED in series with the led and connected it to a buzzer in a parallel connection. We need to put a series resistor to the led in order to limit the flow of current and to avoid damaging the led.
Then the amplified output at the collector terminal will be connected to our external circuit as an input signal.

image

Now this is our final circuit diagram.

image

When the humidity sensor triggers or when there is rain, or a water drop, it will send data signal to the input pin of our microcontroller. Make sure that the sensor will be placed outside where it can be easily exposed or hit when there is rain.

image

This data signal will now triggers the microcontroller to give output at pin 13 based from our programmed codes. This output signal is then fed to the amplifier circuit to be amplified.

image

The amplified signal at the collector terminal is connected to the external circuit as input. Our external circuit is the led and the buzzer that is connected in parallel. The amplified signal will drive this circuit allowing led to give lights and the buzzer to give sound.

image

Part II. Code

Now let us do programming of our Arduinouno.
Click on code to start.

image

The input pin for our microcontroller from the humidity sensor is analog pin 2 and the output pin is 13.

inthumidPin = ;   // select the input pin for the humidity-temperature sensor
intresPin = 13; // select the pin for the base resistor

image

void setup() {
  // declare each Pin as an INPUT:
pinMode(humidPin, INPUT);
// declare each pin as an OUTPUT:
pinMode(resPin, OUTPUT);
}

image

int rain = 0; //initial value when there is rain

image

void loop() {
  // read the humidity sensor  and store it in the variable rain
rain = digitalRead(humidPin);
if(rain == 1)
//when there is no rain
digitalWrite(resPin, LOW);
//delay 1 second
delay(1000);
//when there is rain
if (rain == 0)
digitalWrite(resPin, HIGH);
//delay 1 second
delay(1000);
}

image

Here are our arduino codes.

inthumidPin = 2;   // select the input pin for the humidity-temperature sensor
intresPin = 13; // select the pin for the base resistor
void setup() {
  // declare each Pin as an INPUT:
  pinMode(humidPin, INPUT);
// declare each pin as an OUTPUT:
pinMode(resPin, OUTPUT);
}
int rain = 0; //initial value when there is rain
intmeasuredvalue = 0; //measured value when there is rain
void loop() {
  // read the humidity sensor  and store it in the variable rain
rain = digitalRead(humidPin);
if(rain == 1)
//when there is no rain
digitalWrite(resPin, LOW);
//delay 1 second
delay(1000);
//when there is rain
if (rain == 0)
digitalWrite(resPin, HIGH);
//delay 1 second
delay(1000);
} 

Part III. Breadboard

Click on the breadboard.

image

Arrange each component in the breadboard before connecting.

image

Now connect each component if you don’t know how to connect using breadboard just read my previous tutorial about how to construct a circuit in the breadboard

image

Application

The readers can create their own rain detection circuit or can make a project that needs the functionality of this circuit like this example below.

link source

Curriculum

Here are my other tutorials for electronic projects.

ELECTRONIC PROJECTS

Tutorial 1

Tutorial 2

Tutorial 3

Tutorial 4

Tutorial 5

Tutorial 6

Tutorial 7

Tutorial 8

Tutorial 9

Tutorial 10

Tutorial 11

Tutorial 12

Tutorial 13

Tutorial 14

Tutorial 15

Tutorial 16

Tutorial 17

Tutorial 18

Tutorial 19

Tutorial 20

Tutorial 21

Tutorial 22

Tutorial 24

Tutorial 25

Tutorial 26

Tutorial 27

Tutorial 28

Tutorial 29

Tutorial 30



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Hey @rfece143 I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Coin Marketplace

STEEM 0.17
TRX 0.15
JST 0.029
BTC 62228.71
ETH 2419.51
USDT 1.00
SBD 2.57