You are on page 1of 80

www.circuitmix.

com
www.circuitmix.com
Learn Arduino Sensor With
Projects For Beginners
By James Conner

TABLE OF CONTENT:

1. Touch Sensor
2. Temperature Sensor LM35
3. Light Dependent Resistor(LDR)
4. Humidity plus Temperature Sensor Module
5. Moisture Sensor
6. Water / Rain / Liquid Sensor Module
7. Accelerometer Sensor
8. IR Infrared Obstacle Avoidance Sensor Module
9. Ultrasonic Sensor
10. HC-SR501 Pyroelectric Infrared Sensor Module

www.circuitmix.com
1.TOUCH SENSOR

Unlike pushbuttons, a touch sensor is activated due to bodily contact. It is especially touchy and can
experience distinctive contact modes i.e single tapping, long contact and swipe etc.
Touch Dimmer Switch Circuit using Arduino:
A Touch Dimmer Switch Circuit is a simple project, where the dimmer action is finished with the
help of a Touch Sensor. While a everyday swap is used to without a doubt turn ON or OFF a light, a
Dimmer (or Dimmer Switch) will enable us to control the brightness of the light. Without a Dimmer
Switch, the mild bulbs tend to glow at full brightness eating most power. If full brightness is not
required, then Dimmer Switches can be used and store some energy. With the assist of a Dimmer
Switch, we can fluctuate the brightness from absolutely off to thoroughly on.

Different mild bulbs want different dimmer switches and there are one of a kind types of Dimmer
Switches on hand in the market. Some of the normally located Dimmer Switches are Slider kind and
rotary type.

In this project, we have designed a Touch Dimmer Switch the use of Arduino. The Touch Dimmer
Switch Circuit is applied the usage of a Touch Sensor. The circuit design, elements and working of
the mission is defined in the following sections.

www.circuitmix.com
touch dimmer switch3

touch dimmer switch1

www.circuitmix.com
touch dimmer switch 2

touch dimmer switch3

www.circuitmix.com
Circuit Diagram of Touch Dimmer Switch Circuit

www.circuitmix.com
Components Required for Touch Dimmer Switch Circuit
Arduino UNO
Touch Sensor
2N2222 NPN Transistor
Small Bulb
1 KΩ Resistor
Breadboard
Connecting Wires
Component Description

Arduino UNO: In this project, Arduino UNO is used to realize the output from the touch sensor and
www.circuitmix.com
correspondingly pressure the bulb.

Touch Sensor: A Touch Sensor is a kind of sensor that detects bodily contact or proximity. They are
enter devices like buttons and switches however are greater sensitive than those two. Hence, contact
sensors are replacing buttons in devices like cell phones and laptops.

There are extraordinary sorts of contact sensors like resistive touch sensors, capacitive touch sensors,
piezo contact sensors etc. The most frequent one is the capacitive type touch sensor and we have used
one in this project.

The benefit of touch sensors is that with a single sensor, we can get a couple of operations like swipe,
faucet and pinch. The working of a touch sensor (Capacitive kind to be specific) is simple.

Basically, it detects the trade in capacitance of the sensor when we contact it. Additionally, some
sensors can become aware of these modifications in capacitance besides the physical contact
however when the finger is placed barely near to the sensor.

The touch sensor used in this assignment is primarily based on TTP223 Touch Pad Detector IC. This
unique IC can become aware of 1 key contact and the sensor can be used as substitute for standard
button in a broad vary of purchaser products. For additional data related to the Touch Pad Detector IC
and the circuit of the touch sensor, refer the datasheet of TTP223.

The output of the touch sensor will be good judgment HIGH when we location our finger on the touch
plate. We will use this logic in the programming section of the Arduino.
www.circuitmix.com
How to Design Touch Dimmer Switch Circuit ?

The diagram of the Touch Dimmer Switch Circuit is very simple and is defined here. The contact
sensor is given the energy provide through connecting 5V to VCC and ground to GND pins. The SIG
pin of the touch sensor is related to any of the digital input / output pin of the Arduino UNO board.
Here, it is related to digital I/O pin 8.

Next, we will connect a small incandescent bulb that glows on DC. The bulb is interface with the
Arduino UNO board with the assist of a transistor. So, first connect the base of a transistor like
2N2222 to any digital I/O pin of Arduino UNO with the help of a cutting-edge limiting resistor.
Then join the collector terminal of the transistor to the 5V electricity supply. And finally, join a bulb
between the emitter and floor terminals. This completes the sketch of the circuit.

Working of the Touch Dimmer Switch Circuit

As mentioned earlier, there are many types of dimmer switches for one-of-a-kind kinds of bulbs. In
this project, a easy contact dimmer change circuit is designed. The working of the task is defined
here.
When the sensor is not touched, the SIG pin of the sensor stays LOW. Whenever we contact the touchy
part of the touch sensor, the SIG pin of the sensor goes HIGH. Since it is connected to Arduino UNO,
we will discover this change in kingdom i.e. LOW to HIGH.
So, when the finger is positioned on the touch sensor, Arduino UNO detects the change in the good
judgment country of the sensor’s output and pressure the bulb using Pulse Width Modulation (PWM).
Hence, the bulb is linked to a PWM pin of the Arduino UNO.
As we continue to region the finger on the contact sensor, Arduino UNO slowly will increase the
depth of the bulb with the assist of PWM. In the project, we used a tiny bulb as shown in the
following image alternatively of a big incandescent bulb.

www.circuitmix.com
This system continues till the finger is lifted or maximum brightness is reached i.e. the bulb is utterly
ON. In order to reduce the brightness of the bulb, double faucet and on the double tap, proceed to
vicinity the finger on the contact sensor.
Arduino UNO is programmed such that, if a double faucet is detected (two touches with a very small
delay) it has to minimize the brightness of the bulb and for this reason appearing as a dimmer switch.
Similar good judgment of PWM is used for lowering the brightness of the bulb where, when
continued to area the finger on the double tap (tap once and tap and keep the finger on 2nd tap), the
depth of the bulb progressively decreases till the finger is lifted or the bulb reaches minimum
brightness i.e. it is absolutely OFF. This is how a Touch Dimmer Switch circuit the usage of Arduino
works.

Code:

int led = 3;
www.circuitmix.com
int sen=8;
int val=0;
void setup()
{
pinMode(sen,INPUT);
pinMode(led,OUTPUT);
digitalWrite(sen,LOW);
digitalWrite(led,LOW);
}
void loop()
{
while(digitalRead(sen)==LOW);
while(digitalRead(sen)==HIGH)
{
while(digitalRead(sen)==HIGH)
{
if(val<=255)
{
analogWrite(led,val);
val++;
delay(15);
}
}
delay(1000);
while(digitalRead(sen)==HIGH)
{
if(val>=0)
{
analogWrite(led,val);
val--;
delay(15);
} www.circuitmix.com
}
}
}
Applications:

A easy Digital Touch Dimmer Switch Circuit is applied in this challenge with the help of a Touch
Sensor and Arduino UNO.
This Touch Dimmer Switch can be used to control the brightness of a bulb by using genuinely touching
the sensor.
Can exchange common Dimmer Switches like slide swap or rotary kind switch for bulbs.
In order to use the contact dimmer change with AC incandescent bulbs, dedicated ICs like TT6061A
can be used.

2.Temperature Sensor LM35

LM35 is one of the popular temperature IC. It is used to measure surroundings temperature in the form
of analog voltage.
Arduino Thermometer (LM35 + LCD)

www.circuitmix.com
Step 1: Parts Needed
1 x Arduino UNO (can be any Arduino board)

1 x Breadboard

1 x USB Cable

1 x 16x2 LCD

1 x LM35 Temperature Sensor

