Sunday, 11 January 2015

The ultimate bluetooth remote control arduino

Hi, in this post I'll show you how you can control as many things you want remotely with arduino via bluethooth.

Why did I call this ultimate remote control?
Well, I've called it ultimate because you can control too many things with any smart phone and you don't need multiple remote control plus another good thing about this one is that you can set your own pass code for example "ron" to turn red led on and "roff" to turn it off, not like "R" to turn it on and "r" to turn it off which I've seen in many places and that's very easy to get access but I wanted bit different and now in this way you can use 4 or 5 even more letters to control it so that no one can get access to you stuff so easily.

What do you need to make this?
well, you need
1x "BlueSerial Beta" app for your phone to send and receive data.
1x Arduino board 
1x Bluetooth transceiver
1x 10k resistor
1x 20k resistor
few jumper wires and the code.

Note: a) Try not to connect the bluetooth transceiver straight to 5v it might burn it, connect the vcc to 3.3v and for the rest of it please see the diagram below.

b) Please don't connect the "RXD" and "TXD" to the Arduino while you upload the sketch, if you do then you might see an error message.

Before I share the code with you I'd like to give huge thanks to Adison Mhanna whos has written this code for me.

The sketch:

//Written by Adison Mhanna

int rdled = 2;
int motor = 3;
int gnled = 4;
int relay = 59;

void setup() {
pinMode(rdled, OUTPUT);
pinMode(motor, OUTPUT);
pinMode(gnled, OUTPUT);
pinMode(relay, OUTPUT);
String str;

void loop() {
str = Serial.readStringUntil('\n');

if(str == "ron")
digitalWrite(rdled, HIGH);
Serial.println("Red led is on");
if(str == "roff")
digitalWrite(rdled, LOW);
Serial.println("Red led is off");

if(str == "mon")
digitalWrite(motor, HIGH);
Serial.println("Motor is on");
if(str == "moff")
digitalWrite(motor, LOW);
Serial.println("Motor is off");

if(str == "gon")
digitalWrite(gnled, HIGH);
Serial.println("Green led is on");
if(str == "goff")
digitalWrite(gnled, LOW);
Serial.println("Green led is off");

if(str == "rlon")
digitalWrite(relay, LOW);
Serial.println("Relay led is on");
if(str == "rloff")
digitalWrite(relay, HIGH);
Serial.println("Relay led is off");


You can play the video to see the code in action.

No comments:

Post a Comment