Project tutorial

Bluetooth Smart phone control with remote arduino © GPL3+

Turn an LED on and off using bluetooth connected smart phone with remote arduino.

  • 4,533 views
  • 1 comment
  • 11 respects

Components and supplies

About this project

In this project, I would control an LED using Smart phone APP with the remote Arduino connected using bluetooth, It is possible to control LED by sending simple signal from Android Phone. I used bluetooth connection to pair with Arduino and BlueTerm APP to connect with bluetooth device.

Before we connect bluetooth to Arduino, we are going to learn about bluetooth bee. As shown on the picture we can see where each pin is used for. If you want more information go to www.DFRobot.com I was using 4 pins (1,2,3,10) each consists of VCC(+), TX, RX, GND (-). connect these pins to Arduino pins.  



BlueTerm

We need to download APP in our smartphone.

1. If downloaded, open BlueTerm and pair it with Bluetooth bee connected to Arduino.

2. After pairing is done, open Arduino IDE and click on serial monitor as shown on the figure .

3. Type in any words on serial monitor like figure  and send it.

4. You can find the words on BlueTerm like figure .

 

Code

LED controlPlain text
At first, connect digital 2 and 3 pins with Bluetooth Bee's Tx and Rx pins. Then connect LED with digital pin 8. And make setup() and loop() functions.
#include <SoftwareSerial.h>

SoftwareSerial BTSerial(2,3); 
byte a=0;
int LED=8;
void setup(){
  Serial.begin(9600);
  Serial.println("Hello!");
  BTSerial.begin(9600);
  pinMode(LED,OUTPUT);
}

void loop(){
  if(BTSerial.available()){
      a  = BTSerial.read();
      BTSerial.write(a);
      if(a==49){
      BTSerial.write("led on  ");
      digitalWrite(LED,HIGH);
      }
      if(a==48){
      BTSerial.write("led off  ");
      digitalWrite(LED,LOW);
      }
  }
}
Push button controlPlain text
Connect push button switch with digital pin 13. Make setup() and loop() functions.
#include <SoftwareSerial.h>

SoftwareSerial BTSerial(2,3); 
int button = 13; 
void setup(){
  Serial.begin(9600);
  Serial.println("Hello!");
  BTSerial.begin(9600);
  pinMode(button,INPUT);
}

void loop(){
  if(digitalRead(button) == LOW)
  {
    BTSerial.write("0");
  }
  if(digitalRead(button) == HIGH)
  {
    BTSerial.write("1");
  }
}
Light sensor controlPlain text
Connect light sensor (CDs) with analog pin 5. Make setup() and loop() functions.
#include <SoftwareSerial.h>

SoftwareSerial BTSerial(2, 3); //Connect HC-06. Use your (TX, RX) settings

void setup()  
{
  Serial.begin(9600);
  Serial.println("Hello!");

  BTSerial.begin(9600);  // set the data rate for the BT port
}

void loop()
{
  int light = analogRead(A5);
  BTSerial.println(light);
  delay(200);
}

Schematics

LED control circuit
When bluetooth connection is completed, we could control LED with Arduino. Let’s send signal to Arduino by bluetooth and turn on and off our LED.
Led%20circuit
Push button control
Pair it with bluetooth like we did before, and push the button. You would see the digital value, 0 or 1 coming directly on your BlueTerm. If the value is too fast to you can add delay() in your code to slow it down.
Push%20button%20circuit
Light Sensor control
In this case we could experiment analog sensor with Arduino Bluetooth function. Same as previous works, you could confirm the changing light values in your BlueTerm.
Light%20sensor
Bluetooth Bee
Before we connect bluetooth to Arduino, we are going to learn about bluetooth bee.
As shown on the picture we can see where each pin is used for. If you want more information go to www.DFRobot.com

I used 4 pins (1,2,3,10) each consists of VCC(+), TX, RX, GND (-). connect these pins to Arduino pins.
Bee

Comments

Author

Icon square orangewhite 120x120
DFRobot
  • 4 projects
  • 34 followers

Published on

July 12, 2015

Members who respect this project

48950.jpgDefault34847 405141658588 2169074 nDefaultDefaultDefaultDefaultDefault

and 3 others

Project replicated by

Default
See similar projects
you might like

Similar projects you might like

Arduino Bluetooth Basic Tutorial

by Mayoogh Girish

  • 454,938 views
  • 42 comments
  • 239 respects

Home Automation Using Raspberry Pi 2 And Windows 10 IoT

Project tutorial by Anurag S. Vasanwala

  • 289,917 views
  • 96 comments
  • 678 respects

Security Access Using RFID Reader

by Aritro Mukherjee

  • 230,314 views
  • 38 comments
  • 239 respects

OpenCat

Project in progress by Team Petoi

  • 196,258 views
  • 154 comments
  • 1,364 respects
Add projectSign up / Login