[go: up one dir, main page]

0% found this document useful (0 votes)
34 views4 pages

University Roll No.: 1/16/FET/BCC/1/079

This document describes an experiment using an Arduino board connected to an Android smartphone via Bluetooth to read environmental values. The experiment has two parts: 1) Connecting the Arduino to the smartphone using a Bluetooth module. When the smartphone sends the character 'A' to the Arduino, it turns on an LED connected to pin 13. When 'B' is sent, the LED remains off. 2) Reading sensor values on the smartphone. The Arduino uses an analog sensor on pin A0 to read temperature values and sends the integer values back to the smartphone over Bluetooth every 100ms delay. Screenshots confirm the successful connection and data transfer between devices via Bluetooth.

Uploaded by

Saakshi Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views4 pages

University Roll No.: 1/16/FET/BCC/1/079

This document describes an experiment using an Arduino board connected to an Android smartphone via Bluetooth to read environmental values. The experiment has two parts: 1) Connecting the Arduino to the smartphone using a Bluetooth module. When the smartphone sends the character 'A' to the Arduino, it turns on an LED connected to pin 13. When 'B' is sent, the LED remains off. 2) Reading sensor values on the smartphone. The Arduino uses an analog sensor on pin A0 to read temperature values and sends the integer values back to the smartphone over Bluetooth every 100ms delay. Screenshots confirm the successful connection and data transfer between devices via Bluetooth.

Uploaded by

Saakshi Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

EXPERIMENT NO.

AIM: Bluetooth Interface:


i. Connecting Arduino with Mobile Device using the Bluetooth Module.
ii. Reading Environmental Values on Android Smartphone.

Hardware Requirements: Arduino Uno,Jumper Wires, Potentiometer, Bluetooth


interface

Theory:
Bluetooth –It is a wireless technology standard 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.400 to 2.485 GHz, and building
personal area networks (PANs).

Bluetooth spp pro- The software for the Bluetooth client communication tools (ie:
Bluetooth slave mode), Bluetooth serial communication can be tested. This tool three
modules:
1.Bytestream mode: the basic input-output model;
2. Keyboard mode: Can customize the output value of 12 buttons.Each button has three
states each state can send commands event.
3. Command Line: Set the command terminator for communication debugging

Algorithm:.
a. Connecting Arduino with Mobile device using Bluetooth module
 Define the temp as character.
 Set 9600 for starting serial communication.
 Set the pin mode as output which is connected to the LED, digital pin 13 in
this case.
 Use digitalWrite() function to set the initial output of LED as LOW.
 Use while loop for checking number of bytes.
 Use if loop for checking if no. of bytes>0
 Use Serial read for checking no. of ports.
 If temp=A, then it is noted as Waiting to receive.
 Use digitalWrite() function to set the initial output of LED as HIGH for pin
13.
 If temp=B,then it would not work.
 Use digitalWrite() function to set the initial output of LED as HIGH for pin
13.

University Roll No.: 1/16/FET/BCC/1/079


b. Reading Environmental Values on Android Smartphone
 Define temp as integer
 Set 9600 for starting serial communication.
 Set the analogRead for temperature sensor as A0.
 Print the Integer value according to the temp. sensor
 Provide delay of 1sec. Delay() function is used to specify the delay between
HIGH-LOW transition of the output.

Procedure:

a. Connecting Arduino with Mobile device using Bluetooth module


 Connect the Arduino board to the PC using the USB connector and Bluetooth
interface in such a way:-
1.Ground is connected to Ground.
2. Transmitter is connected to Receiver and vice versa.
3. 5V is connected to 5V.
 Select the board type and port.
 Write the sketch in the editor, verify the code and upload it to the board.
 Download the Bluetooth App ”Bluetooth spp pro” in your mobile device.
 After the app is downloaded, switch on your mobile Bluetooth.Scan for the
Bluetooth device name NULL.After you see NULL,pair your mobile to the
Bluetooth interface
 As soon as the byte stream mode gets open in the mobile, type A and result
would come as shown in the Fig1.
 If you type B ,nothing would be shown.
 Observe the output on circuit and capture the required screenshots.

Code:

a. Connecting Arduino with Mobile device using Bluetooth module

char temp();
void setup()
{
Serial.begin(9600);
PinMode(13,OUTPUT);
digitalWrite(5,LOW);
}
void loop()
{
University Roll No.: 1/16/FET/BCC/1/079
while(!Serial.available());
if(Serial.available()>0)
{
temp=Serial.read();
if(temp==’A’)
{
digitalWrite(13,HIGH);
}
If(temp==’B’)
{
digitalWrite(13,LOW);
}
}

b. Reading Environmental values on Android Smartphone


int temp;
void setup()
{
Serial.begin(9600);
}
void loop()
{
temp=analogRead(A0);
Serial.print(“Integer Value is”);
Serial.println(temp);
delay(100);
}

Experimental setup and output screenshots:


a. Connecting Arduino with Mobile device using Bluetooth module

University Roll No.: 1/16/FET/BCC/1/079


b. Reading Environmental values on Android Smartphone

Result: Connecting aurdino with Bluetooth and reading environmental values is


performed .

University Roll No.: 1/16/FET/BCC/1/079

You might also like