1 x 10k Potentiometer

1 x 220 ohm resistor

1 x 9V Battery and clip (optional, for more portability)

18 x Jumper wires

Step 2: Plugging the Parts Into the Breadboard


Insert the LCD, the potentiometer and the LM35 into the breadboard. Their areas would not matter,
www.circuitmix.com
vicinity them the way you like.
Step 3: Connecting the LCD
This is the hardest part - you want to make most of the connections now. They are as follows:
LCD Pin -&gt; Arduino Pin
4 -&gt; 12
6 -&gt; 11
11 -&gt; 5
12 -&gt; 4
13 -&gt; 3
14 -&gt; 2
LCD Pin -&gt; Rail of the breadboard
1,5,16 -&gt; GND
2 -&gt; 5V
15 -&gt; 5V (using the 220 ohm resistor!)

Step 4: Connecting the Potentiometer and the LM35

www.circuitmix.com
www.circuitmix.com
Here, the connections are as follows:
Potentiometer
One of the sides goes to GND, the opposite one - to 5V. The middle pin connects to pin three of the
LCD
LM35
See the photograph above.
Please, make sure that you insert the sensor the right way! If you swap the connections, it will burn
out!

Step 5: Uploading the Code


After connecting everything, plug in your Arduino to your PC and add the code
www.circuitmix.com
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int value;
float celsius;
const int lmPin = 0; // The analog pin of the LM35
void setup() {
lcd.begin(16,2);
}
void loop() {
value = analogRead(inPin);
celsius = (value / 1023) * 500; // Getting the temperature from the sensor
lcd.clear();
lcd.setCursor(0,0);
lcd.print(celsius);
lcd.print("C");
lcd.setCursor(0,1);
lcd.print((celsius * 9)/5 + 32);
lcd.print("F");
delay(1000);
}

Step 6: Done!

www.circuitmix.com
3. Light Dependent Resistor(LDR) Sensor

www.circuitmix.com
LDR or Light Dependent Resistor modifications its resistance according to the intensity of light that
falls on it. The resistance fee is inversely proportional to the intensity of light.
Project:
A simple undertaking the usage of an Arduino that routinely turn lights on when an LDR sensor
detects darkness.

This gadget works via sensing the intensity of light in its environment. The sensor that can be used to
detect light is an LDR. It's inexpensive, and you can purchase it from any neighborhood electronics
store or online.
www.circuitmix.com
The LDR gives out an analog voltage when linked to VCC (5V), which varies in magnitude in direct
proportion to the input light intensity on it. That is, the greater the depth of light, the greater the
corresponding voltage from the LDR will be. Since the LDR offers out an analog voltage, it is
connected to the analog enter pin on the Arduino. The Arduino, with its built-in ADC (analog-to-
digital converter), then converts the analog voltage (from 0-5V) into a digital value in the range of (0-
1023). When there is sufficient mild in its environment or on its surface, the converted digital values
study from the LDR via the Arduino will be in the vary of 800-1023.

image
Arduino LDR Sensor working

Furthermore, we then application the Arduino to turn on a relay. Correspondingly, turn on an


equipment (light bulb), when the light intensity is low (this can be executed with the aid of masking
the floor of the LDR with any object), that is, when the digital values examine are in a greater vary
than usual.
Arduino LDR Sensor Connections

First, you want to join the LDR to the analog enter pin zero on the Arduino. You have to use a voltage
divider configuration to do this. The connection sketch for the Arduino is as given below.

www.circuitmix.com
image
Arduino LDR connections
One leg of the LDR is connected to VCC (5V) on the Arduino, and the different to the analog pin 0 on
the Arduino. A 100K resistor is also connected to the identical leg and grounded.
Testing the Code for the Arduino LDR Sensor

After connecting the LDR to your Arduino, you can test for the values coming from the LDR by the
Arduino. To do this, connect the Arduino by way of USB to your PC and open up the Arduino IDE or
software. Next, paste this code and add it to your Arduino:
int sensorPin = A0; // select the input pin for LDR
int sensorValue = 0; // variable to store the value coming from the sensor
void setup() {
Serial.begin(9600); //sets serial port for communication
}
void loop() {
sensorValue = analogRead(sensorPin); // read the value from the sensor
www.circuitmix.com
Serial.println(sensorValue); //prints the values coming from the sensor on the screen
delay(100);
}
After importing the code, click the button on the Arduino IDE referred to as “Serial monitor". This
will open a new window, which prints distinctive values on the screen. Now, take a look at out the
sensor by using blocking off its floor from mild and see what values you get on the serial monitor.
This is how the serial monitor looks:

Arduino LDR Sensor - Serial Monitor


Connecting the Relay to the Arduino

A relay is an electromechanical switch. It can be used to flip an appliance ON/OFF working on


AC/DC. When the Arduino elements HIGH voltage (5V) to the relay, it turns it on (the swap is ON),
otherwise, it stays off.
In this project, we used a 5V SPDT (single pole double throw) relay. One terminal of the relay coil is
www.circuitmix.com
linked to the Arduino's digital pin 2 and the other stop to GND. We linked a light bulb to it as well.
Since we are dealing with excessive power AC voltages, be positive to take acceptable precautions.
If you are nonetheless burdened about connecting a relay to an appliance, study this article on Relay
logic. The usual circuit is shown below.

image
Arduino LDR Sensor and Relay - Connection Diagram
After connecting the Arduino as shown above, we want to test it via importing the closing code to our
Arduino. The closing format can be determined here.
In this sketch, we set a threshold light value as 700, however it can range for your projects. You will
want to find out the unique value at which the light bulb must turn on. This needs to be accomplished
after testing it empirically. So basically, the Arduino turns on the light bulb (via the relay) every time
the light depth falls under seven-hundred When it is above 700, it turns the mild bulb off.

www.circuitmix.com
4. Humidity plus Temperature Sensor Module

This sensor module measures the humidity and temperature of the surroundings.
Project
DHT11 Humidity Sensor on Arduino

DHT11 could be a humidness and Temperature detector, that generates tag digital output. DHT11 are
often interface with any microcontroller like Arduino, Raspberry Pi, etc. and find fast results. DHT11
could be a low worth humidness and temperature detector that presents high reliableness and long
term stability.

In this project, we are going to construct atiny low circuit to interface Arduino with DHT11
www.circuitmix.com
Temperature and humidness detector. one in all the most functions of connecting DTH11 detector with
Arduino is weather observance.
We have already seen concerning humidness, ratio, humidness sensors and their varieties during this
article.
DHT11 humidness detector on Arduino Image three
DHT11 humidness detector on Arduino Image one
DHT11 humidness detector on Arduino Image a pair of
DHT11 humidness detector on Arduino Image three
DHT11 humidness detector on Arduino Image one
Circuit Diagram

Components needed
Arduino UNO
DHT11 Temperature and humidness detector
Breadboard (or perfboard)
Power offer
16 x a pair of LCD show
10K Ohm Potentiometer 2
5K Ohm electrical device (1/4 W)
Connecting wires 2
www.circuitmix.com
Circuit Description
We will see the circuit set up of DHT11 interfacing with Arduino. The DHT11 humidness and
Temperature detector comes in 2 variants: simply the sensor or a module.
The foremost distinction is that the module consists of the pull – up electrical device and should in
addition additionally embrace an influence on crystal rectifier. we've used a module during this
project and if you need to use the detector itself, you wish to attach a 5K Ω pull – up electrical device
in addition.
Coming to the planning, the statistics pin of the DHT11 detector is said to the Pin eleven of Arduino.
A sixteen x a pair of LCD display is employed to display the results. The manage pins of LCD i.e. RS
and E (Pins four and six on LCD) are connected to pins four and five of Arduino. the data pins of
LCD i.e. D4 to D7 (pins eleven to fourteen on LCD) are connected to pins zero to 3 on LCD.
NOTE: For simple association, we've connected the DHT11 detector Module at the ICSP pins of the
Arduino because it presents adjacent VCC, knowledge and GND pins. this sort of association isn't
any longer integral and you'll be a part of the information pin of detector to normal Digital I/O pins.
Component Description
DHT11 Temperature and humidness detector
DHT11 could be a a part of DHTXX series of humidness sensors. the opposite detector during this
sequence is DHT22. each these sensors are ratio (RH) detector. As a result, they're going to live
every the humidness and temperature. though DHT11 humidness Sensors are cheap and slow, they're
terribly known amongst hobbyists and beginners.

