100% found this document useful (1 vote)
807 views

Tutorial Arduino Bluetooth Controller 8 Lamp

This document provides instructions for creating a Bluetooth controlled lamp project using an Arduino board. It includes details on wiring an 8 LED circuit, uploading code to the Arduino to enable Bluetooth control of each LED, and using an Android app called "Bluetooth Controll Lamp" to turn the lamps on and off from a paired mobile device. Single lamps or all lamps can be controlled by sending character commands over Bluetooth from the app to the Arduino.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
807 views

Tutorial Arduino Bluetooth Controller 8 Lamp

This document provides instructions for creating a Bluetooth controlled lamp project using an Arduino board. It includes details on wiring an 8 LED circuit, uploading code to the Arduino to enable Bluetooth control of each LED, and using an Android app called "Bluetooth Controll Lamp" to turn the lamps on and off from a paired mobile device. Single lamps or all lamps can be controlled by sending character commands over Bluetooth from the app to the Arduino.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

TUTORIAL

Bluetooth Controll Lamp

1. Project1 Wiring With 8 LED

merahkemarun
https://play.google.com/store/apps/details?id=dev.merahkemarun.btcontrollamp

2. Project2 Wiring 8 Lamp With Relay Modul 8CH

merahkemarun
https://play.google.com/store/apps/details?id=dev.merahkemarun.btcontrollamp

3. Code Program Arduino


Copy code program below to arduino IDE project
/*
Lamp 1 connected to PinOut 2 Arduino
Lamp 2 connected to PinOut 3 Arduino
Lamp 3 connected to PinOut 4 Arduino
Lamp 4 connected to PinOut 5 Arduino
Lamp 5 connected to PinOut 6 Arduino
Lamp 6 connected to PinOut 7 Arduino
Lamp 7 connected to PinOut 8 Arduino
Lamp 8 connected to PinOut 9 Arduino
--->you can connected to relay modul 8 channel
Serial data sending from Bluetooth Controll Lamp.apk
data '1'-'8' to on is lamp 1-8
data 'A'-'H' to off is lamp 1-8
data '8' to on ALL is lamp
data 'I' to off ALL is lamp
*/
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); //Pin10 RX , Pin 11 TX connected to--> Bluetooth TX,RX
#define Lamp1 2
#define Lamp2 3
#define Lamp3 4
#define Lamp4 5
#define Lamp5 6
#define Lamp6 7
#define Lamp7 8
#define Lamp8 9
char val;
void setup() {
pinMode(Lamp1,OUTPUT);
pinMode(Lamp2,OUTPUT);
pinMode(Lamp3,OUTPUT);
pinMode(Lamp4,OUTPUT);
pinMode(Lamp5,OUTPUT);
pinMode(Lamp6,OUTPUT);
pinMode(Lamp7,OUTPUT);
pinMode(Lamp8,OUTPUT);
mySerial.begin(9600);
Serial.begin(9600);
}
merahkemarun
https://play.google.com/store/apps/details?id=dev.merahkemarun.btcontrollamp

void loop() {
//cek data serial from bluetooth android App
if( mySerial.available() >0 ) {
val = mySerial.read();
Serial.println(val);
}
//Lamp is on
if( val == '1' ) {
digitalWrite(Lamp1,HIGH); }
else if( val == '2' ) {
digitalWrite(Lamp2,HIGH); }
else if( val == '3' ) {
digitalWrite(Lamp3,HIGH); }
else if( val == '4' ) {
digitalWrite(Lamp4,HIGH); }
else if( val == '5' ) {
digitalWrite(Lamp5,HIGH);}
else if( val == '6' ) {
digitalWrite(Lamp6,HIGH);}
else if( val == '7' ) {
digitalWrite(Lamp7,HIGH);}
else if( val == '8' ) {
digitalWrite(Lamp8,HIGH);}
else if( val == '9' ) {
digitalWrite(Lamp1,HIGH);
digitalWrite(Lamp2,HIGH);
digitalWrite(Lamp3,HIGH);
digitalWrite(Lamp4,HIGH);
digitalWrite(Lamp5,HIGH);
digitalWrite(Lamp6,HIGH);
digitalWrite(Lamp7,HIGH);
digitalWrite(Lamp8,HIGH);
}
//Lamp is off
else if( val == 'A' ) {
digitalWrite(Lamp1,LOW); }
else if( val == 'B' ) {
digitalWrite(Lamp2,LOW); }
else if( val == 'C' ) {
digitalWrite(Lamp3,LOW); }
else if( val == 'D' ) {
digitalWrite(Lamp4,LOW); }
else if( val == 'E' ) {
digitalWrite(Lamp5,LOW);}
else if( val == 'F' ) {
digitalWrite(Lamp6,LOW);}
else if( val == 'G' ) {
merahkemarun
https://play.google.com/store/apps/details?id=dev.merahkemarun.btcontrollamp

digitalWrite(Lamp7,LOW);}
else if( val == 'H' ) {
digitalWrite(Lamp8,LOW);}
else if( val == 'I' ) {
digitalWrite(Lamp1,LOW);
digitalWrite(Lamp2,LOW);
digitalWrite(Lamp3,LOW);
digitalWrite(Lamp4,LOW);
digitalWrite(Lamp5,LOW);
digitalWrite(Lamp6,LOW);
digitalWrite(Lamp7,LOW);
digitalWrite(Lamp8,LOW);
}
}
//end==================================================================

//Arduino project created by: pujar


//http://fb.me/belajarrobot
//Apk Android remote controll suport this project, download on Playstore:
//Bluetooth Controll Lamp.apk
//https://play.google.com/store/apps/details?id=dev.merahkemarun.btcontrolllamp

4. Try APPS and Pair Bluetooth Modul to Android Device

merahkemarun
https://play.google.com/store/apps/details?id=dev.merahkemarun.btcontrollamp

You might also like