Arduino Based Experiments

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

Title: To study Arduino based LED switching using mobile.

Aim: To study Arduino based LED switching using mobile.

Objectives:
❖ To understand the working principle of HC05 Bluetooth module.
❖ To study interfacing of Bluetooth module to Arduino.
❖ To study Arduino IDE software.

Software Used: Arduino IDE

Circuit Diagram:

Theory:
Bluetooth is a wireless technology standard used for exchanging data between fixed and mobile devices over
short distances using short-wavelength UHF radio waves in the industrial, scientific and medical radio bands,
from 2.402 GHz to 2.480 GHz, and building personal area networks (PANs).
It was originally conceived as a wireless alternative to 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.
Here we are going to interface a Bluetooth Module (HC-05) with Arduino.
HC-05 is a Bluetooth module which can communicate in two ways. Which means, It is full-duplex. We can
use it with most micro controllers. Because it operates on Serial Port 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.
So we can interface this module with any microcontroller which supports USART.
The HC- 05 can operate in two modes. One is Data mode and other is AT command mode. When the enable
pin is "LOW" the HC-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.

Page 1 of 12
Technical Specifications –

❖ Operating Voltage: 4V to 6V (Typically +5V)


❖ Operating Current: 30mA
❖ Range: <100m
❖ Works with Serial communication (USART) and TTL compatible.
❖ Can be easily interfaced with Laptop or Mobile phones with Bluetooth.

Procedure:
1) Connect 12V DC power adaptor to the Arduino Target board.
2) Start Arduino IDE and follow the steps mention in the “Steps to use of Arduino IDE software”.
3) Set the Mode_Sel slide switch in the “Arduino section” on “Pgm” mode.
4) 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.
5) Upload the program in to Arduino Nano board and remove the USB to mini USB cable from board.
6) Insert Bluetooth HC05 module to the HC05 connector in the Bluetooth section. 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:

Page 2 of 12
Program:

char inputByte;
int led = 4;

void setup() {
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
pinMode(led, OUTPUT);
}

void loop() {
//digitalWrite(led, HIGH);
while(Serial.available()>0){
inputByte= Serial.read();
Serial.println(inputByte);
if (inputByte=='1'){
digitalWrite(LED_BUILTIN,HIGH);
digitalWrite(led, LOW);
}
else if (inputByte=='2'){
digitalWrite(LED_BUILTIN,LOW);
digitalWrite(led, HIGH);
}
}
}

Applications of Bluetooth: (Student can search & write application here)

Exercises:
1. Repeat the same experiment to control two devices.
2. Repeat the same experiment with HEX commands.

Result: Interfacing of Bluetooth with Arduino is successfully studied, tested and observe the output.
Page 3 of 12
Aim: To study EM18 RFID module interfacing to Arduino.

Objectives:
➢ To understand the working principle of RFID module.
➢ To study interfacing of EM18 RFID module to Arduino.
➢ To study Arduino IDE software.

Software Used: Arduino IDE

Circuit Diagram:

Theory:
The EM-18 RFID Reader module operating at 125kHz is an inexpensive solution for your RFID based
application. The Reader module comes with an on-chip antenna and can be powered up with a 5V power
supply. Power-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:

Page 4 of 12
Procedure:
1) Connect 12V DC power adaptor to the Arduino Target board.
2) Start Arduino IDE and follow the steps mention in the “Steps to use of Arduino IDE software”.
3) Set the Mode_Sel slide switch in the “Arduino section” on “Pgm” mode.
4) 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.
5) Upload the program in to Arduino Nano board and don’t remove the USB to mini USB cable from
board (because we will observe the output on serial monitor of Arduino IDE).
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) Observe the output.

Program:
// VARIABLE DECLARATION
char input[12];
int count = 0;

// SETUP FUNCTION
void setup()
{
Serial.begin(9600); // START SERIAL AT BAUD RATE OF 9600 BITS/SEC
}
// LOOP FUNCTION
void loop()
{
if(Serial.available()) // CHECK FOR AVAILABILITY OF SERIAL DATA
{
count = 0; // Reset the counter to zero
/* Keep reading Byte by Byte from the Buffer till the RFID Reader Buffer is empty
or till 12 Bytes (the ID size of our Tag) is read */
while(Serial.available() && count < 12)
{
input[count] = Serial.read(); // Read 1 Byte of data and store it in the input[] variable
count++; // increment counter
delay(5);
}
Page 5 of 12
// PRINTING RFID TAG
for(int i=0;i<12;i++)
Serial.print(input[i]);
Serial.println();
}
}

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.

Page 6 of 12
Title: Temperature and humidity sensing using Arduino.
Aim: To study and understand Interfacing Temperature and humidity sensor (DHT11) to Arduino.
Objectives:
➢ To understand the working principle of DHT11 sensor.
➢ To study interfacing of DHT11 sensor to Arduino.
➢ To study Arduino IDE software.

