100% found this document useful (3 votes)
167 views

BMP180 (Barometric Pressure Sensor) : Specifications

Here are the key steps to control a lamp with a relay module and PIR motion sensor using Arduino: 1. Connect the PIR sensor's output pin to an Arduino digital pin. 2. Connect the relay module's IN pin to an Arduino digital pin and VCC/GND as per the module's specifications. 3. Connect the lamp to the relay module's COM and NO pins. 4. Use attachInterrupt() to monitor the PIR sensor pin for changes. Specify the pin, ISR function, and INTERRUPT mode as FALLING or RISING. 5. In the ISR function, turn on the relay by setting the digital pin HIGH for a set duration to

Uploaded by

abhilash
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (3 votes)
167 views

BMP180 (Barometric Pressure Sensor) : Specifications

Here are the key steps to control a lamp with a relay module and PIR motion sensor using Arduino: 1. Connect the PIR sensor's output pin to an Arduino digital pin. 2. Connect the relay module's IN pin to an Arduino digital pin and VCC/GND as per the module's specifications. 3. Connect the lamp to the relay module's COM and NO pins. 4. Use attachInterrupt() to monitor the PIR sensor pin for changes. Specify the pin, ISR function, and INTERRUPT mode as FALLING or RISING. 5. In the ISR function, turn on the relay by setting the digital pin HIGH for a set duration to

Uploaded by

abhilash
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 34

BMP180 (Barometric Pressure Sensor)

Specifications

 Supply Voltage:1.8V to 3.6V


 Low power consumption:0.5uA at 1Hz
 I2C interface
 Max I2C Speed: 3.5Mhz
 Very low noise: up to 0.02hPa (17cm)
 Pressure Range: 300hPa to 1100hPa (+9000m to -500m)

 Before taking a pressure reading you must take a temperature reading.


This is done with startTemperature () and getTemperature ().
The result is in degrees C.

 Once you have a temperature reading, you can take a pressure reading.
This is done with startPressure() and getPressure().
The result is in millibar (mb) aka hectopascals (hPa).
EXTAR:

 If you'll be monitoring weather patterns, you will probably want to


remove the effects of altitude. This will produce readings that can
be compared to the published pressure readings from other locations.
To do this, use the sealevel() function. You will need to provide
the known altitude at which the pressure was measured.

 If you want to measure altitude, you will need to know the pressure
at a baseline altitude. This can be average sealevel pressure, or
a previous pressure reading at your altitude, in which case
subsequent altitude readings will be + or - the initial baseline.
This is done with the altitude() function.

 Hardware connections:
- (GND) to GND
+ (VDD) to 3.3V
(WARNING: do not connect + to 5V or the sensor will be damaged!)

 You will also need to connect the I2C pins (SCL and SDA) to your
Arduino. The pins are different on different Arduinos:
Any Arduino pins labelled: SDA SCL
Uno, Red board, Pro: A4 A5
Mega2560, Due: 20 21
Leonardo: 2 3

Leave the IO (VDDIO) pin unconnected. This pin is for connecting


the BMP180 to systems with lower logic levels such as 1.8V
 REQUIRD LIBRARY:
#include <SFE_BMP180.h>
#include <Wire.h>
ULTRASONIC SENSOR (HC – SR04)

In order to generate the ultrasound, you need to set the Trig on a High State for 10 µs. That
will send out an 8 cycle sonic burst which will travel at the speed sound and IN order to
generate the ultrasound you need to set the Trig on a High State for 10 µs. That will send
out an 8 cycle sonic burst which will travel at the speed sound and it will be received in the
Echo pin. The Echo pin will output the time in microseconds the sound waves travelled. it
will be received in the Echo pin. The Echo pin will output the time in microseconds the
sound waves travelled.
TEMPERATURE AND HUMIDITY SENSOR(DHT11)

INCLUDE LIBRARY <DHT.h>


RAIN DROP DETECTION SENSOR

Raindrop sensor is basically a board on which nickel is coated in the form of lines. It works on the principal
of resistance.
Rain Sensor module allows to measure moisture via analog output pins and it provides a digital output
when a threshold of moisture exceeds.
The module is based on the LM393 op amp. It includes the electronics module and a printed circuit board
that “collects” the rain drops. As rain drops are collected on the circuit board, they create paths of parallel
resistance that are measured via the op amp.
The sensor is a resistive dipole that shows less resistance when wet and more resistance when dry. When
there is no rain drop on board it increases the Resistance so we get high voltage according to V=IR.
When rain drop present it reduces the resistance because water is a conductor of electricity and presence
of water connects nickel lines in parallel so reduces resistance and reduces voltage drop across it.
SOIL MOISTURE SENSOR

SAME AS RAIN SENSOR

16X2 LCD INTERFACING


8 data pins (7-14 or D0-D7)
3rd pin for contrast control (VEE-controls how thick the characters should be shown)
We just need to control ENABLE and RS pins to send characters and data accordingly.
The contrast bit and READ/WRITE are not often used so they can be shorted to ground.