www.circuitmix.com
DHT11 detector
The DHT11 humidness and Temperature detector consists of 3 most vital elements. A resistive kind
humidness detector, Associate in Nursing NTC (negative temperature coefficient) thermal resistor (to
live the temperature) and an 8-bit microcontroller, that converts the analog indicators from every the
sensors and sends out single digital signal.
This digital signal are often browse by means that of any microcontroller or microchip for equally
analysis.

www.circuitmix.com
DHT11 Pinout
DHT11 humidness detector consists of four pins: VCC, Data Out, Not Connected (NC) and GND. The
vary of voltage for VCC pin is three.5V to 5.5V. A 5V offer would do fine. the information from the
information Out pin could be a serial digital data.
The following image indicates an everyday application circuit for DHT11 humidness and
Temperature detector. DHT11 detector will live a humidity price within the vary of twenty – ninetieth
of ratio (RH) and a temperature in the vary of zero – 500C. The sampling amount of the detector is
one second i.e.
DHT11 Application CircuitAll the DHT11 Sensors are accurately tag within the laboratory and
therefore the effects are keep in the memory. one wire contact are often founded between any
microcontroller like Arduino and therefore the DHT11 detector.
Also, the dimensions of the cable are often as long as twenty meters. The records from the detector
consists of important and decimal elements for every ratio (RH) and temperature.
The records from the DHT11 detector consists of forty – bits and therefore the structure is as follows:
www.circuitmix.com
8 – Bit statistics for necessary RH price, eight – Bit records for decimal RH price, eight – Bit
records for essential Temperature price, eight – Bit statistics for important Temperature fee and eight
– Bit facts for confirmation.
Example
Consider the statistics noninheritable from the DHT11 detector is
001001010 00011001 0 00111110.

This knowledge are often separated primarily based altogether on the higher than noted structure as
followsDHT11 detector knowledge
In order to test whether or not or not the noninheritable statistics is correct or not, we'd like to work
atiny low calculation. Add all the integral and decimals values of RH and Temperature and take a
glance at whether or not the total is capable the confirmation worth i.e. the last word eight – bit
knowledge.
00100101 + zero + 00011001 + 0 = 00111110
This value is same as confirmation and as a result the received statistics is valid. currently to urge the
RH and Temperature values, simply convert the binary facts to decimal knowledge.
RH = Decimal of 00100101 = thirty seven
Temperature = Decimal of 00011001 = 250C
Working of the Project
A simple venture is made mistreatment Arduino UNO and DHT11 humidness and Temperature
detector, wherever the humidness Associate in Nursingd Temperature of the environment are
displayed on an LCD display.
After creating the connections, we'd like now not do no matter because the software system can be
sure of everything. though there's a exceptional library for the DHT11 module observed as “DHT”,
we tend to didn’t use it. If you need to use this library, you would like to down load this library one at
a time and add it to this libraries of Arduino.
The software system written is predicated on the records temporal arrangement diagrams provided
within the datasheet. The software system can create the Arduino to mechanically browse the data
from the detector and show it as humidness and Temperature on the LCD show.
Code:
#include <LiquidCrystal.h>
LiquidCrystal lcd(4, 5, 0, 1, 2, 3);
www.circuitmix.com
byte degree_symbol[8] =
{
0b00111,
0b00101,
0b00111,
0b00000,
0b00000,
0b00000,
0b00000,
0b00000
};
int gate=11;
volatile unsigned long duration=0;
unsigned char i[5];
unsigned int j[40];
unsigned char value=0;
unsigned answer=0;
int z=0;
int b=1;
void setup()
{
lcd.begin(16, 2);
lcd.print("Temp = ");
lcd.setCursor(0,1);
lcd.print("Humidity = ");
lcd.createChar(1, degree_symbol);
lcd.setCursor(9,0);
lcd.write(1);
lcd.print("C");
lcd.setCursor(13,1);
lcd.print("%");
}
void loop()
{
delay(1000);
while(1)
{
delay(1000);
pinMode(gate,OUTPUT);
digitalWrite(gate,LOW);
delay(20);
digitalWrite(gate,HIGH);
pinMode(gate,INPUT_PULLUP);//by default it will become high due to internal pull up
www.circuitmix.com
// delayMicroseconds(40);

duration=pulseIn(gate, LOW);
if(duration <= 84 && duration >= 72)
{
while(1)
{
duration=pulseIn(gate, HIGH);
if(duration <= 26 && duration >= 20){
value=0;}
else if(duration <= 74 && duration >= 65){
value=1;}
else if(z==40){
break;}
i[z/8]|=value<<(7- (z%8));
j[z]=value;
z++;
}
}
answer=i[0]+i[1]+i[2]+i[3];
if(answer==i[4] && answer!=0)
{
lcd.setCursor(7,0);
lcd.print(i[2]);
lcd.setCursor(11,1);
lcd.print(i[0]);
}
z=0;
i[0]=i[1]=i[2]=i[3]=i[4]=0;
}
}
Applications
DHT11 ratio and Temperature sensing element will be employed in several applications like:
HVAC (Heating, Ventilation and Air Conditioning) Systems
Weather Stations
Medical instrumentation for activity humidness
Home Automation Systems
Automotive and different weather management applications

www.circuitmix.com
5. Moisture Sensor

Moisture sensor detects the level of moisture present in surroundings and hence commonly used in
plant Irrigation type projects.
Project
Arduino Soil Moisture Sensor

When you hear the word good Garden, one in every of the items that crop up to your mind is that the
www.circuitmix.com
automatic mensuration of the wetness content of the soil. If you're building a sensible Garden that
waters plants mechanically and provides you the readings of the condition of the soil, then you'll
undoubtedly want a Soil wetness sensing element.
I'll show you ways to interface the Soil wetness sensing element to associate degree Arduino Uno and
browse the values on a Serial Monitor.

Step 1: elements needed

For this project, you'll want :


Arduino Uno
Soil wetness sensing element
Hook up Wires
Bread Borad.
www.circuitmix.com
Step 2: concerning the Soil wetness sensing element

A typical Soil wetness sensing element comprises 2 elements. A 2 legged Lead, that goes into the soil
or anyplace else where water content has got to be measured. This has 2 header pins that hook up
with associate degree Amplifier/ A-D circuit which is successively connected to the Arduino.
The electronic equipment includes a Vin, Gnd, Analog and Digital knowledge Pins. this suggests that
you just will get the values in each Analog and Digital forms.
Step 3: however will the sensing element Work

image of however will the sensing element Work


Most soil wetness sensors are designed to estimate soil volumetrical water content supported the stuff
constant (soil bulk permittivity) of the soil. The stuff constant is thought of because the soil's ability to
transmit electricity. The stuff constant of soil will increase because the water content of the soil
www.circuitmix.com
increases. This response is thanks to the very fact that the stuff constant of water is way larger than the
opposite soil elements, together with air. Thus, mensuration of the stuff constant offers a certain
estimation of water content.

