Escolar Documentos
Profissional Documentos
Cultura Documentos
REPORT
PROJECT NAME:
Led Lamp
GROUP MEMBERS:
Summaira EE-185
Neha Naushad EE-190
Sidra EE-194
INTERNAL:
Sir Hassan-ul-Haq
1
TABLE OF CONTENTS
LIST OF FIGURES...............................................................................................................iv
LIST OF TABLES.................................................................................................................vi
ACKNOWLEDGEMENT....................................................................................................vii
ABSTRACT........................................................................................................................viii
CHAPTER 1- INTRODUCTION...........................................................................................1
CHAPTER 2- BACKGROUND.............................................................................................2
CHAPTER 3: WORKING......................................................................................................3
3.1 PROTOTYPE:..................................................................................................................3
3.3.2 WORKING:............................................................................................................20
3.3.5 JQUERY:................................................................................................................36
CHAPTER 4 -WORKING....................................................................................................38
4.1 HOUSING.......................................................................................................................38
RECOMMENDATIONS......................................................................................................84
5.1 CONCLUSION...............................................................................................................84
REFERENCES:....................................................................................................................87
3
LIST OF FIGURES
Figure 1.1……………………………………………………………………………… 1
Figure 3.1……………………………………………………………………………….4
Figure 3.2……………………………………………………………………………….4
Figure 3.3……………………………………………………………………………….5
Figure 3.4……………………………………………………………………………….6
Figure 3.5……………………………………………………………………………….7
Figure 3.6…………………………………………………………………………….....8
Figure 3.7……………………………………………………………………………….18
Figure 3.8...………………...…………………………………………………………...18
Figure 3.9……………………………………………….………………………………19
Figure 3.10………………………………………………………………….…………..20
Figure 3.11……………………………………………………………………………...20
Figure 3.12…….………………………………………………………………………..22
Figure 3.13……………………………………………………………………………...33
Figure 3.14…….………………………………………………………………………..37
Figure 4.1……………………………………………………………………………….38
Figure 4.2……..………………………………………………………………………...39
Figure 4.3……………………………………………………………………………….44
Figure 4.4……………………………………………………………………………….41
Figure 4.5.……..………………………………………………………………………..42
Figure 4.6……………………………………………………………………………….43
Figure 4.7……………………………………………………………………………….43
Figure 4.8……………………………………………………………………………….44
4
Figure 4.9……………………………………………………………………………….45
Figure 4.10……………………………………………………………………………..46
Figure 4.11……………………………………………………………………………..65
Figure 4.12……………………………………………………………………………..66
Figure 4.13……………………………………………………………………………..73
Figure 4.14……………………………………………………………………………..74
Figure 4.15……………………………………………………………………………..74
Figure 4.16……………………………………………………………………………..75
Figure 4.17……………………………………………………………………………..76
Figure 4.18……………………………………………………………………………..77
Figure 4.19……………………………………………………………………………..77
Figure 4.20……………………………………………………………………………..78
Figure 4.21……………………………………………………………………………..79
Figure 4.22……………………………………………………………………………..79
Figure 4.23…………………………………………………………………………..…80
Figure 4.24……………………………………………………………………………..81
Figure 4.25……………………………………………………………………………..82
Figure 4.26……………………………………………………………………………..82
5
LIST OF TABLES
Table 4.1………………………………………………………………………………….68
Table 4.2………………………………………………………………………………….69
Table 4.3………………………………………………………………………………….70
Table 4.4………………………………………………………………………………….71
Table 4.5………………………………………………………………………………….71
Table 4.6………………………………………………………………………………….72
Table 4.7………………………………………………………………………………….83
6
ACKNOWLEDGEMENT
We are thankful to Almighty Allah for the successful completion of our Final Year Project.
Without His providence this project could not have been completed.
We would like to express our deepest thanks to all those who provided us with the
possibility to complete this project.
Special thanks to our FYP internal advisor, Mr. Hassan Ul Haq for his crucial role in this
project. We are highly indebted to him for his continuous coordination, suggestions and
most importantly his encouragement towards selecting this particular project since the idea
was new and we had to work from the scratch.
Last but not the least, many thanks go to our parents and families for facilitating us for this
project in every aspect, funding our FYP and of course for their prayers.
7
ABSTRACT
The high brightness white Light Emitting Diode (LED) as a solid-state lighting source has
become popular in general lighting application. As energy saving is a critical issue in our
society due to economic and environmental causes, LEDs can be used as they have
amazing advantages over other conventional lighting sources like high efficiency, longer
lifetime, smaller size, smooth dimming, environmental friendliness and safety
improvements.
Inspired by Philips Hue lights, we have designed a lamp in which individual LEDs can be
controlled by using Bluetooth and Wi-Fi so that the lamp can have the capability of
dimming and to change the pattern of LEDs so that the overall lumens emitted by the lamp
can be varied according to the requirement of the user.
This report also pre-defines some specific patterns of the LEDs according to the needs of
domestic user via Wi-Fi and Bluetooth modules. In this way we have designed a lamp
which is not only energy efficient, as the LEDs are known for, but also we have made it
smart enough to satisfy the users' requirements of lighting without disturbing the power
factor.
8
CHAPTER 1- INTRODUCTION
Due to the tremendous advantages of LED we have decided to design a LED bulb in which
we will control LEDS individually.
Page 1 of 97
FIGURE 1.1: LED LAMP
CHAPTER 2- BACKGROUND
With the growth of manufacturing process and materials, high brightness LED is now
attracting attention from industry and academics. LED has been acknowledged as the most
potential 4th Generation light source of 21st century. Compared with all the other commonly
used lighting sources, it has 30% efficacy. In LED’s, 15%-25% of the electric power is
emitted as visible light and the remaining portion is dissipated as heat. LEDs radiate no IR
and UV radiations and thus making it safe for human eyes. It has very long lifespan of
100,000 hours which is more than 10 times of Compact Fluorescent Lamps. Also with the
evaluation of lighting industries, lighting designers are moving towards solid state
technology by making LED products.
Looking at the prevailed technology, we got convinced and excited to design this LED
Lamp in order to enhance its range of usage by bringing LED under the control of users via
Bluetooth and Wi-Fi.
Page 2 of 97
Page 3 of 97
CHAPTER 3: WORKING
3.1 PROTOTYPE:
3.1.1 PCB DESIGNING:
Our project was to design a Lamp where the user can control individual LEDs via
Bluetooth or Wi-Fi. Before designing the actual hardware of our LED Lamp, we first tested
our experiments and codes on a prototype.
Our prototype consisted of 17 LEDs with 330 ohms resistors connected individually to
every LED on a PCB Board. With the help of a male header, we linked our LEDs with
Arduino Uno.
Our first task in making the prototype was to design the PCB layout. We first attempted to
make layout by using Eagle software as it contains all the standards, but while routing we
were facing many issues as the wires kept getting overlapped with each other because of
many LEDs and resistors that we used.
Page 4 of 97
FIGURE 3.1: INCORRECT LAYOUT OF PCB DESIGN
After many attempts, we switched to Proteus software, where we finally got rid of
overlapping and our layout was ready.
Page 5 of 97
FIGURE 3.3: PCB BOARD
Our motive of designing this prototype was to check the performance of LEDs and
experiment different LED patterns on it before implementing it on the real hardware of
Lamp.
Page 6 of 97
FIGURE 3.4: BLUETOOTH MODULE HC-05
Following are the steps of connecting Bluetooth Module HC-05 with Arduino-Uno.
i. Connect Vcc of HC-05 with 3V of Arduino Uno.
ii. Connect ground (GND) of HC-05 with Ground of Arduino Uno.
iii. Connect Receiver (RXD) pin with the Transmitter pin of Arduino Uno.
iv. Connect Transmitter (TXD) pin with the Receiver pin of Arduino Uno.
v. The Arduino is powered by Laptop.
Furthermore, we connected the LEDs with the Arduino with the help of a header and
jumpers. Both (LEDs and header) mounted on the PCB. We connected 16 LEDs on pin
numbers, 0,2,4,5,8,9,10,11,12,13,14,15.16.17.18.19 of Arduino UNO. As shown in
following figure (made by using Proteus Software)
Page 7 of 97
FIGURE 3.5: CIRCUIT DIAGRAM OF BLUETOOTH MODULE CONNECTION WITH ARDUINO UNO
Our journey with Bluetooth module went quite smoothly except of few problems that we
faced in coding the program. But after giving many hours with complete dedication, we
achieved our goal. We needed an Android Application in order to check the performance of
our LEDs. So we used an Application by the name of ‘BlueTerm’.
Page 8 of 97
Page 9 of 97
FIGURE 3.6: BLUETERM APPLICATION
int VAR = 0;
int led4;
int led5;
int led8;
int led9;
int led10;
int led11;
int led12;
int led13;
int led14;
int led15;
int led16;
int led17;
int led18;
int led19;
int led2;
void setup() {
Page 10 of 97
pinMode(4,OUTPUT);
digitalWrite(4,HIGH);
pinMode(5,OUTPUT);
digitalWrite(5,HIGH);
pinMode(8,OUTPUT);
digitalWrite(8,HIGH);
pinMode(9,OUTPUT);
digitalWrite(9,HIGH);
pinMode(10,OUTPUT);
digitalWrite(10,HIGH);
pinMode(11,OUTPUT);
digitalWrite(11,HIGH);
pinMode(12,OUTPUT);
digitalWrite(12,HIGH);
pinMode(13,OUTPUT);
Page 11 of 97
digitalWrite(13,HIGH);
pinMode(14,OUTPUT);
digitalWrite(14,HIGH);
pinMode(15,OUTPUT);
digitalWrite(15,HIGH);
pinMode(16,OUTPUT);
digitalWrite(16,HIGH);
pinMode(17,OUTPUT);
digitalWrite(17,HIGH);
pinMode(18,OUTPUT);
digitalWrite(18,HIGH);
pinMode(19,OUTPUT);
digitalWrite(19,HIGH);
pinMode(2,OUTPUT);
digitalWrite(2,HIGH);
Serial.begin(9600);
Page 12 of 97
}
void loop() {
if(Serial.available() > 0)
VAR = Serial.read();
led4=digitalRead(4);
led5=digitalRead(5);
led8=digitalRead(8);
led9=digitalRead(9);
led10=digitalRead(10);
led11=digitalRead(11);
led12=digitalRead(12);
led13=digitalRead(13);
led14=digitalRead(14);
led15=digitalRead(15);
led16=digitalRead(16);
led17=digitalRead(17);
led18=digitalRead(18);
Page 13 of 97
led19=digitalRead(19);
led2=digitalRead(2);
if(VAR=='1')
{ digitalWrite(4,!led4);
if(VAR=='2')
{digitalWrite(5,!led5);
if(VAR=='3')
{digitalWrite(8,!led8);
if(VAR=='4')
{digitalWrite(9,!led9);
if(VAR=='5')
{digitalWrite(10,!led10);
Page 14 of 97
if(VAR=='6')
{digitalWrite(11,!led11);
if(VAR=='7')
{digitalWrite(12,!led12);
if(VAR=='8')
{digitalWrite(13,!led13);
if(VAR=='9')
{digitalWrite(14,!led14);
if(VAR=='a')
{digitalWrite(15,!led15);
if(VAR=='b')
{digitalWrite(16,!led16);
if(VAR=='c')
{digitalWrite(17,!led17);
}
Page 15 of 97
if(VAR=='d')
{digitalWrite(18,!led18);
if(VAR=='e')
{digitalWrite(19,!led19);
if(VAR=='f')
{digitalWrite(2,!led2);
digitalWrite(4, !led4);
digitalWrite(5, !led5);
digitalWrite(8, !led8);
digitalWrite(9, !led9);
digitalWrite(13, !led13);
digitalWrite(17, !led17);
Page 16 of 97
digitalWrite(18, !led18);
digitalWrite(19, !led19);
digitalWrite(2, !led2);
digitalWrite(10, !led10);
digitalWrite(14, !led14);
if(VAR=='i')//INNER SQUARE
digitalWrite(12, !led12);
digitalWrite(11, !led11);
digitalWrite(16, !led16);
digitalWrite(15, !led15);
if(VAR=='j')//LEFT DIAGONAL
digitalWrite(4, !led4);
digitalWrite(12, !led12);
digitalWrite(15, !led15);
Page 17 of 97
digitalWrite(18, !led18);
digitalWrite(9, !led9);
digitalWrite(16, !led16);
digitalWrite(11, !led11);
digitalWrite(19, !led19);
digitalWrite(4, !led4);
digitalWrite(5, !led5);
digitalWrite(8, !led8);
digitalWrite(9, !led9);
Page 18 of 97
iii) Finally, we ascribed the Alpha-Numeric keys of Application BlueTerm with the
already defined integers with which we will be controlling the LEDs. By
pressing the pre-defined Alpha-Numeric keys on BlueTerm, that particular LED
will toggle its state.
Once the coding was done, we checked whether the LEDs were performing as we desired
by using the application “BlueTerm”.
Page 19 of 97
FIGURE 3.8: PATTERN OF LED
Page 20 of 97
All the LEDs were performing perfectly and gave us our desired results.
So now we moved on to our next mission, which was to run LEDs through Wi-Fi.
It is cost effective and can be performed like any micro-controller by putting some extra
efforts. It includes a RAM, an RF front end, and usually a TCP/IP (Transmission Control
Protocol/Internet Protocol) stack which allows it to get connected with a nearby access
point in order to perform as an access point itself or both. ESP8266 modules use the
standard AT Command set firmware by connecting it to micro-controller using the serial
UART.
Page 21 of 97
FIGURE 3.11: ESP 8266-01 PIN CONFIGURATION
3.3.2 WORKING:
The ESP module which is used in our project is ESP 8266-01.
For making our LED Lamp accessible by Wi-Fi, we had following work lined up:
As for the hardware part, following is the pin layout with which we connected ESP with
Arduino-Uno.
i) The Vcc and CH-PD pins of ESP operate at 3.3V so we powered them by an
adapter of 5V by using an IC “LM317” which steps down 5 Volts to 3.3 Volts.
ii) We connected the ground of ESP with the Ground of Arduino.
iii) The Transmitter of ESP is connected with pin number 6 of Arduino.
iv) The Receiver of ESP is connected with pin number 7 of Arduino.
v) The Arduino is powered by Laptop.
vi) The transmitter of Arduino gives 5V signal, but ESP operates at 3.3V so there was a
risk of ESP getting burned. In order to avoid that, we used a voltage divider (by
using resistors 1.2K ohms and 2.2K ohms) to step down 5V to 3.3V.
Page 22 of 97
FIGURE 3.12: CIRCUIT DIAGRAM OF CONNECTION OF ESP WITH ARDUINO UNO
Unlike our easy journey with Bluetooth Module, ESP 8266 gave us a very difficult time.
We had the idea that if we’ll be connecting the ESP to Arduino Uno through a breadboard,
then the connection will keep getting lose. So we soldered male headers on a Vero Board
and fixed our ESP on one of them, while others were used to connect the Ground,
Transmitter and Receiver pins to Arduino Uno through jumpers.
#include <SoftwareSerial.h>
Page 23 of 97
SoftwareSerial wifi(6,7);
// This means that you need to connect the TX line from the
esp to the Arduino's pin 6
void setup()
Serial.begin(9600);
wifi.begin(9600);
pinMode(4,OUTPUT);
digitalWrite(4,HIGH);
pinMode(5,OUTPUT);
digitalWrite(5,HIGH);
pinMode(8,OUTPUT);
digitalWrite(8,HIGH);
pinMode(9,OUTPUT);
digitalWrite(9,HIGH);
Page 24 of 97
pinMode(10,OUTPUT);
digitalWrite(10,HIGH);
pinMode(11,OUTPUT);
digitalWrite(11,HIGH);
pinMode(12,OUTPUT);
digitalWrite(12,HIGH);
pinMode(13,OUTPUT);
digitalWrite(13,HIGH);
pinMode(14,OUTPUT);
digitalWrite(14,HIGH);
pinMode(15,OUTPUT);
digitalWrite(15,HIGH);
pinMode(16,OUTPUT);
Page 25 of 97
digitalWrite(16,HIGH);
pinMode(17,OUTPUT);
digitalWrite(17,HIGH);
pinMode(18,OUTPUT);
digitalWrite(18,HIGH);
pinMode(19,OUTPUT);
digitalWrite(19,HIGH);
pinMode(2,OUTPUT);
digitalWrite(2,HIGH);
sendData("AT+CWJAP=\"ZONG MBB-E8372-
574E\",\"69498271\"\r\n",20000,VAR);
Page 26 of 97
sendData("AT+CIPSERVER=1,80\r\n",1000,VAR); // turn on server on port
80
void loop()
if(wifi.available())
if(wifi.find("+IPD,"))
delay(1000);
wifi.find("pin=");
Page 27 of 97
LEDnumber += (wifi.read()-48);
digitalWrite(4, !digitalRead(4));
digitalWrite(5, !digitalRead(5));
digitalWrite(8, !digitalRead(8));
digitalWrite(9, !digitalRead(9));
digitalWrite(13, !digitalRead(13));
digitalWrite(17, !digitalRead(17));
digitalWrite(18, !digitalRead(18));
Page 28 of 97
digitalWrite(19, !digitalRead(19));
digitalWrite(2, !digitalRead(2));
digitalWrite(10, !digitalRead(10));
digitalWrite(14, !digitalRead(14));
digitalWrite(12, !digitalRead(12));
digitalWrite(11, !digitalRead(11));
digitalWrite(16, !digitalRead(16));
digitalWrite(15, !digitalRead(15));
{ digitalWrite(4, !digitalRead(4));
digitalWrite(12, !digitalRead(12));
digitalWrite(15, !digitalRead(15));
digitalWrite(18, !digitalRead(18));
Page 29 of 97
}
digitalWrite(9, !digitalRead(9));
digitalWrite(16, !digitalRead(16));
digitalWrite(11, !digitalRead(11));
digitalWrite(19, !digitalRead(19));
digitalWrite(4, !digitalRead(4));
digitalWrite(5, !digitalRead(5));
digitalWrite(8, !digitalRead(8));
digitalWrite(9, !digitalRead(9));
closeHukm+=connetionShanakht;
closeHukm+="\r\n";
Page 30 of 97
sendData(closeHukm,1000,VAR);
wifi.print(command);
while(wifi.available())
Page 31 of 97
char c = wifi.read();
response+=c;
if(VAR)
Serial.print(response);
return response;
Page 32 of 97
fixed then the Serial Monitor would show the command of “busy p” and sometimes it
won’t give us any response at all. It made us think that the problem is with the net device,
but on running the browser, it was working fine.
We needed the IP address to place it in the html code for our webpage.
When nothing seemed to work, a group mate calmly listed down all the possibilities where
we could be going wrong which are as follows:
i) CHECK FOR NET DEVICE: We were initially using Zong 4G network, but
to check whether it’s responding or not we used the NEDUET Wi-Fi. The serial
monitor wasn’t giving IP address in it either. Hence one possibility was removed
and our net device was working properly.
ii) CHECK FOR ESP MODULE: For this, we ran our ESP module in someone
else’s circuit. And it was performing perfectly there. So, we got to know where
we were mistaking, that is, our circuit had some problem.
We made the circuit once again. Initially we were using Zener diode to regulate the voltage.
But this time, we used Voltage Divider from resistors 1.2K ohm and 2.2K ohm to step down
the voltage.
Upon checking, our ESP circuit worked and finally the serial monitor gave the IP.
Page 33 of 97
Page 34 of 97
FIGURE 3.13: SERIAL MONITOR RESULT
(After achieving complete success in our prototype, we pondered over where in circuit we
were going wrong. We realized our blunder, that we had connected the Zener diode in
between the receiver and ground of Arduino Uno instead it should have been in between the
Transmitter of Arduino and Receiver of ESP.)
Page 35 of 97
The code of our webpage is as follows:
<!doctype html>
<html>
<head>
</head>
<body>
Page 36 of 97
<button id="14" class="led">14</button> <!-- button for pin 12 --> 
</br>
Page 37 of 97
<script src="jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".led").click(function(){
});
});
</script>
</body>
</html>
3.3.6 JQUERY:
The HTML code uses the Javascript library of JQuery. It can be obtained from the
following link:
http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js
Save this library in the same dictionary where the HTML code for webpage is saved or else
it won’t perform any function.
Page 38 of 97
The following figure shows how our webpage looked like on Chrome. (Right click the
webpage file. Go to ‘Open with’ and then select ‘Google Chrome’)
Page 39 of 97
CHAPTER 4 -WORKING
Once the testing of LEDs got completed, the other challenge of placing the whole circuit in
a housing, compact enough to give it an appearance of a LED lamp, was in front of us. We
performed all the tests on Arduino Uno which was too bulky to place in a small housing, so
we shifted our whole prototype on Arduino Nano. For that purpose, we needed to perform
all the tests from scratch. But with complete dedication, we were able to get perfect results
within a day.
4.1 HOUSING
For housing, we bought a bulb and emptied all of its circuits such that only the body of the
bulb was all that remained. Still the housing was smaller for our circuit to get fit in it. So
we brought all of our circuit in a small Vero Board with an area of 6x6 cm2.
Page 40 of 97
It was a highly risky task as we needed to place the following components on a compact
Vero Board.
i) Arduino Nano
ii) Bluetooth HC-05
iii) ESP-8266
iv) IC LF33
v) IC ULN2003A
vi) 6, 1.5 ohms Resistors
vii) 2.2K and 1.2K Resistors
viii) Nut connector
ix) Female Header
For giving power to the circuit, we bought a 5Volt Adapter of 2 Amperes and opened its
housing to only take out its small circuit with wires.
Page 41 of 97
FIGURE 4.3: LF33 PIN CONFIGURATION
The connections are shown below in the circuit made using Proteus software.
Page 42 of 97
FIGURE 4.4: FINAL COMBINED CIRCUIT WITH ARDUINO NANO, BLUETOOTH MODULE HC-05 AND
ESP8266
Page 43 of 97
Figure 4.5 FINAL CIRCUIT FOR HOUSING
Following are the images of our housing and placement of the circuit and adapter in it.
Page 44 of 97
FIGURE 4.6: BULB FOR HOUSING
Page 45 of 97
Figure 4.8 HOUSING CONTAINING CIRCUITS OF ADAPTER AND BLUETOOTH & ESP
Now the task of soldering LEDs on bulb was left. Like every student, we also first thought
about soldering the LEDs on a Vero Board but the problem of LEDs getting heated up
stopped us from implementing this idea. We searched on soldering LEDs and found out
about Aluminum PCBs which doesn’t let the LEDs get heated up.
But the problem was that Aluminum PCBs are not available in Pakistan and in order to
import it from other countries, we needed about one month to get it. We didn’t have that
much time so, we dropped this idea too.
In the end, we decided to paste the LEDs on the upper part of the emptied bulb with an Elfy
glue stick. Still we were scared for the LEDs getting heated up, so we used a Thermally
Conducting Gel in between the LEDs and its heat sink.
Page 46 of 97
i) All the anodes of LEDs were shorted with each other and then connected with
the 5 Volts of supply.
ii) All cathode pins are connected with OUT pins of ULN2003a.
Following is a graphical image of the pattern in which LEDs are placed in our final
hardware. The numbers inside the circle represent the Arduino Nano’s pin numbers on
which they are connected.
Page 47 of 97
FIGURE 4.10: LEDs PIN NUMBERS ON ARDUINO NANO.
#include <SoftwareSerial.h>
SoftwareSerial merawifi(6,7);
Page 48 of 97
// RX of esp to the Arduino's pin 7
//*********
while(merawifi.available())
response+=c;
Page 49 of 97
}
Serial.print(response);
return response;
//******
char data[dataSize];
Hukm.toCharArray(data,dataSize);
Serial.write(data,dataSize);
Serial.println("\r\n========================================");
Page 50 of 97
long int time = millis();
while(merawifi.available())
response+=c;
Serial.print(response);
return response;
//******
void setup()
Serial.begin(9600);
Page 51 of 97
merawifi.begin(9600);
pinMode(2,OUTPUT);
digitalWrite(2,HIGH);
pinMode(3,OUTPUT);
digitalWrite(3,HIGH);
pinMode(4,OUTPUT);
digitalWrite(4,HIGH);
pinMode(5,OUTPUT);
digitalWrite(5,HIGH);
pinMode(8,OUTPUT);
digitalWrite(8,HIGH);
pinMode(9,OUTPUT);
digitalWrite(9,HIGH);
Page 52 of 97
toesp("AT+RST\r\n",2000); // reset module
toesp("AT+CWJAP=\"ZONG MBB-E8372-574E\",\"69498271\"\r\n",3000);
delay(5000);
Serial.println("Server Ready");
void loop()
if(merawifi.find("+IPD,"))
delay(1000);
Page 53 of 97
// the ASCII decimal value and 0 (the first decimal number)
starts at 48
int LEDnumber = (merawifi.read()-48); // get first number i.e. if the pin 13 then the 1st
number is 1
LEDnumber*=10;
LEDnumber +=secondNumber; // get second number, i.e. if the pin number is 13 then
the 2nd number is 3, then add to the first number
Page 54 of 97
{
digitalWrite(2, !digitalRead(2));
digitalWrite(3, !digitalRead(3));
digitalWrite(4, !digitalRead(4));
digitalWrite(5, !digitalRead(5));
digitalWrite(8, !digitalRead(8));
digitalWrite(9, !digitalRead(9));
digitalWrite(2, !digitalRead(2));
digitalWrite(3, !digitalRead(3));
digitalWrite(9, !digitalRead(9));
digitalWrite(2, !digitalRead(2));
digitalWrite(8, !digitalRead(8));
digitalWrite(9, !digitalRead(9));
Page 55 of 97
}
digitalWrite(2, !digitalRead(2));
digitalWrite(3, !digitalRead(3));
digitalWrite(4, !digitalRead(4));
digitalWrite(5, !digitalRead(5));
digitalWrite(8, !digitalRead(8));
if(LEDnumber==14)//central LED
digitalWrite(9, !digitalRead(9));
digitalWrite(3, !digitalRead(3));
digitalWrite(4, !digitalRead(4));
Page 56 of 97
digitalWrite(9, !digitalRead(9));
digitalWrite(5, !digitalRead(5));
digitalWrite(8, !digitalRead(8));
digitalWrite(9, !digitalRead(9));
// build string that is send back to device that is requesting pin toggle
String ajza;
ajza += LEDnumber;
if(digitalRead(LEDnumber))
ajza += "ON";
Page 57 of 97
}
else
ajza += "OFF";
closingHukm+="\r\n";
int state = 0;
int led2;
int led3;
int led4;
int led5;
Page 58 of 97
int led8;
int led9;
state = Serial.read();
led2=digitalRead(2);
led3=digitalRead(3);
led4=digitalRead(4);
led5=digitalRead(5);
led8=digitalRead(8);
led9=digitalRead(9);
if(state=='1')
{ digitalWrite(2,!led2);
if(state=='2')
{digitalWrite(3,!led3);
if(state=='3')
{digitalWrite(4,!led4);
if(state=='4')
Page 59 of 97
{digitalWrite(5,!led5);
if(state=='5')
{digitalWrite(8,!led8);
if(state=='6')
{digitalWrite(9,!led9);
digitalWrite(2, !led2);
digitalWrite(3, !led3);
digitalWrite(4, !led4);
digitalWrite(5, !led5);
digitalWrite(8, !led8);
if(state=='i')//INNER LED
digitalWrite(9, !led9);
Page 60 of 97
}
if(state=='a')//ALL LEDS
digitalWrite(2, !led2);
digitalWrite(3, !led3);
digitalWrite(4, !led4);
digitalWrite(5, !led5);
digitalWrite(8, !led8);
digitalWrite(9, !led9);
digitalWrite(2, !digitalRead(2));
digitalWrite(8, !digitalRead(8));
digitalWrite(9, !digitalRead(9));
digitalWrite(2, !digitalRead(2));
digitalWrite(3, !digitalRead(3));
digitalWrite(9, !digitalRead(9));
Page 61 of 97
}
digitalWrite(3, !digitalRead(3));
digitalWrite(4, !digitalRead(4));
digitalWrite(9, !digitalRead(9));
digitalWrite(5, !digitalRead(5));
digitalWrite(8, !digitalRead(8));
digitalWrite(9, !digitalRead(9));
4.4 WEBPAGE:
Following is the Webpage code for 6 LEDs while for Bluetooth Module we used the same
BlueTerm Application.
<!doctype html>
<html>
Page 62 of 97
<head>
</head>
<style>
button[type=circle]{
border: 20;
background: yellow;
width: 30px;
border-radius: 500px;
body {
background-image: url("badal.jpg");
</style>
<body>
Page 63 of 97
<!--video coding-->
<center>
<video autoplay>
</video>
</center>
<!-- in the <button> tags below the ID attribute is the value sent to the arduino -->
</br></br>
<center>
Page 64 of 97
<button type="circle" id="2" class="led">1</button> <!-- button for pin 8 -->
</br>
</br>
</br>
</center>
</br>
Page 65 of 97
<button id="11" class="led">PATTERN 3</button> <!-- button for pin 11
-->  
<script src="jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".led").click(function(){
});
});
</script>
</body>
Page 66 of 97
</html>
Page 67 of 97
Figure 4.12 WORKING LED LAMP
Page 68 of 97
1. Fix the lamp in holder.
2. Turn all other lights off.
3. Turn the lamp on.
4. Measure lux exactly in front of the lamp and get readings by increasing the distance
0.5 meters at a time.
5. Repeat the experiment by moving the lux meter 1 meter away always starting at the
just below the lamp level.
6. At each point you need to take multiple readings by moving the lux meter 0.5 meter
lower.
7. L is the lamp. You need to measure at all X points and L point.
8. In a single reading, the lux meter shows both the maximum and minimum value of
lux at a point. For accuracy, take each reading twice and then average the four
maximum and minimum lux values to get a final value at that point.
<--1m-->
^ X 1 X2 X 3
1m
v
X4 L X5
X6 X7 X8
Page 69 of 97
DESIGNED LAMP:
Unit = Lux
0m 0.5m 1m 1.5m
max min avg max min avg max min avg max min avg
X1 0.55 0.4 0.4825 2.53 2.34 2.99 6.97 6.82 7.0075 7.95 7.57 7.66
0.53 0.45 3.6 3.49 7.2 7.04 7.7 7.42
11.8
X2 0.63 0.42 0.545 4.95 4.78 4.9175 4 11.42 11.645 13.81 13.45 13.535
11.9
0.66 0.47 5.21 4.73 6 11.36 13.88 13
X3 0.67 0.15 0.455 1.91 1.69 2.0375 6.02 5.48 5.9625 11.5 9.32 9.23
0.59 0.41 2.43 2.12 6.56 5.79 8.5 7.6
15.1 13.122
X4 0.28 0.25 0.3025 10.08 9.6 9.9625 1 14.41 14.795 13.31 12.86 5
15.3
0.37 0.31 10.27 9.9 8 14.28 13.33 12.99
14.5 13.677
X5 0.83 0.64 0.635 4.82 4.6 5.6275 7 13.76 14.49 13.8 13.71 5
14.9
0.59 0.48 7.15 5.94 5 14.68 13.99 13.21
X6 0.47 0.43 0.4275 3.62 3.2 3.33 5.81 5.24 5.54 8.67 8.12 8.32
0.53 0.28 3.35 3.15 5.65 5.46 8.5 7.99
12.8 13.192
X7 0.61 0.43 0.565 4.15 3.56 3.96 3 12.69 12.68 13.37 13.2 5
13.1
0.67 0.55 4.44 3.69 7 12.03 13.41 12.79
X8 0.53 0.4 0.4525 3.48 2.87 3.1175 7.01 6.63 6.875 8.59 8.11 8.1825
0.6 0.28 3.34 2.78 7.12 6.74 8.53 7.5
L 1963 1900 1738.5 219 214 213 56.5 55.6 54.625 25 24.4 24.875
1893 1198 212 207 53.5 52.9 25.1 25
Page 70 of 97
STANDARD LAMP:
Unit = Lux
Table 4.2 LUX READING OF STANDARD LAMP
0m 0.5m 1m 1.5m
max min avg max min avg max min avg max min avg
X1 1.84 1.74 1.73 9.3 9.11 9.1025 16.3 15.85 16.1625 18.5 18.1 18.42
1.87 1.47 9.34 8.66 16.4 16.1 19.18 17.9
18.267
X2 2.37 1.79 2.305 11.74 9.38 9.2475 20.7 20.1 19.95 18.89 18.59 5
2.72 2.34 8.26 7.61 20.1 18.9 18.47 17.12
13.487
X3 1.7 1.65 1.72 7.51 6.96 7.25 13.9 13.3 13.275 13.6 13.4 5
1.89 1.64 7.6 6.93 13.4 12.5 13.7 13.25
X4 4.57 4.3 4.2425 19.86 19.24 19.2575 27.6 26.5 27.175 23 21.8 22.475
4.18 3.92 19.33 18.6 28.1 26.5 22.9 22.2
X5 6.2 5.91 5.6425 18.26 17.6 17.855 22.1 21 20.85 17.5 17 17.25
5.45 5.01 18.24 17.32 20.9 19.4 17.8 16.7
X6 1.85 1.76 1.835 11.26 11.01 11.2575 12.4 12.2 12.14 15.7 15.4 15.42
1.99 1.74 11.82 10.94 12.26 11.7 15.92 14.66
X7 3.7 3.32 3.3075 20.2 20 19.475 23.4 23.1 22.625 18.82 18 18.155
3.17 3.04 19.5 18.2 22.3 21.7 18.9 16.9
X8 3.26 3.07 3.11 8.48 7.8 8.0875 16.9 16.6 16.5775 14.8 14.5 14.45
3.34 2.77 8.48 7.59 16.77 16.04 14.5 14
L 1634 1592 1513.5 316 313 316.25 74.1 73.1 73.125 38.2 37.3 38.25
1432 1396 320 316 72.9 72.4 38.9 38.6
Page 71 of 97
PERCENTAGE DIFFERENCE BETWEEN THE LUX OF DESIGNED
LAMP AND THE STANDARD LAMP:
Percentage difference=(standard lamp’s lux – designed lamp’s lux)*100/ standard lamp’s
lux
0m 0.5m 1m 1.5m
X1 72.10983 67.15188 56.64346 58.41477
The power consumption of Philips LED Lamp at ten different instants are given below
Page 72 of 97
Table 4.4 POWER CONSUMTION OF STANDARD LED LAMP
The following table shows the power consumption of designed lamp at ten different
instants (when all LEDs are on):
When three LEDs of designed lamp are on so the power consumption at ten different
instants are given in table format.
Page 73 of 97
Table 4.6 POWER CONSUMPTION OF DESIGNED LAMP HAVING 3 LEDs ON
12 of phi l ips
10
0
1 2 3 4 5 6 7 8 9 10
NO OF INSTANTS
From power consumption analysis we conclude that the power rating of designed bulb is 11
watt and when three LEDs are on, the power rating is half of the total power rating. The
power rating of Philips LED Lamp is 7 watt.
Page 74 of 97
i) The 3rd harmonic current should not exceed 86% of the fundamental harmonic
current.
ii) The 5th harmonic current should not exceed 61% of the fundamental harmonic
current.
The individual harmonic spectrums of both lamps at seven different instants are given
below:
Page 75 of 97
Figure 4.14 HARMONIC ANALYSIS OF STANDARD LAMP
Page 76 of 97
Figure 4.16 HARMONIC ANALYSIS OF STANDARD LAMP
Page 77 of 97
Figure 4.17 HARMONIC ANALYSIS OF STANDARD LAMP
Page 78 of 97
Figure 4.18 HARMONIC ANALYSIS OF STANDARD LAMP
Page 79 of 97
Figure 4.20 HARMONIC ANALYSIS OF DESIGNED LAMP
Page 80 of 97
Figure 4.21 HARMONIC ANALYSIS OF DESIGNED LAMP
Page 81 of 97
Figure 4.23 HARMONIC ANALYSIS OF DESIGNED LAMP
Page 82 of 97
Figure 4.24 HARMONIC ANALYSIS OF DESIGNED LAMP
Page 83 of 97
Figure 4.25 HARMONIC ANALYSIS OF DESIGNED LAMP
Page 84 of 97
Table 4.7 HARMONIC COMPARISON OF STANDARD AND DESIGNED LAMP [%]
TESTED HARMONIC[%]
FUNDAMENTAL 3rd 5th 7th THDI
LED
LAMP
PHILIPS 7 100 82.214 51.95 28.676 105.914
W
DESIGNED 100 102.257 90.222 76.884 173.4024
LAMP 11 W
From the above table and individual harmonic spectrum we conclude that in Philips led
lamp the 3rd harmonic is 82.21% of the fundamental and 5th harmonic is 51.95% of the
fundamental, Hence its satisfy the IEC standard Whereas in designed led lamp the 3rd
harmonic is 102.214% of the fundamental and 5th harmonic is 90.22% of the fundamental
so it is not satisfying the IEC standard. According to IEC standard the value of THDI is
approximately equal to 105%.The designed lamp have 173.40 value of THDI which exceed
the maximum limit, Hence the generated harmonics issued from designed LED lamp will
be reduced by adding the harmonic filter at the input of the LED lamp.
Page 85 of 97
CHAPTER5- CONCLUSION, FUTURE
RECOMMENDATIONS
5.1 CONCLUSION
Remote controlled LED lamps open a door to a new era of more efficient and energy saving
LED lighting systems. LED lamps have been proved to be very flexible in controlling
almost all the features of light and hence by combining them with the digital control
domain, their efficiency can be taken to new heights.
With the already developed sector of Power Line Communication, several operating
conditions of the LED lighting fixtures can be sensed and controlled like temperature and
current leading the LED lamps to operate at their maximum efficiency. This can lead to the
design of more energy saving LEDs.
With the use of microcontroller, it is possible to program the LED lighting system in
accordance with the natural cycle of domestic users as well as the industrial needs. This can
lead to considerable reduction in the energy consumption of the LED lighting systems.
By controlling the LEDs in two different ways i.e. via Bluetooth as well as Wi-Fi, makes
the wireless connection more reliable and gives more options to the users to make wireless
connection as per their convenience.
In conclusion, a new era of intelligent lighting systems is coming which will make our life
more comfortable and convenient and our project is a contribution towards it.
Page 86 of 97
5.2.1 ALUMINUM PCB
Since we have used 1 watt LEDS therefore, considerable amount of heat dissipation occurs.
The best solution to cool down the LEDs is the use of Aluminum Printed Circuited Board
(PCB) though we have used individual heat sinks for each LED which would compensate
the need of using Aluminum PCB but for better designs of the lamp we recommend the
circuit should be drawn on an Aluminum PCB.
It should be noted that Aluminum PCBs are not locally available in Pakistan and the nearest
port to make their shipment is China.
Please note that these heat sinks are not locally available in Pakistan.
Page 87 of 97
convert 220 volts AC to 5 volts DC with a current of 2 Ampere. We have used a standard
5volts, 2 Ampere power supply commonly available in the market.
A far better way to dim the LED lamps without affecting the power factor is dimming
through current controlling.
It is recommended to use the pulse width modulation (PWM) output of the Arduino
microcontroller for current controlled dimming.
Page 88 of 97
REFERENCES:
i) Digital LED Lighting Solution by A.W. Louw and C. Neethling.
ii) Design of a Transformerless High Power factor Low frequency LED driver
applied to street lights by Fernando J. Nogueira, Edmar S. Silva, Thales S.
Gomide, Mateus F. Braga and Henrique A. C. Braga.
iii) Intelligent LED Lighting System and Sensor Technology by Xiaobing
Cao,Daishun Zheng
iv) High Precision Indoor Positioning Using Lighting LED and Image Sensor by
Mohammad Shaifur Rahmant, Md. Mejbaul Haquet, Ki-Doo Kim
v) Harmonics and Thermal Characteristics of Low Wattage LED Lamps by Sohel
Uddin, Hussain Shareef, Azah Mohamed, Muhammad A Hannan.
Page 89 of 97