Software Used: Arduino IDE


Circuit Diagram:

Theory:
The DHT11 sensor. It 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 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.

Procedure:
1) Connect 12V DC power adaptor to the Arduino Target board.
2) Start Arduino IDE and follow the steps mention in the “Steps to use of Arduino IDE software”.
3) Set the Mode_Sel slide switch in the “Arduino section” on “Pgm” mode.

Page 7 of 12
4) Install “dht” library (if not available) in to the Arduino IDE.
5) 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.
6) Upload the program in to Arduino Nano board and don’t remove the USB to mini USB cable from
board (because we will observe the output on serial monitor of Arduino IDE).
7) Make necessary connections to connect o/p pin from DHT11 section to D3 digital pin in the Arduino
section.
8) Set the Mode_Sel slide switch in the “Arduino section” on “Run” mode.
9) Observe the output on serial monitor of Arduino IDE.

Program:
#include<dht.h>
dht DHT;

// if you require to change the pin number, Edit the pin with your arduino pin.

#define DHT11_PIN 3
void setup() {
Serial.begin(9600);
Serial.println("welcome to TechPonder Humidity and temperature Detector"); }
void loop() { // READ DATA
int chk = DHT.read11(DHT11_PIN);
Serial.println(" Humidity " );
Serial.println(DHT.humidity, 1);
Serial.println(" Temparature ");
Serial.println(DHT.temperature, 1);
delay(5000);
}

Result: Interfacing of Temperature and humidity sensor (DHT11) with Arduino is successfully studied,
tested and observe the output.

Page 8 of 12
Title: Study of GSM system.
Aim: To study GSM system for message transmission.
Objectives:
➢ To understand the working principle of SIM800 GSM module.
➢ To study interfacing of SIM800 GSM module to Arduino.
➢ To study Arduino IDE software.

Software Used: Arduino IDE


Circuit Diagram:

Theory:
A GSM modem or GSM module is a hardware device that uses GSM mobile telephone technology to
provide a data link to a remote network. From the view of the mobile phone network, they are
essentially identical to an ordinary mobile phone, including the need for a SIM to identify themselves to
the network. GSM modems typically provide TTL-level serial interfaces to their host. [wikipedia]
SIM800 is a complete Quad-band GSM/GPRS solution in a SMT type which can be embedded in the
customer applications. SIM800 support Quad-band 850/900/1800/1900MHz, it can transmit Voice, SMS
and data information with low power consumption.

Procedure:
1) Connect 12V DC power adaptor to the MGTechSolution Arduino Target board.
2) Start Arduino IDE and follow the steps mention in the “Steps to use of Arduino IDE software”.
3) Set the Mode_Sel slide switch in the “Arduino section” on “Pgm” mode.
4) Compile the written program, if there are no errors connect the PC with Arduino Nano Board
available on the MGTechSolution Arduino Target board; by using USB to mini USB cable.

Page 9 of 12
5) Upload the program in to Arduino Nano board and remove the USB to mini USB cable from
board.
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) Observe the output.

Hint:
➢ Network LED blinking every 3 seconds means network is connected.
➢ Network LED blinking every second means that network is still being searched.

Program:

/*GSM 800/900 connections


* GSM Arduino
* Rx 11
* Tx 10
* GND GND
*/

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // software serial #1: RX = digital pin 10, TX = digital pin 11

void setup() {
// open the serial port:
// initialize control over the keyboard:
mySerial.begin(9600);
delay(1000);
}

void loop() {
// check for incoming serial data:

mySerial.println("AT+CMGF=1");
Page 10 of 12
delay(1000);
mySerial.println("AT+CMGS=\"+91xxxxxxxxxx\"");
delay(5000);
mySerial.println("GSM Testing on ARDUINO");
delay(1000);
mySerial.write(0x1a);
while(1)
{}
}
Receive Message:-

#include <SoftwareSerial.h>

//Create software serial object to communicate with SIM800L


SoftwareSerial mySerial(10, 11); //SIM800L Tx & Rx is connected to Arduino #3 & #2

void setup()
{
//Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
Serial.begin(9600);

//Begin serial communication with Arduino and SIM800L


mySerial.begin(9600);

Serial.println("Initializing...");
delay(1000);

mySerial.println("AT"); //Once the handshake test is successful, it will back to OK


updateSerial();

mySerial.println("AT+CMGF=1"); // Configuring TEXT mode


updateSerial();
mySerial.println("AT+CNMI=1,2,0,0,0"); // Decides how newly arrived SMS messages should be
handled
Page 11 of 12
updateSerial();
}

void loop()
{
updateSerial();
}

void updateSerial()
{
delay(500);
while (Serial.available())
{
mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port
}
while(mySerial.available())
{
Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port
}
}

Result: Interfacing of SIM800 GSM module with Arduino is successfully studied, tested and observe the
output.

Page 12 of 12

You might also like