Step 4: Connections

Connect the 2 pins from the sensing element to the two pins on the electronic equipment circuit via
attach wires.
Connect the Vcc from the electronic equipment to the three.3V pin on the Arduino and therefore the
Gnd pin to the Gnd pin on the Arduino.
Now connect the Analog knowledge Pin to the A0 pin on the Arduino (Since I'm fascinated by Analog
Data).
Refer the photographs and build the circuit.
Step 5: Code
For simply reading the values I'll be using the AnalogRead sketch from the Examples menu. You can
modify the code as per your requirements.
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// print out the value you read:
Serial.println(sensorValue);
delay(1); // delay in between reads for stability
}
www.circuitmix.com
Step 6: Output
After verifying the code, upload it to the board and open the serial monitor. You will see the sensor
data on the monitor being changed when you dip the sensor leads in water and when dry. You can use
these values as threshold if you intend to trigger an action bases on these values.

6. Water / Rain / Liquid Sensor Module

Project
Arduino - Water Detector / Sensor

www.circuitmix.com
Water sensing element brick is intended for water detection, which might be wide employed in
sensing downfall, water level, and even liquid run.
Water Detector / sensing element
Connecting a water sensing element to associate degree Arduino could be a good way to sight a leak,
spill, flood, rain, etc. It will be accustomed sight the presence, the level, the amount and/or the
absence of water. whereas this might be accustomed inform you to water your plants, there's a much
better Grove sensing element for that. The sensing element has associate degree array of exposed
traces, that scan LOW once water is detected.
In this chapter, we'll connect the water sensing element to Digital Pin eight on Arduino, and can enlist
the terribly handy LED to assist determine once the water sensing element comes into contact with a
supply of water.
Components needed
You will would like the subsequent parts −
1 × bread board
1 × Arduino Uno R3
1 × Water sensing element
1 × led
1 × 330 ohm resistance
Procedure www.circuitmix.com
Follow the circuit diagram and attach the parts on the bread board as shown within the image given
below.

Water sensing element Circuit association


Sketch

Open the Arduino IDE code on your pc. cryptography within the Arduino language can management
your circuit. Open a replacement sketch File by clicking on New.
www.circuitmix.com
Sketch
Arduino Code
#define Grove_Water_Sensor 8 // Attach Water sensor to Arduino Digital Pin 8
#define LED 9 // Attach an LED to Digital Pin 9 (or use onboard LED)
void setup() {
pinMode(Grove_Water_Sensor, INPUT); // The Water Sensor is an Input
pinMode(LED, OUTPUT); // The LED is an Output
}
void loop() {
/* The water sensor will switch LOW when water is detected.
Get the Arduino to illuminate the LED and activate the buzzer
when water is detected, and switch both off when no water is present */
if( digitalRead(Grove_Water_Sensor) == LOW) {
digitalWrite(LED,HIGH);
}else {
digitalWrite(LED,LOW);
}
}
Code to notice
Water device has 3 terminals - S, Vout(+), and GND (-). Connect the device as follows −
Connect the +Vs to +5v on your Arduino board.
Connect S to digital PIN eight on Arduino board.
Connect GND with GND on Arduino.
Connect junction rectifier to digital PIN nine in Arduino board.
When the device detects water, pin eight on Arduino becomes LOW and so the junction rectifier on
Arduino is turned ON.
Result
You will see the indication junction rectifier activate once the device detects water.

7.Accelerometer Sensor

www.circuitmix.com
Accelerometer measures the acceleration in one to three axis and thus can be used to sense tilt
movements.

Project
Accelerometer-based gesture controlled Robot using Arduino

Robots are enjoying a very important role in automation across all the sectors like construction,
military, medical, producing, etc. once creating some basic golems like line follower robot, laptop
www.circuitmix.com
controlled golem, etc, we've got developed this measuring instrument based mostly gesture controlled
golem by exploitation arduino uno. during this project we've got used hand motion to drive the golem.
For this purpose we've got used measuring instrument that works on acceleration.
Required elements
Arduino UNO
DC Motors
Accelerometer
HT12D
HT12E
RF Pair
Motor Driver L293D
9 V Battery
Battery instrumentality
USB cable
Robot Chasis
RF Pair:
RF Pair

A gesture controlled golem is controlled by exploitation hand in situ of the other methodology like
buttons or joystick. Here one solely has to move hand to regulate the golem. A sending device is
employed in your hand that contains RF Transmitter and accelero-meter. will} transmit command to
golem in order that it can do the desired task like moving forward, reverse, turning left, turning right
and stop. of these tasks are going to be performed by exploitation hand gesture.
Here the foremost necessary element is measuring instrument. measuring instrument may be a three
axis acceleration measure device with +-3g vary. This device is formed by exploitation polysilicon
surface detector and signal learning circuit to live acceleration. The output of this device is Analog in
nature and proportional to the acceleration. This device measures the static acceleration of gravity
after we tilt it. and provides AN lead to sort of motion or vibration.
According to the datasheet of adxl335 polysilicon surface-micromachined structure placed on high of
semiconducting material wafer. Polysilicon springs suspend the structure over the surface of the
wafer and supply a resistance against acceleration forces. Deflection of the structure is measured
employing a differential capacitance that incorporate freelance mounted plates and plates connected
www.circuitmix.com
to the moving mass. The mounted plates are driven by 180° out-of-phase sq. waves. Acceleration
deflects the moving mass and unbalances the differential capacitance leading to a detector output
whose amplitude is proportional to acceleration. Phase-sensitive reception techniques are then
accustomed confirm the magnitude and direction of the acceleration.

Accelerometer

Pin Description of measuring instrument


Vcc five V provide ought to connect at this pin.
X-OUT This pin offers AN Analog output in x direction
Y-OUT This pin offer AN Analog Output in y direction
Z-OUT This pin offers AN Analog Output in z direction
GND Ground
ST This pin used for set sensitivity of detector
Circuit Diagram and rationalization
Gesture Controlled golem is split into 2 sections:
Transmitter half
Receiver half
In transmitter half AN measuring instrument and a RF transmitter unit is employed. As we've got
already mentioned that measuring instrument offers AN analog output thus here we want to convert
this analog knowledge in to digital. For this purpose we've got used four channel comparator circuit
in situ of any ADC. By setting reference voltage we have a tendency to gets a digital signal and so
apply this signal to HT12E cypherr to encode knowledge or changing it into serial kind and then send
this data by exploitation RF transmitter into the surroundings.
At the receiver finish we've got used RF receiver to receive knowledge and so applied to HT12D
decoder. This decoder IC converts received serial knowledge to parallel and so browse by
exploitation arduino. in line with received knowledge we have a tendency to drive golem by
exploitation 2 DC motor in forward, reverse, left, right and stop direction.
www.circuitmix.com
Working
Gesture controlled golem moves in line with hand movement as we have a tendency to place
transmitter in our hand. after we tilt hand before facet, golem begin to moving forward and continues
moving forward till next command is given.
When we tilt hand in backward facet, golem modification its state and begin taking possession
backwards direction till different command is given.
When we tilt it in left facet golem get flip left until next command.
When we tilt hand in right facet golem turned to right.
And for stopping golem we have a tendency to keeps hand in stable.

Gesture Controlled golem transmitter half

Gesture Controlled golem Transmitter Circuit Diagram

www.circuitmix.com
Circuit Diagram for Transmitter Section
Hand Gesture Controlled golem Circuit Diagram exploitation Arduino

Circuit Diagram for Receiver Section


