Project tutorial

Bluetooth Smart phone control with remote arduino © GPL3+

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

  • 3,487 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 .

 

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

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);
}

Comments

Similar projects you might like

Magic Lamp

by Nekhil ravi

  • 1,035 views
  • 3 comments
  • 12 respects

PuzzleBox

Project tutorial by Arduino

  • 265 views
  • 0 comments
  • 1 respect

Arduino MKR GSM 1400 and DTMF

by Arduino_Genuino

  • 4,012 views
  • 0 comments
  • 9 respects

Love You Pillow

Project tutorial by Arduino

  • 2,539 views
  • 0 comments
  • 5 respects

Infrared Replicator

Project tutorial by Gustavo Gonnet

  • 3,896 views
  • 6 comments
  • 26 respects
Add projectSign up / Login