Arduino Based Practicals DHT11_Bluetooth_RFID
Arduino Based Practicals DHT11_Bluetooth_RFID
Aim:: To study and understand Interfacing Temperature and humidity sensor (DHT11) to Arduino.
Objectives:
Circuit Diagram:
Theory:
The DHT11 sensor is a temperature and humidity sensor having 4 pin single row pin package,
single wire serial interface with a calibrated digital signal output.
It ensures high
igh reliability, long term stability, excellent quality, fast response, cost effectiveness.
The single wire serial interface makes system integration quick and easy.
Its small size and low power consumption.
It has humidity measurement range of 20% to 90% RH and temperature measurement range from 0
to 50 Celsius.
1) Measures both temperature and humidity: Provides readings for both relative humidity and
temperature
re simultaneously.
2) Digital output: Outputs data in a digital format, simplifying data acquisition for microcontrollers.
3) Low cost: Considered a very affordable sensor option.
4) Simple to use: Requires only one data pin for communication with a microcontroller.
5) Low power consumption: Operates with minimal power draw.
6) Compact size: Small form factor suitable for compact projects.
7) Operating voltage: Typically operates on 3.3V to 5V power supply
supply.
Technical specifications:
Procedure:
#include<dht.h> //This includes the dht.h library, which provides functions to interface with
the DHT11 sensor.
dht DHT; //Creates an instance of the dht class called DHT. This instance will be used
to read temperature and humidity data from the sensor.
#define DHT11_PIN 3 //Defines pin 3 as the data pin for the DHT11 sensor.
void setup() //The setup() function runs once when the microcontroller starts.
int chk = DHT.read11(DHT11_PIN); //Reads temperature and humidity data from the
DHT11 sensor connected to DHT11_PIN (pin 3).
Serial.println("Humidity");
Serial.println("Temperature");
Result: Interfacing of Temperature and humidity sensor (DHT11) with Arduino is successfully studied, tested
and observe the output.
Questions:-
Experiment – 2
Objectives:
Circuit Diagram:
Theory:
Bluetooth is a wireless technology standard used for exchanging data between fixed and mobile devices
over short distances using short-wavelength
wavelength UHF radio waves in the industrial, scientific and medical
radio bands, from 2.402 GHz to 2.480 GHz, and building personal area network
networks (PANs).
It was originally conceived as a wireless alternative to RS
RS-232 data cables.
The IEEE standardized Bluetooth as IEEE 802.15.1.
Bluetooth is a one of the great example for wireless connectivity.
It is used in many fields.
Bluetooth consumes very small amount of energy
energy.
Here we are going to interface a Bluetooth Module (HC (HC-05) with Arduino.
HC-05 05 is a Bluetooth module which can communicate in two ways. Which means, It is full-duplex.
full It
operates on Serial Port
ort Protocol (SSP).
The module communicates with the help of USART (Universal Synchronous/Asynchronous Receiver
/Transmitter) at the baud rate of 9600, and it also supports other baud rate.
The HC05 can operate in two modes.
One is Data mode and other is AT command mode.
When the enable pin is "LOW" the HC HC-05
05 is in Data Mode. If that pin set as "HIGH" the module is in
AT command mode.
Here we operate this module in Data Mode.
Technical Specifications -
Procedure:
1) Connect 5V DC power adaptor to Arduino Target board.
2) Set the Mode_Sel slide switch in the “Arduino section” on “Pgm” mode.
3) Compile the written program, if there are no errors connect the PC with Arduino Nano Board available
on the Arduino Target board; by using USB to mini USB cable.
4) Upload the program in to Arduino Nano board and remove the USB to mini USB cable from board.
5) Insert Bluetooth HC05 module to the HC05 connector in the Bluetooth section.
6) Make necessary connections as shown in the above circuit diagram.
7) Set the Mode_Sel slide switch in the “Arduino section” on “Run” mode.
8) Enter the commands in to the Bluetooth Terminal HC05 Mobile app. to make LED on / off, and
observe the output.
Flowchart:
Program: -
char inputbyte; // Declares a character variable (inputbyte) to store the incoming serial
data.
int led = 2; // Declares an integer variable led and assigns it the value 2, meaning
the LED
is connected to pin 2 of the Arduino board.
void setup() // The setup() function runs once when the microcontroller starts.
{
Serial.begin(9600); // Initializes serial communication at 9600 baud rate
pinMode(led, OUTPUT); // Configures pin 2 as an output, so it can control an LED
}
void loop() // The loop() function runs continuously.
{
while(Serial.available()>0) // Checks if there is data available in the serial buffer.
{
inputbyte=Serial.read(); // Reads one character from the serial buffer and stores it in inputbyte.
if (inputbyte=='1')
{
digitalWrite(led, LOW); // If the received character is '1', it turns the LED OFF by setting
digitalWrite(led, LOW);
}
else if (inputbyte=='2')
{
digitalWrite(led,HIGH); // If the received character is '2', it turns the LED ON by setting
digitalWrite(led, HIGH);
}
}
}
Exercises:
Result: Interfacing of Bluetooth with Arduino is successfully studied, tested and observe the output.
Questions:-
Experiment – 3
Objectives:
Circuit Diagram:
Theory:
The EM-1818 RFID Reader module operating at 125kHz is an inexpensive solution for your RFID based
application.
The Reader module comes with an onon-chip
chip antenna and can be powered up with a 5V power supply.
Power-up
up the module and connect the transmit pin of the module to receive pin of your
microcontroller.
Show your card within the reading distance and the card number is thrown at the output.
Features:
Procedure:
char input[12]; // Declares a character array input of size 12. This array will store up to 12
characters received from the serial input.
void setup() //
Serial.begin(9600); //
void loop() //
{
input[count]=Serial.read(); // Reads one character from the serial buffer and stores it in input[count].
count++; // Increments the count, moving to the next position in the array.
delay(5); // Waits for 5 milliseconds to allow for the next character to arrive.
Serial.print(input[i]); // Prints each character stored in the input array using Serial.print()
Serial.println(); // Prints a newline, ensuring that each input batch appears on a new line in
the Serial Monitor.
}
}
Applications of RFID: (Student can search & write application here)
Result: Interfacing of EM18 RFID module with Arduino is successfully studied, tested and observe the
output.
Questions:-