Circuit for this hand gesture controlled golem is kind of easy. As shown in higher than schematic
diagrams, a RF combine is employed for communication and connected with arduino. Motor driver is
www.circuitmix.com
connected to arduino to run the golem. Motor driver’s input pin two, 7, ten and fifteen is connected to
arduino digital PIN number six, 5, four and three severally. Here we've got used 2 DC motors to drive
golem within which one motor is connected at output pin of motor driver three and six and another
motor is connected at eleven and fourteen. A nine V Battery is additionally accustomed power the
motor driver for driving motors.

Code
#define FD 16
#define BD 17
#define LD 18
#define RD 19
#define m11 3
#define m12 4
#define m21 5
#define m22 6
void forward()
{
digitalWrite(m11, HIGH);
digitalWrite(m12, LOW);
digitalWrite(m21, HIGH);
digitalWrite(m22, LOW);
}
void backward()
{
digitalWrite(m11, LOW);
digitalWrite(m12, HIGH);
digitalWrite(m21, LOW);
digitalWrite(m22, HIGH);
}
void left()
{
digitalWrite(m11, HIGH);
digitalWrite(m12, LOW);
digitalWrite(m21, LOW);
digitalWrite(m22, LOW);
}
void right()
{
digitalWrite(m11, LOW);
digitalWrite(m12, LOW);
digitalWrite(m21, HIGH);
digitalWrite(m22, LOW);
}
void Stop()
www.circuitmix.com
{
digitalWrite(m11, LOW);
digitalWrite(m12, LOW);
digitalWrite(m21, LOW);
digitalWrite(m22, LOW);
}
void setup()
{
pinMode(FD, INPUT);
pinMode(BD, INPUT);
pinMode(LD, INPUT);
pinMode(RD, INPUT);
pinMode(m11, OUTPUT);
pinMode(m12, OUTPUT);
pinMode(m21, OUTPUT);
pinMode(m22, OUTPUT);
}
void loop()
{
int temp1=digitalRead(FD);
int temp2=digitalRead(BD);
int temp3=digitalRead(LD);
int temp4=digitalRead(RD);
if(temp1==1 && temp2==0 && temp3==0 && temp4==0)
backward();
else if(temp1==0 && temp2==1 && temp3==0 && temp4==0)
forward();
else if(temp1==0 && temp2==0 && temp3==1 && temp4==0)
left();
else if(temp1==0 && temp2==0 && temp3==0 && temp4==1)
right();
else
Stop();
}

www.circuitmix.com
Program Explaination:

www.circuitmix.com
8. IR Infrared Obstacle Avoidance Sensor Module

www.circuitmix.com
Project
Arduino Line Follower Robot

A Line Follower mechanism, because the name suggests, is an automatic target-hunting vehicle, that
follow a visible line embedded on the ground or ceiling. Usually, the visual line is that the path within
which the road follower mechanism goes and it'll be a black line on a white surface however the
opposite method (white line on a black surface) is additionally potential. sure advanced Line
Follower Robots use invisible field as their ways.
www.circuitmix.com
Large line follower robots are sometimes employed in industries for helping the automatic production
method. they're conjointly employed in military applications, human help purpose, delivery services
etc.
Line follower mechanism is one amongst the primary robots that beginners and students would get
their first robotic expertise with. during this project, we've designed an easy Line Follower
mechanism mistreatment Arduino and a few alternative elements.

Circuit Diagram

Arduino Line Follower mechanism Circuit

Components needed
Arduino UNO (or Arduino Nano)
L293D Motor Driver IC
Geared Motors x a pair of
Robot Chassis
IR sensing element Module x a pair of
Black Tape (Electrical Insulation Tape)
Connecting Wires
Power offer
Battery connection
Battery Holder
Note: we've used a prebuilt IR sensing element Module that consists of associate degree IR LED and
www.circuitmix.com
a photograph Diode. If you are doing not have this, we've explained a way to build one yourself.
Block Diagram of the Project

The line follower mechanism inbuilt this project is split in to four blocks. the subsequent image
shows the diagram for line follower mechanism.

Block Diagram Description


Sensors (IR sensing element): we've used IR sensing element Module because the line sleuthing
sensor for the project. It consists of associate degree IR LED and a photograph diode and a few
alternative elements like comparator, LED etc.

IR Sensor Module

As mentioned earlier, we've used a pre – assembled IR sensing element. just in case you are doing not
have one, you'll be able to create your ownwww.circuitmix.com
sensing element mistreatment the subsequent circuit.
IR sensing element Circuit
The operating of the IR sensing element and its scope during this project are going to be explained
within the actual working of the road Follower mechanism.

Controller (Arduino UNO) : Arduino UNO is that the main controller within the project. the info
from the sensors (IR Sensors) are going to be given to Arduino and it offers corresponding signals to
the Motor Driver IC.
Motor Driver (L293D): L293D Motor Driver IC is employed during this project to drive the motors
of the mechanism. It receives signals from Arduino supported the data from the IR Sensors.
Note: the facility offer to the motors should lean from the motor driver IC. Hence, opt for the suitable
power offer that is adequate for all the elements together with the motors.
Motors (Geared Motors ): we've used 2 double-geared motors at the rear of the road follower
mechanism. These motors offer more torsion than traditional motors and might be used for carrying
some load furthermore.
Geared Motor
Working of Arduino Line Follower mechanism
In this project, we've designed associate degree Arduino primarily based Line Follower mechanism.
The operating of the project is pretty simple: observe the black line on the surface and move on that
line. The careful operating is explained here.
www.circuitmix.com
As mentioned within the diagram, we want sensors to observe the road. For line detection logic, we
tend to used 2 IR Sensors, that consists of IR LED and Photodiode. they're placed during a reflective
method i.e. aspect – by – side so whenever they are available in to proximity of a reflective surface,
the sunshine emitted by IR LED are going to be detected by exposure diode.
The following image shows the operating of a typical IR sensing element (IR LED – Photodiode pair)
before of a light-weight colored surface and a black surface. because the coefficient of the sunshine
colored surface is high, the infrared emitted by IR LED are going to be most mirrored and can be
detected by the Photodiode.

IR sensing element operating


In case of black surface, that contains a low coefficient, the sunshine gets utterly absorbed by the
black surface and doesn’t reach the photodiode.
Using the identical principle, we are going to setup the IR Sensors on the road Follower mechanism
such the 2 IR Sensors are on the either aspect of the black line on the ground. The setup is shown
below.
IR Sensors in Line Follower
www.circuitmix.com
When the mechanism moves forward, each the sensors await the road to be detected. for instance, if
the IR sensing element one within the on top of image detects the black line, it means there's a right
curve (or turn) ahead.
Arduino UNO detects this variation and sends signal to motor driver consequently. so as to show
right, the motor on the proper aspect of the mechanism is over-involved mistreatment PWM, whereas
the motor on the left aspect is run at traditional speed.

www.circuitmix.com
IR Sensors in Line Follower Left Right

Similarly, once the IR sensing element a pair of detects the black line initial, it means there's a left
curve ahead and therefore the mechanism must flip left. For the mechanism to show left, the motor on
the left aspect of the mechanism is over-involved (or will be stopped utterly or can be revolved in
opposite direction) and therefore the motor on the proper side is run at traditional speed.
Arduino UNO incessantly monitors the info from each the sensors and turns the mechanism as per the
road detected by them.

