Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Anjali Shaw
Published

Wireless Bluetooth Control

Control lights wirelessly via bluetooth connection

IntermediateFull instructions provided1 hour213
Wireless Bluetooth Control

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Resistor 330 ohm
Resistor 330 ohm
×1
LED (generic)
LED (generic)
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1

Software apps and online services

Arduino IDE
Arduino IDE
https://play.google.com/store/apps/details?id=com.appsvalley.bluetooth.arduinocontroller

Story

Read more

Schematics

circuit connection

make the ground and power connection
connect three leds with resistance in series to the 5,6, and 7 connection so that they can be lit.
connect rx of arduino to tx of Bluetooth module and same to tx end of it.
before uploading the code make sure you disconnect the rx of arduino.

Code

code

Arduino
#include <Arduino.h>
#include <Wire.h>
#include <SoftwareSerial.h>

int livingroom = 5;
int bedroom = 6;
int diningroom = 7;

SoftwareSerial Bluetooth(0, 1);
char Data;
void sendData(String transmitData){
Bluetooth.println(transmitData);}

void setup(){
    Bluetooth.begin(9600);
    pinMode(livingroom,OUTPUT);
    pinMode(bedroom,OUTPUT);
    pinMode(diningroom,OUTPUT);
}

void loop(){
    if(Bluetooth.available()){
        Data=Bluetooth.read();
        if(Data==('4')){
            digitalWrite(livingroom,1);
            sendData("Living Room Light ON");
        }
        if(Data==('1')){
            digitalWrite(livingroom,0);
            sendData("Living Room Light OFF");
        }
        if(Data==('5')){
            digitalWrite(bedroom,1);
            sendData("Bedroom Light ON");
        }
        if(Data==('2')){
            digitalWrite(bedroom,0);
            sendData("Bedroom Light OFF");
        }
        if(Data==('6')){
            digitalWrite(diningroom,1);
            sendData("Dining Room Light ON");
        }
        if(Data==('3')){
            digitalWrite(diningroom,0);
            sendData("Dining Room Light OFF");
        }
        if(Data==('9')){
            digitalWrite(livingroom,1);
            digitalWrite(bedroom,1);
            digitalWrite(diningroom,1);
            sendData("ALL LIGHTS ON");
        }
        if(Data==('0')){
            digitalWrite(livingroom,0);
            digitalWrite(bedroom,0);
            digitalWrite(diningroom,0);
            sendData("ALL LIGHTS OFF");
        }
    }
}

Credits

Anjali Shaw
10 projects • 7 followers
Contact

Comments

Please log in or sign up to comment.