The connections which are done for LCD are given below:
 PIN1 or VSS to ground.
 PIN2 or VDD or VCC to +5v power.
 PIN3 or VEE to ground (gives maximum contrast best for a beginner).
 PIN4 or RS (Register Selection) to PIN12 of ARDUINO UNO.
 PIN5 or RW (Read/Write) to ground (puts LCD in read mode eases the communication for
user).
 PIN6 or E (Enable) to PIN10 of ARDUINO UNO.
 PIN11 or D4 to PIN5 of ARDUINO UNO.
 PIN12 or D5 to PIN4 of ARDUINO UNO.
 PIN13 or D6 to PIN3 of ARDUINO UNO.
 PIN14 or D7 to PIN2 of ARDUINO UNO.
 PIN15 to +5V with 221-ohm resistor in series.
 And the last PIN16 to ground.
The ARDUINO IDE allows the user to use LCD in 4-bit mode. This type of communication enables the user
to decrease the pin usage on ARDUINO, unlike other the ARDUINO need not to be programmed separately
for using it in 4 it mode because by default the ARDUINO is set up to communicate in 4-bit mode. In the
circuit you can see we have used 4bit communication (D4-D7).
First we need to enable the header file (‘#include <LiquidCrystal.h>’), this header file has
instructions written in it, which enables the user to interface an LCD to UNO in 4-bit mode
without any fuzz. With this header file we need not have to send data to LCD bit by bit, this
will all be taken care of and we don’t have to write a program for sending data or a
command to LCD bit by bit.
Second we need to tell the board which type of LCD we are using here. Since we have so
many different types of LCD (like 20x4, 16x2, 16x1 etc.). Here we are going to interface a
16x2 LCD to the UNO so we get ‘lcd.begin(16, 2);’. For 16x1 we get ‘ lcd.begin(16, 1);’.
In this instruction we are going to tell the board where we connected the pins. The pins
which are connected need to be represented in order as “RS, En, D4, D5, D6, D7”. These
pins are to be represented correctly. Since we have connected RS to PIN0 and so on as show
in the circuit diagram, we represent the pin number to board as “LiquidCrystal lcd (13, 12,
5, 4, 3, 2);”. The data which needs to be displayed in LCD should be written as “lcd. print
("hello, world!");”. With this command the LCD displays ‘hello, world!’.
MQ2 Gas/Smoke Sensor

MQ2 is one of the commonly used gas sensors in MQ sensor series. It is a Metal
Oxide Semiconductor (MOS) type Gas Sensor also known as Chemiresistors as
the detection is based upon change of resistance of the sensing material when
the Gas comes in contact with the material. Using a simple voltage divider
network, concentrations of gas can be detected.

MQ2 Gas sensor works on 5V DC and draws around 800mW. It can


detect LPG, Smoke, Alcohol, Propane, Hydrogen, Methane and Carbon Monoxid
e concentrations anywhere from 200 to 10000ppm.

more details on MQ2


Servo Motor

First we need to set frequency of PWM signal and for that we should call “#include <Servo.h>” header
file, on including this header file in the program, the frequency gets set automatically and we get to use
some special conditions, which enables the user to enter needed position of servo directly without any
fuzz.

Now we need to define a name for the servo “Servo sg90sevo”, here ‘sg90servo’ is the name chosen,
so while writing for potion we are going to use this name, this feature comes in handy when we have
many servos to control, we can control as many as eight servo by this.

Now we tell the UNO where the signal pin of servo is connected or where it needs to generate the
PWM signal. To do this we have “Sg90.attach(3);”, here we are telling the UNO we connected the
signal pin of servo at PIN3.
All left is to set the position, we are going set the position of servo by using “Sg90.write(30);”, by this
command the servo hand moves 30 degrees, so that’s it. After that whenever we need to change the
position of servo we need to call the command ”Sg90.write(needed_position_ angle);”. In this circuit we
will have two buttons one button increases the position of servo and the other is for decreasing the
position of servo.

Ultrasonic Radar
ARDUINO
RADAR.docx

Passive Infrared Sensor(PIR)


Microphone /Sound Sensor
RFID Reader(MFRC522)
LCD DISPLAY 16X2 i2C
RFID BASED AUTHENTICATION
REALY
Controlling a Lamp with a Relay Module and PIR Motion Sensor

attachInterrupt():
attachInterrupt(digitalPinToInterrupt(pin), ISR, mode) (recommended)

The first parameter to attachInterrupt() is an interrupt number. Normally


you should use digitalPinToInterrupt(pin) to translate the actual digital pin
to the specific interrupt number. For example, if you connect to pin 3,
use digitalPinToInterrupt(3) as the first parameter to attachInterrupt() .

Parameters

interrupt : the number of the interrupt. Allowed data types: int .


pin : the Arduino pin number.
ISR : the ISR to call when the interrupt occurs; this function must take
no parameters and return nothing. This function is sometimes referred
to as an interrupt service routine.
mode : defines when the interrupt should be triggered. Four constants
are predefined as valid values:

 LOW to trigger the interrupt whenever the pin is low,


 CHANGE to trigger the interrupt whenever the pin changes value
 RISING to trigger when the pin goes from low to high,
 FALLING for when the pin goes from high to low.

The Due, Zero and MKR1000 boards allow also:

 HIGH to trigger the interrupt whenever the pin is high.

Returns

Nothing

More details
Note
Inside the attached function, delay() won’t work and the value returned
by millis() will not increment. Serial data received while in the function
may be lost. You should declare as volatile any variables that you modify
within the attached function. See the section on ISRs below for more
information.

You might also like