Code:
int mot1=9;
int mot2=6;
int mot3=5;
int mot4=3;
www.circuitmix.com
int left=13;
int right=12;
int Left=0;
int Right=0;
void LEFT (void);
void RIGHT (void);
void STOP (void);
void setup()
{
pinMode(mot1,OUTPUT);
pinMode(mot2,OUTPUT);
pinMode(mot3,OUTPUT);
pinMode(mot4,OUTPUT);
pinMode(left,INPUT);
pinMode(right,INPUT);
digitalWrite(left,HIGH);
digitalWrite(right,HIGH);

}
void loop()
{
analogWrite(mot1,255);
analogWrite(mot2,0);
analogWrite(mot3,255);
analogWrite(mot4,0);
while(1)
{
Left=digitalRead(left);
Right=digitalRead(right);
if((Left==0 && Right==1)==1)
LEFT();
else if((Right==0 && Left==1)==1)
RIGHT();
}
}
void LEFT (void)
{
analogWrite(mot3,0);
www.circuitmix.com
analogWrite(mot4,30);

while(Left==0)
{
Left=digitalRead(left);
Right=digitalRead(right);
if(Right==0)
{
int lprev=Left;
int rprev=Right;
STOP();
while(((lprev==Left)&&(rprev==Right))==1)
{
Left=digitalRead(left);
Right=digitalRead(right);
}
}
analogWrite(mot1,255);
analogWrite(mot2,0);
}
analogWrite(mot3,255);
analogWrite(mot4,0);
}
void RIGHT (void)
{
analogWrite(mot1,0);
analogWrite(mot2,30);
while(Right==0)
{
Left=digitalRead(left);
Right=digitalRead(right);
if(Left==0)
{
int lprev=Left;
int rprev=Right;
STOP();
while(((lprev==Left)&&(rprev==Right))==1)
{
Left=digitalRead(left);
Right=digitalRead(right);
}
}
analogWrite(mot3,255);
www.circuitmix.com
analogWrite(mot4,0);
}
analogWrite(mot1,255);
analogWrite(mot2,0);
}
void STOP (void)
{
analogWrite(mot1,0);
analogWrite(mot2,0);
analogWrite(mot3,0);
analogWrite(mot4,0);
}

Note:
In order to extend the potency of black line detection, variety of sensors may be accumulated.
associate degree array of sensors are going to be additional correct than simply 2 sensors.
In this project (where 2 sensors are used), the positioning of the sensors is incredibly necessary. The
dimension of the black line plays a serious role within the placement of the sensors.
The detector to observe the road may be made exploitation an light-emitting diode and LDR try.
Applications of Line Follower mechanism
Line follower Robots are usually used for automation method in industries, military applications and
client applications.
They are terribly helpful as they will work with none supervising i.e. they work as automatic guided
vehicles.
With extra options like obstacle shunning and alternative security measures, line follower robots may
be employed in driver less cars.

9.www.circuitmix.com
Ultrasonic Sensor
An Ultrasonic Sensor sends and receives the Sound Waves.
Project
Arduino Door Alarm Using an Ultrasonic Sensor
Use associate Arduino and an supersonic device to create a door alarm that sounds once somebody
comes at intervals a specific distance.
In this project, we have a tendency to are visiting build a door warning device victimisation the HC-
SR04 supersonic device. The supersonic device employed in this project is employed as a distance
sensor, it'll tell United States of America the space at that the thing is placed. victimisation this
distance price, we are going to flip the buzzer on or off.

www.circuitmix.com
Circuit Diagram
The hardware a part of this project is extremely simple to place along. initial of all, build the
connections for the supersonic device with the Arduino. The connections for the supersonic device
with the Arduino are as follows:
Connect VCC on the supersonic device to the 5V pin on the Arduino.
Connect the Trig pin on the supersonic device to pin two on the Arduino.
Connect the Echo pin on the supersonic device to pin three on the Arduino.
Connect the GND on the supersonic device to GND on the Arduino.
After that, build the connections for the buzzer and therefore the Arduino. Connect the positive pin on
the buzzer with pin ten on the Arduino and therefore the buzzer's negative pin with the GND pin on the
Arduino.
Read More:
Interfacing supersonic device with Arduino

www.circuitmix.com
How will the Arduino Door Alarm Work?
The supersonic device emits associate ultrasonic wave from the trigger that comes back when
touching the thing and it's received by the echo. The echo can then tell United States of America the
space traveled in microseconds. To send associate supersonic wave from the trigger, we are going to
need to set the trigger high for 10us. this may send an eight cycle sonic burst at forty kHz which can
hit the thing and is then received by the echo.
We have got the time in microseconds however we want to calculate the space. So, we are going to
use the equation below.
S=v*t
We have the worth of t and that we understand that the speed of a acoustic wave is 340m/s. we've to
convert the speed of sound into cm/us to calculate the space. The speed of sound in cm/us is
zero.034cm/us. The equation currently can become ...
S = (0.034 * t)
We will divide this equation by two as a result of we have a tendency to solely need the space it takes
to hit the thing and not the distance it takeswww.circuitmix.com
to hit the object and are available back. So, the ultimate
equation are
S = (0.035 * t)/2
We will get the space price victimisation the equation on top of and at the moment, we are going to set
a worth which can facilitate United States of America build the buzzer high or low.

Code :
int trigger_pin = 2;
int echo_pin = 3;
int buzzer_pin = 10;
int time;
int distance;

void setup ( ) {
Serial.begin (9600);
pinMode (trigger_pin, OUTPUT);
pinMode (echo_pin, INPUT);
pinMode (buzzer_pin, OUTPUT);

void loop ( ) {
digitalWrite (trigger_pin, HIGH);
delayMicroseconds (10);
digitalWrite (trigger_pin, LOW);
time = pulseIn (echo_pin, HIGH);
distance = (time * 0.034) / 2;

if (distance <= 10) www.circuitmix.com


{
Serial.println (" Door Open ");
Serial.print (" Distance= ");
Serial.println (distance);
digitalWrite (buzzer_pin, HIGH);
delay (500);
}
else {
Serial.println (" Door closed ");
Serial.print (" Distance= ");
Serial.println (distance);
digitalWrite (buzzer_pin, LOW);
delay (500);
}
}

Code rationalization
First of all, we have a tendency to initialized the trigger pin and echo for the inaudible detector.
we've connected the trigger pin to pin a pair of on the Arduino and echo pin to pin three on the
Arduino. Therefore, we have a tendency to initialized these pins within the code. Then we have a
tendency to initialized the buzzer pin and at that time, we have a tendency to initialized the variable
which can facilitate North American country in shrewd the space.
int trigger_pin = 2;
int echo_pin = 3;
int buzzer_pin = 10;
int time;
int distance;
In the setup perform, we have a tendency to declare the trigger pin because the output pin as a result
of we'll send the inaudible wave through that pin. we have a tendency to created the echo pin as input
pin as a result of we'll receive the inaudible wave through the echo.
pinMode (trigger_pin, OUTPUT);
pinMode (echo_pin, INPUT); www.circuitmix.com
In the loop perform, we have a tendency to set the trigger pin high for ten North American country to
send AN inaudible wave and so we created the echo pin high to receive the ultrasonic wave. After
that, we have a tendency to applied the equation to urge the space worth.
digitalWrite (trigger_pin, HIGH);
delayMicroseconds (10);
digitalWrite (trigger_pin, LOW);
time = pulseIn (echo_pin, HIGH);
distance = (time * zero.034) / 2;
Then we have a tendency to created a condition that if the space worth is a smaller amount than or
adequate to ten, then the buzzer can begin to beep. If the space worth is bigger than ten, then the buzzer
can stay quiet.
if (distance <= 10)
{
Serial.println (" Door Open ");
Serial.print (" Distance= ");
Serial.println (distance);
digitalWrite (buzzer_pin, HIGH);
delay (500);
}

10. HC-SR501 Pyroelectric Infrared Sensor Module

www.circuitmix.com
Pyroelectric Infrared Sensor or PIR Sensor senses the heat energy emitted by a human body in the
form of Infrared Radiation.
The module really consists of a pyroelectrical sensing element that generates energy once exposed to
heat.
PIR-Motion-Sensor-HC-SR501-Module

Sensor
That means once somebody's or animal body will get within the vary of the sensing element it'll
observe a movement as a result of the human or animal body emits heat during a kind of actinic ray.
That’s wherever the name of the sensing element comes from, a Passive Infra-Red sensing element.
and therefore the term “passive” implies that sensing element isn't mistreatment any energy for police
investigation functions, it simply works by police investigation the energy given off by the opposite
objects.
PIR-Sensor04

www.circuitmix.com
The module additionally consists a specially designed cowl named lens, that focuses the infrared
signals onto the pyroelectrical sensing element.
PIR-Motion-Sensor-How-It-Works

The HC-SR501 PIR sensing element Module


www.circuitmix.com
The module has simply 3 pins, a Ground Associate in Nursingd a VCC for powering the module and
an output pin which provides high logic level if an object is detected. additionally it's 2
potentiometers. One for adjusting the sensitivity of the sensing element and therefore the alternative
for adjusting the time the signaling stays high once object is detected. this point are often adjusted
from zero.3 seconds up to five minutes.

PIR sensing element Pinout


The module has 3 a lot of pins with a jumper between 2 of them. These pins are for choosing the
trigger modes. the primary one is termed “non-repeatable trigger” and works like this: once the
sensing element output is high and therefore the delay time is over, the output can mechanically
modification from high to low level. the opposite mode known as “repeatable trigger” can keep the
output high all the time till the detected object is gift in sensor’s vary.
Components required
HC-SR501 PIR sensing element Module
5V Relay Module
Arduino Board
Breadboard and Jump Wires Cable, Plug, Socket
Circuit Schematic
As Associate in Nursing example for this tutorial i will be able to build a circuit that may activate a
high voltage lamp once the sensing element will observe an object. Here’s the circuit schematics. The
output pin of the sensing element are connected to PIN number eight on the Arduino Board Associate
in Nursingd once an object can be detected the pin number seven will activate the relay module and
therefore the high voltage lamp will activate.

www.circuitmix.com
PIR-Sensor-Circuit-Schematics_bb
For a lot of details however the relay module works, you'll be able to check my Arduino Relay
Tutorial. (Keep in minds that we tend to use high voltage within the example, thus you ought to be
terribly caution, as a result of I don’t take any responsibility of your actions)
Source Code
Here’s the Arduino Code for this instance. It’s quite straightforward. we tend to simply have to
outline the PIR sensing element pin as input and therefore the relay pin as output. mistreatment the
digitalRead() operate we are going to scan the output of the sensing element and if its high or if an
object is detected it'll activate the relay. For activating the relay module we are going to send a logic
low because the relay input pin works reciprocally.
int pirSensor = 8;
int relayInput = 7;
void setup() {
pinMode(pirSensor, INPUT);
pinMode(relayInput, OUTPUT);
}
void loop() {
int sensorValue = digitalRead(pirSensor);
www.circuitmix.com
if (sensorValue == 1) {
digitalWrite(relayInput, LOW); // The Relay Input works Inversly
}
}
The demonstration of the instance are often seen at the tip of the video hooked up higher than. Note
that when powering the sensing element module it desires regarding twenty – sixty seconds to “warm-
up” so as to operate properly. currently once you can place your hand ahead of the sensing element the
relay will activate the lamp. however note that whether or not you progress your hand perpetually the
lamp can put off when the adjusted delay time is over as a result of the PIR sensing element is in
“non-repeatable trigger” mode. If you alter the sensing element with the jumper to the “repeatable
trigger” mode and you perpetually move the hand, the lamp are perpetually on in addition and it'll put
off when the movement is gone and therefore the set delay time is over.
Project:
PIR Motion Sensor with Arduino

In this project, we'll find out about PIR sensing element and the way will it's used as a Motion sensing
element through the Arduino PIR sensing element. By prying this project, you'll understand how PIR
sensing element works and the way to attach a PIR sensing element to Arduino.
We have created a project mistreatment Arduino, PIR sensing element and GSM Module referred to
as GSM based mostly Home Security System mistreatment Arduino. If you perceive however a PIR
sensor works, then you'll several such attention-grabbing comes and even a lot of advanced ones.
Overview
A PIR sensing element or a Passive Infrared sensing element is associate degree device that measures
the infrared (IR) lightweight emitted by the objects in its discernible space. The term ‘Passive’ within
the PIR sensing element indicates that the sensor really doesn’t emit any actinic radiation however
rather passively detects it that's emitted by its close objects.
Every object, with its surface temperature bigger than temperature i.e. -2730 C emits heat within the
type of infrared light. Humans cannot see this radiation because the radiations are in infrared
www.circuitmix.com
wavelength.
But PIR Sensors sight these radiations and alter them into applicable electrical signals.

PIR Sensor

A typical PIR sensing element seems like the one shown within the image below. to attach with
external devices, it's solely 3 pins particularly VCC, Digital OUT (Data) and GND.
Arduino PIR sensing element Tutorial PIR sensing element two
On the highest of sensing element board, there's a special variety of lens referred to as Fresnal Lens
that's covering up the particular electrical phenomenon sensing element. the task of the Fresnal Lens is
to focus all the infrared light onto the electrical phenomenon sensing element.
Arduino PIR sensing element Tutorial PIR sensing element one
If you observe the rear of the PIR sensing element board, the full electronic equipment is housed
there. The brain of the PIR sensing element Module is that the BISS0001 PIR Motion Detector IC.
close to this IC, we've got 2 potentiometers, one for adjusting the Sensitivity and also the alternative
is for adjusting the delay time.
Using Sensitivity regulate, you'll management the vary of field of read and in our sensing element, it's
up to seven meters. mistreatment the Delay Time regulate, you'll management the length that the
Digital Out can keep HIGH once a moving object is detected.
How PIR sensing element works?
PIR Sensors are difficult than most alternative sensors. PIR Motion sensing element could seem easy
once enforced as all you wish to try and do is check for a HIGH signal on the Digital Out Pin of the
sensing element whenever motion is detected.
But, internally, there's plenty happening and also the input and output of the sensing element are
captivated with many variables.
www.circuitmix.com
The actual PIR sensing element i.e. the one that is roofed with a lens, consists of 2 slots and each
these slots are created from IR Sensitive materials. underneath traditional condition wherever there's
no movement ahead of the sensing element, each the slots within the sensing element sight same
quantity of infrared light.
When there's movement ahead of the sensing element, sort of a human or a cat, their radiation is taken
by one in all the slots 1st and also the differential output between the 2 slots becomes positive.
As the person moves away, the second slot detects the radiation and also the differential output can
become negative. based mostly these output pulses, a motion is detected.
Testing the PIR sensing element

Since the Digital Out Pin of the PIR sensing element is either HIGH or LOW supported the movement
detected, you'll build a straightforward circuit to check the PIR sensing element.

www.circuitmix.com
The first circuit consists of a PIR sensing element associate degreed an light-emitting diode. once the
PIR sensing element detects motions, the light-emitting diode activates. The length that the light-
emitting diode is ON is adjusted with the assistance of Delay regulate POT.
Arduino PIR sensing element Tutorial take a look at Circuit one
A similar PIR sensing element testing circuit is shown below however it consists of a buzzer. so as to
drive the buzzer, associate degree NPN semiconductor device like BC547 or 2N2222 is used. The
buzzer are going to be activated once the sensing element detects any movement.

Arduino PIR sensing element Tutorial take a look at Circuit two


Arduino PIR sensing element: PIR Motion Sensor mistreatment Arduino
Let us create alittle Motion sensing element or Motion Detector project mistreatment Arduino and PIR
sensing element. during this project, the PIR sensing element detects any movement ahead of it and
signals Arduino. Whenever any movement is detected, Arduino can activate associate degree alarm
within the type of a Buzzer.
This circuit doesn’t implement a significant style however provides a concept concerning the way to
interface a PIR sensing element to Arduino and the way to will we tend to Arduino to use the info
from the PIR sensing element and drive alternative output devices or masses like relay, GSM Module,
buzzer etc.
Circuit Diagram

www.circuitmix.com
Arduino PIR sensing element Tutorial Circuit Diagram
Components needed
Arduino UNO [Buy Here]
PIR sensing element [Buy Here]
5V Buzzer [Buy Here]
Breadboard [Buy Here]
Connecting Wires [Buy Here]
Power provide
Circuit style
The design of the PIR Motion sensing element mistreatment Arduino is extremely easy. The PIR
sensing element Module has 3 pins: VCC, Digital Out and GND. Connect VCC and GND to +5V and
GND severally. Then connect the Digital Out Pin of the PIR sensing element to the digital I/O pin
eight of Arduino.
As we want to point the detection of motion by the sensing element, connect a buzzer to Pin eleven of
the Arduino.
NOTE: Buzzer is connected on to Arduino. I recommend you to attach it through a semiconductor
device as shown within the take a look at circuit.

Code:
int buzzer = 11;
int sensor = 8;
int led = 13;
www.circuitmix.com
void setup()
{
pinMode(buzzer, OUTPUT);
pinMode(sensor, INPUT);
pinMode(led, OUTPUT);
digitalWrite(buzzer,LOW);
digitalWrite(sensor,LOW);
digitalWrite(led,LOW);
while(millis()<13000)
{
digitalWrite(led,HIGH);
delay(50);
digitalWrite(led,LOW);
delay(50);
}
digitalWrite(led,HIGH);
}
void loop()
{
if(digitalRead(sensor)==HIGH)
{
digitalWrite(buzzer,HIGH);
delay(3000);
digitalWrite(buzzer,LOW);
while(digitalRead(sensor)==HIGH);
}
}

GSM Based Home Security Alarm System Using Arduino

www.circuitmix.com
Home Security Systems are a crucial feature of recent residential and workplace setups. Home
security systems must be cheap, reliable and effective.
Modern advanced home security systems embody many safety features like hearth, intruders,
electronic door lock, heat, smoke, temperature, etc. Some security systems is also a mixture of all the
protection measures.

Arduino GSM Home Security alarm image


Such advanced systems is also dearly-won and will not be cheap by everybody. There are individual
security systems supported the necessity.
In this project, we have a tendency to designed an easy however terribly economical home security
that encompasses a operate of line the house owner on his/her mobile variety just in case of associate
unwelcome person alert.
Help United States of America in choosing the subsequent DIY Arduino Project.: choose your
favorite Project»
The project is predicated on Arduino, PIR motion detection detector and GSM Module.
Circuit Diagram

www.circuitmix.com
Arduino GSM Home Security alarm
Hardware needed
Arduino UNO
PIR Motion Detection detector
SIM 900A (or any other) GSM Module with SIM inserted
Circuit style of Arduino GSM Home Security alarm
As the project is predicated on associate Arduino, the affiliation is pretty easy. PIR motion detection
detector module encompasses a digital output pin. this is often connected to any of the digital I/O pins
of the Arduino.
The GSM Module communicates with the microcontroller in an exceedingly serial manner. it's
associate Rx and Lone-Star State pins on the board. These pins are connected to the Lone-Star State
and Rx pins of the Arduino.
It is vital to notice that whereas uploading the program (sketch) to Arduino, the GSM module should
be disconnected because it may interfere with the serial communication with the Arduino IDE.
Component Description
PIR Motion Detection detector
Passive Infra-Red or PIR detector could be a pyroelectrical device that detects motion. Hence, it's
additionally known as as motion detection detector. It detects motion by sensing the changes in
infrared levels emitted by close objects.
www.circuitmix.com
GSM Module (SIM 900A)
SIM 900A is that the GSM/GPRS module with in-built RS232 interface. it's twin band GSM/GPRS
system that works on 900/1800MHz frequencies.
With the assistance of RS232, the electronic equipment will be connected to laptop or
microcontroller via serial cable. Voice calls, SMS and net access are attainable with this module.
There are on board connections for electro-acoustic transducer and headphones with that we are able
to build or receive calls.
Arduino UNO
It is the most controller utilized in this project. It detects the signals from PIR detector and sends
commands to GSM Module consequently. The serial pins of the Arduino are utilized in this project to
speak with GSM module.
Working of Arduino GSM Home Security alarm
Home Security Alarm Systems are important in gift day society, wherever crime is increasing. With
the technological advancements we've achieved within the recent years, a house owner doesn’t must
worry regarding home security whereas obtaining off his/her home.
Modern home security systems give enough security from burglars, fire, smoke, etc. They additionally
give immediate notification to the house owner.
The aim of this project is to implement an easy and cheap, however economical home security alarm.
The project is meant for police investigation intruders and informing the owner by creating a call.
The operating of the project is explained below .
PIR detector detects motion by sensing the distinction in infrared or effulgent heat levels emitted by
encompassing objects. The output of the PIR detector goes high once it detects any motion. The vary
of a typical PIR detector is around vi meters or regarding thirty feet.
For proper operation of PIR detector, it needs a heat up time of twenty to sixty seconds. this is often
needed as a result of, the PIR detector encompasses a sinking time throughout that it calibrates its
sensor in keeping with the atmosphere and stabilizes the infrared detector.
During this point, there ought to be little or no to no motion ahead of the detector. If the detector isn't
given enough calibrating time, the output of the PIR detector might not be reliable.
When the PIR detector detects any motion, the output of the detector is high. this is often detected by
the Arduino. Arduino then communicates with the GSM module via serial communication to form a
decision to the pre programmed mobile variety.
An important purpose to be noted regarding PIR sensors is that the output are going to be high once it
detects motion. The output of the detector goes low from time to time, even once there's motion which
can mislead the microcontroller into considering that there is no motion.
This issue should be restricted within the programming of Arduino by ignoring the low output signals
www.circuitmix.com
that have a shorter period than a predefined time. this is often done by forward that the motion ahead
of PIR detector is gift unendingly.

Code
int LED1=12;
int GND1=13;
int LED2=8;
int GND2=9;
int pirOutput=5;
void setup()
{
Serial.begin(9600);
pinMode(LED1,OUTPUT);
pinMode(GND1,OUTPUT);
pinMode(LED2,OUTPUT);
pinMode(GND2,OUTPUT);
pinMode(pirOutput,INPUT);
digitalWrite(pirOutput,LOW);
digitalWrite(GND1,LOW);
digitalWrite(GND2,LOW);
digitalWrite(LED1,LOW);
digitalWrite(LED2,LOW);
delay(15000);
digitalWrite(LED1,HIGH);
}
void loop()
{
if(digitalRead(pirOutput)==HIGH)
{
digitalWrite(LED2,HIGH);
Serial.println("OK");
delay(1000);
Serial.println("ATD+91xxxxxxxxxx;");//add target mobile number in place of xxxxxxxxxx
delay(15000);
Serial.println("ATH");
digitalWrite(LED2,LOW);
delay(1000);
}
}

www.circuitmix.com
NOTE
A GSM based mostly home security alarm is intended victimization Arduino, PIR motion detection
sensing element and a GSM module.
When the system is activated, it unceasingly checks for motion and once the motion is detected, it
create a call to the owner.
Only persona non grata alert is gift during this system and may be upgraded to different security alert
systems like fireplace, smoke etc.

www.circuitmix.com

You might also like