Introduction: DIY Handheld LED Lamp

About: An electronic hobbyist and a tech-savvy. Love to know and publish good electronic projects. I use some popular microcontrollers like raspberry pi, Arduino, linkit one, and also some basic ICs to make my projec…

A lamp holds great importance in one's life. They are the source of light and make thing visible to you. When light is emitted from a lamp, it travels in all direction and after striking from a surface it comes to our eyes and the object is visible to you. The discovery of electric lamp was made by Humphry Davy (an Englishman) in 1809. An electric lamp can be used in multiple ways. It can be used as a study lamp, a table lamp, light bulb (a kind of lamp ) or a emergency lamp. Previously lamps were made from electric bulbs and CFL but now a days lamps are being build by LED.

Led lamps have a lot of advantages. They are cheap, reliable, consume very less amount of energy, amount of light emitted is more than normal CFL lamps and many more. You can buy led lamps from the market but they are costly. So here presenting in front of you the handheld led lamp.

This lamp which we are going to build has a lot of specifications and it is the best in its class. This lamp can be controlled through a potensiometer and android app using Bluetooth. It contains four RGB led through which you can make different colors and have fun with it. You can measure the humidity and temperature of the surrounding through the lamp. It contains 36 ultra bright led which when illuminated give a lot of light. It is cheap, portable, easy to hold ,reliable . The battery life of the lamp depends upon the ampere of batteries used.

You can use it in emergency light in case of electricity shortage , while going out or while travelling, as a table lamp by simply making a stand for it , camping and as a source of white light while clicking photographs etc. Their are multiple uses of this lamp, the only thing is you have to hunt for them.

A video in action of the lamp is coming soon.........

NOTE: I have placed all my components in the box at last so that the people making this lamp can easily see the connections. I advice you to place the components step by step.

Step 1: Gather Parts

The parts required for this lamp are very basic. You all would be knowing about them. The parts are easily available online so you don't have to search a lot for them. I have given the links with the parts. Just tap on the part name and your browser will direct you to the online store. I advise you to do some Google (searching for them on Google) or search the parts at online stores like Ebay , Amazon etc so that you can get them as cheap as you can. I also advise you that before purchasing the parts online, check the price of the parts in your local electronic store so that wherever you get them cheaper, buy there. In online store you have to pay shipping charges for the things coated with less price which increases the price of that part. Here is the list:

PARTS:

TOOLS:

  • Soldering iron
  • Hot glue gun
  • Soldering wire
  • Soldering stand (for ease)
  • Helping hands (optional. I am not using them)
  • Wire stripper
  • A pair of scissors
  • A cardboard cutter

MISCELLANEOUS:

  • Cardboard for making the box or a medium size box
  • Adhesive
  • A white paper or 5 to 6 A4 size sheets
  • Paper tape or normal adhesive tape
  • A ruler
  • A marker pen or pencil
  • Double sided tape
  • A needle
  • A android smartphone

Step 2: Know About Parts

    There are a lot of instructables which only tell you how to make the project, parts required and the schematics.In the electronics stream, the people have a lot craving to know about each and every thing except in the case of people you are making it to make money. People who love to make DIY projects want to know about each and every part and how it works and what is the use of that part in that particular project. This step is about that only.I have tried to give sufficient information about the part. The information is not given in a very detailed manner but still I think it will help you a lot specially the new comers.

    Arduino:

    Arduino is an open-source physical computing platform based on a simple microcontroller board, and a development environment for writing software for the board. Arduino can be used to take inputs from the environment using sensor, sending outputs to various objects like LEDs , LCD display, relays and using it as PWM(Pulse Width Modulation) to control motors, LEDs etc. Here it is acting as the brain of the lamp. We are going to use PWM and analog inputs of the Arduino in this lamp. Choosing Arduino is not a tough process. If you already have one use that. If you are going to buy a new Arduino, buy Arduino nano as it is small in size and very easy to program. Arduino pro mini is also small but you will be needing a programmer to upload the sketch to it.

    BLUETOOTH MODULE:

    It is one of the important part of this lamp. Without this you can not control the LEDs(white LED can be controlled without this but RGB LED can't be controlled).The Bluetooth module used by me is HC-06. HC-05 is also compatible with this lamp and you don't need to make changes in the Arduino sketch but using HC-06 module is advised by me as it the upgraded version of HC-05 though both are similar but a little variation in working voltage of the modules.

    LM35 TEMPERATURE SENSOR:

    It is used to measure the temperature of the surrounding. The packaging of this sensor is same as of 3 lead transistors. It also contains 3 leads which are vcc,gnd and output. Be cautious while using it as it is a bit delicate and small in size so it can be lost easily.

    DHT11 HUMIDITY AND TEMPERATURE SENSOR:

    It can measure the humidity as well as the temperature of the surrounding. A question must be striking in your head that if the DHT11 module can measure temperature also then why we are using LM35. The answer to that is the DHT11 can also be used to measure temperature but the readings given by LM35 are much more accurate then DHT11. You can edit the program and make it to measure temperature through DHT11 sensor but there would be a little variation about +-2*C in the temperature.

    LCD:

    After measuring the temperature and humidity what we will do with that. Either we use it to switch on and off the lamp according to the variation in temperature and humidity or we display it to the user to let him know about the weather condition around him. For that you must have a screen or display. You can use Arduino Serial monitor for that but it will be difficult for anyone to carry the laptop where ever he go so the only left choice is using a display or LCD. Themarket is flooded with a lot of LCDs but the best choice is using a Arduino 16X2 LCD. This LCD has 16 columns and 2 rows to display the message and it is the most popular and easy to use LCD.

    LEDs:

    Their are basically two types of LEDs used here. One is single color white straw hat led and the other one is a RGB(Red ,Green and Blue ) LED. The straw hat LEDs are used here instead of normal round LEDs because they are better than than round LEDs. Round Leds have a tendency of focusing light on a particular area. They do not scatter light as much as straw hat LEDs do. You have to first diffuse the round LEDs by rubbing them on sandpaper so as to make the light scatter. Dome shaped led or straw hat led scatters the light a lot, making them perfect for the lamps. Though they are small yet they are very bright. Their little shape make them look more beautiful than normal round LEDs.

    The RGB leds are the mixture of three leds diffused together. They are good for making different colors by mixing the colors.Here we are using them as disco lights to have fun with our lamp. Buy a common cathode RGB led and try to get milky one. You have to diffuse the normal rgb led so as to make it milky and get the best results from it.

    TIP31c:

    TIP 31c is a standard type of NPN(negative-positive-negative) bipolar junction transistor. It is used with led board. The current rating of Arduino PWM is 40mA and current rating of one white led is 20mA. We are using 36 white leds in our led board therefor current rating of led board is 36x20 = 720mA. 720mA is much more greater than 40mA that's why to increase current given by Arduino board this transistor is used. When some voltage is supplied to this transistor, the output voltage is same but the current increases significantly.

    BATTERY:

    Choosing a perfect battery is the most important step. The ampere of the battery will tell you for how much time you lamp will emit light not the voltage. Voltage is also important. Choose a battery with voltage between 8V and 12V. The battery with voltage between this range is the most appropriate battery for this lamp as the 5V voltage regulator in Arduino works perfectly in this range. I have used two 4V 1.5Ah lead acid batteries because they are very cheap and don't need special chargers. Just connect the battery to your adapter and they will be charged. I have connected 2 batteries in series which gives me 4V 1.5Ah of current. You can also use lithium ion batteries but they will increase the total cost of the lamp.

    Step 3: Making the Battery Pack

    The power required to this lamp should be greater than 7v. Powering below this voltage will cause your Arduino's voltage regulator malfunction. So the best voltage to power your Arduino is between the range of 8v to 12v. Going beyond this range will cause your voltage regulator to heat up. I bought two 4v 1.5Ah lead acid batteries and connected them in series which gives 8v and 8v is enough for the voltage regulator to work.

    There are a lot of batteries available in the market like Li-Po , lithium ion, ni-cd , alkaline etc but they are a bit costly than these lead acid batteries and also requires special chargers to charge them which will surely increase the total cost of the lamp and we want to make the lamp as cheap as possible.I prefer using lead acid batteries as they are the cheapest available batteries in the market and they don't require special chargers like others.The advantage of using batteries like lithium ion is that they are very light weighted as compared to lead acid batteries which makes the lamp more handy and they can power the lamp for a longer period of time.

    To make the battery pack just connect both the batteries in series. Connecting them in series means that connect positive of the first battery to the negative of the other. Before soldering on the battery leads, chop a little part of it with wire stripper so that it becomes easier for you to solder wire on them. Stick both the batteries together using double sided tape and you are done. If you want to check the voltage, you can use a voltmeter or a multimeter and if the voltage is less than 8v, it means your batteries needs charging.

    After completing the above step, your first battery's negative will be the negative of the battery pack and positive of the second battery will be positive of the battery pack. You have to solder wire to them also. It is advised to solder the batteries quickly as overheating can cause problems.

    Step 4: Covering the PCB

    The part of your lamp visible to others will be the outer part of the box and , LCD, LED and the perfboard . Usually the perfboard is of brown color(I don't know about yours but mine is brown) which doesn't look decent. It looks very dull and spoils the beauty of your lamp. The solution to this is cover the upper part of the board with white paper or A4 size sheets using adhesive which is a thousand times better than that dull brown color. Take measurements of PCB board on the sheet and apply adhesive on that area. Apply adhesive on area 1 cm more than the actual size of the PCB. Don't apply a lot of adhesive because if you apply a lot of adhesive while sticking the paper it will come out from the holes of perfboard and they will be blocked after the adhesive gets dry.Don't start working on the perfboard just after you stick the sheet on it. Give adhesive ample of time to dry otherwise you will see cracks in the paper while inserting the component. Cover only one perfboard as the other one will be used inside the board and it would not be visible.

    Step 5: Make a Shield for Arduino

    For Arduino projects, it is a good idea to use a shield. This helps when you want to make changes to the code or want to make another DIY project with it.Just plug it off and use it. By chance you have made any wrong connection, you can easily correct it in shield. Buying shield from market would be a little costly so why not make your own shield. Making a shield is not a though process but it requires a little skill in soldering. Those who are using Arduino uno or mega can skip this step but then they have to used female to male jump cables for the lamp

    Take the perfboard which you have not covered with paper. Cut a small piece from it and solder some female headers to it so that your Arduino can easily fit to it. You can measure the number of header used by counting the number of pin of your Arduino. Now solder some male headers to the corresponding pin of Arduino. Connect each male header to its corresponding pin and don't forget to solder some extra headers for the ground and 5v which would be used to give power to the modules of the lamp. You can solder only that number of male headers as are required by the modules like 8 headers are required by the LCD so solder 8 headers together, 3 headers are required by the LM35 temperature sensor so solder 3 headers together and so on. Making shield by this method will prevent you from wasting headers.

    Step 6: Adding Potensiometer or Pot

    You must be having two 10K preset or pot. Take one of them as we would be using it to control the intensity of white light when we are not controlling the lamp from the mobile. I am not sure about your but my pot has a very long rotatory stick which is used to control the resistance. Such a long controlling stick will surely make your lamp inconvenient to use that's why I suggest you to cut the excess stick and then place the nob on it. Make sure you cut the stick parallel to the base otherwise the knob will be a little tilted.

    After cutting the excess stick, you have to connect the pot to Arduino. For connecting it to the Arduino follow the steps given below:

    1. The first pin of the pot will go to 5v on the Arduino shield.

    2. The middle pin of pot will go to analog pin 0 (A0) .

    3. The last pin will go to ground.

    That's sit. You are done with connecting the pot. To check your pot, upload the code given below and open the serial monitor. You would be able to see the values between 0 to 255 on the serial monitor

    //Made by Dushyanta for DIY HANDHELD LED LAMP
    //Sketch to check the pot

    int potPin=A0;

    int value=0;

    void setup()

    {

    Serial.begin(9600);

    Serial.println("START");

    }

    void loop()

    {

    value = analogRead(potPin);

    value = map(value, 0, 1023, 0, 255);

    Serial.println(value);

    delay(500);

    }

    Step 7: Hook Up the White LED

    Intensity of light depends upon the LED chosen. You would be thinking that why you should use a straw hat LED over a normal white LED. The reason is that in a normal white LED, the is a lens present which focus the light over a specific area but in a straw hat led lacks lens due to which the light is dispersed in all directions which increases the quality of lamp as we have to make a lamp which scatter light in all directions not like a flashlight which is used to focus over a specific area . Another thing is that output voltage of Arduino is 5v but white leds work on 3.6v therefor a current limiting resistors must be used and then the question comes how to choose a right resistor for the led . It is very simple and can be calculated using a mathematical formula:

    Value of resistor(in ohms) = (supply voltage - source voltage) / current required by each led (in amps)

    = ( 5 - 3.6 ) / 0.02 (1 amp = 1000 miliamps, therefor 20 miliapms = 0.02 amps)= 1.4 / 0.02


    = 70 ohms

    Since 70 ohms is not a standard value so either use a 68 ohms resistors or 82 ohms. I easily got forty 68 ohms resistor in less than $1. I have given a layout of the leds which you can find in the images attached above.

    After covering the paper on the upper part of the perfboard you would not be able to see the holes of the perfboard. A simple hack to it is that hold the perfboard near a light source and a try to look towards the light through the perfboard. You would easily be able to see the holes and then make holes on paper using a needle (for better understanding refer to above images).Try to remove the distance between the led and the resistors so as to make the lamp more compact. Don't solder the led to close, it may cause problems afterward. Leave some space between the white leds for RGB led. Make sure that the led are at equidistance.

    NOTE: Be careful while connecting the leds. You may connect them in series by mistake. Connect them parallel only.

    Step 8: Hook Up the White LED (part 2)

    After you are done with soldering of leds, connect all the rows in parallel i.e. connect positive of all rows together and negative of all rows together. Then solder a wire to the positive of any one of the rows which will be the positive of the led board and another wire to the negative of any one of the row which will be the negative of the led board. After connecting all the resistors, you would be left with one 68 ohms resistor. This resistor will be used while connecting the RGB led to the led board.

    Now take a small piece of perfboard from uncovered . Solder TIP31c on that piece and connect it to your Arduino using the circuit diagram given above or as follow:

    • pin 1 ----- Arduino pin 11
    • pin 2 ----- Led board negative(cathode)
    • pin 3 ----- Arduino gnd

    Connect the positive of the led board to Arduino pin 11 . To check the led board upload the following code to your Arduino and control the led board using the pot. Those who want to control the LED from pot only can end up here and go directly to make the box.

    //Made by Dushyanta for DIY HANDHELD LED LAMP
    //Sketch to check led board using the pot

    int potPin=A0;

    int ledboard=11;

    int value=0;

    void setup()

    {

    Serial.begin(9600);

    Serial.println("START");

    }

    void loop()

    {

    value = analogRead(potPin);

    value = map(value, 0, 1023, 0, 255);

    analogWrite(ledboard,value);

    delay(100);

    }

    Step 9: Hook Up the RBG Led

    You must have left some space between the white leds as told earlier my me. Place the RGB leds in those gaps. I have not left any space for RGB led as my white leds are at enough distance so as to accommodate RGB led in between. Use only four leds as four are enough and will give ample of light. After placing and soldering the RGB leds on the led board, connect the similar pins of the leds together. If you want to check the leds and want to see which lead belongs to which color use a 3v cell. Below the last row of the white led solder the 3 resistors (200 ohms, 100 ohms, 68 ohms). The 200 ohms resistor will be connected to the lead corresponding to red color, 100 ohms resistor to the lead corresponding to green color and 68 ohms resistor to the lead corresponding to blue color.Below are the connections of the RGB led:

    NOTE: RGB leds are not directly connected to the Arduino. The second lead of resistor connected to that color of LED is connected.

    • Red color(200 ohs resistor) ----- Arduino pin 10
    • Green color(100 ohms resistor) ----- Arduino pin 9
    • Blue color(68 ohms resistor) -----Arduino pin 6

    Step 10: Cut Off the Excess Pcb

    After soldering all the led, their must be some amount of perfboard left. Cut it off as it is not useful and will only increase the size of the lamp. You can use a scissor for cutting the perfboard. Be careful while cutting the PCB . Don't throw it. You can use it afterwards.

    Step 11: Making the Box

    Many people don't give importance to this step. They don't pay much heed to the strength and rigidity of the box. It is well said that first impression is the last impression therefor look of the box should be fascinating enough to attract others.

    To make the box, use cardboard or a hardboard which is a better option. First take the measurement of the led board and cut a piece of cardboard of that size which will be the back of the lamp. Cut two piece of cardboard whose length should be equal to the length of led board and another two pieces of card board whose width should be equal to the width of the led board. The width of first two pieces of cardboard and the length of other two pieces of cardboard should be same. Apply some adhesive on the edges of cardboard pieces and stick them together so that a box is formed whose front side is open and there we will place our led board later on. Stick the edges of the box using paper tape.

    Cut some pieces from A4 size sheets of measurement equal to that of the box and stick them on the box. Sticking the paper on the box will help you in coloring the box afterward.

    Step 12: Making Holes in the Box

    After the adhesive gets dry, make holes in it for the parts. There is no need to remove the tape. We have to make a lot of holes for which you can use a scissor or a cardboard cutter. In some cases you just have to make holes for the leads. In those cases if have written needle in front of part name and use a needle to make holes. You have to make holes for the following parts:

    • LCD
    • on/off switch
    • Potensiometer or pot
    • LM35 temperature sensor (needle)
    • DHT11 humidity sensor
    • Push button (needle)

    Measure the dimensions of the parts and mark them on the box using marker pen and ruler. Make holes using cardboard cutter and scissors.

    Step 13: Finishing the Box

    The only step left is coloring the box. Choose some bright colors and color the box properly. You can color your box from colors or make it look like a rainbow. You can also use aluminium foil on the outer side of the box to decorate it. You can apply black tape on the edges. My painting skills are very bad that's why my box in not looking too good.

    Step 14: Connecting the LCD

    Here the use of LCD is to display temperature and humidity as well as the the mode of the lamp i.e. whether the lamp is working through app or through potensiometer. The Arduino LCD is one of the simplest LCDs compatible with Arduino. Its connections are also very simple. It is a 16X2 LCD which means that it has 16 rows and 8 column. The second 10K pot is used here. Cut of its rotatory stick also. If you want to control the LCD light then connect pin 16 of LCD to Arduino gnd through a on/off switch. Here are the connections of the LCD:

    NOTE: Here LCD is connected differently from the normal connections.

    • pin 1 ----- Arduino gnd and 10K pot pin 1
    • pin 2 ----- Arduino 5v and 10K pot pin3
    • pin 3 ----- 10K pot pin2
    • pin 4 ----- Arduino pin 12
    • pin 5 ----- Arduino gnd
    • pin 6 ----- Arduino analog pin 2 (A2)
    • pin 11 ----- Arduino pin 5
    • pin 12 ----- Arduino pin 4
    • pin 13 ----- Arduino pin 3
    • pin 14 ----- Arduino pin 2
    • pin 15 ----- Arduino 5v
    • pin 16 ----- Arduino gnd

    After you have connected the LCD place it in the box. Mount the pot also. For checking the display , upload the code given below to your Arduino. It should display "Hello World" with a timer after uploading. If nothing is displayed on the LCD or it displays black boxes, try to set your pot and check your connections.

    #include <LiquidCrystal.h>

    LiquidCrystal lcd(12, 16, 5, 4, 3, 2);

    void setup()

    {

    lcd.begin(16, 2);

    lcd.print("Hello, World!");

    }

    void loop()

    {

    lcd.setCursor(0, 1);

    lcd.print(millis()/1000);

    }

    Step 15: Connect LM35 Temperature Sensor

    To measure the temperature of the surrounding, LM35 temperature sensor is used here. We are using LM35 as the temperature sensor not DHT11 as the accuracy of measuring temperature in LM35 is more than that of DHT11. It is the cheapest available temperature sensor in market and also small in size therefor it will not affect the cost of making lamp and the space occupied. Before connecting it to Arduino. place it in the box. Place it in such a way that the upper portion of the sensor is outside the box and the leads are inside the box. Bend the leads of the sensor to make it stable until we hot glue it. The pin configuration of LM35 is given above in the images and here are its connections:

    • pin 1(vcc) ----- Arduino 5v
    • pin 2(Vout) -----Arduino analog pin 1 (A1)
    • pin 3(gnd) ----- Arduino gnd

    Upload the code given below to check your sensor.

    //Made by Dushyanta

    //Sketch for checking your LM35

    float temp;
    int tempPin = 0;

    void setup()

    {

    Serial.begin(9600);

    }

    void loop()

    {

    temp = analogRead(tempPin);

    temp = temp * 0.48828125;

    Serial.print("TEMPERATURE = ");

    Serial.print(temp);

    Serial.print("*C");

    Serial.println();

    delay(1000);

    }

    Step 16: Connect the DHT11 Humidity Sensor

    You may be familiar about the DHT range of humidity and temperature sensor. The good thing about them is that they are too cheap and very easy to use. They are easily available in market as well online stores. Their is a wide range of DHT sensors like DHT11, DHT 21 , DHT22 etc. Here we are using a DHT11 sensor only to measure humidity as temperature is being measured by LM35. You can skip the step of connecting LM35 and can use DHT11 sensor with a little change in the code. You need to download a library to make your Arduino talk with your computer. The library zip is attached with the step. Download it and extract it in your Arduino library folder. Place the sensor in the box before connecting and bend its leads also. Connect your sensor as per the instructions given below( pin configuration of the DHT11 sensor is given above in the images) . Upload the code given below to check your sensor:

    • pin 1 (vcc) ----- Arduino 5v
    • pin 2 (gnd) ----- Arduino digital pin 8
    • pin 3 (Nc) ----- Not connected
    • pin 4 (gnd) ----- Arduio gnd

    #include <dht11.h>

    dht11 DHT11;

    void setup()

    {

    DHT11.attach(8);

    Serial.begin(9600);

    Serial.println("DHT11 TEST PROGRAM ");

    Serial.print("LIBRARY VERSION: ");

    Serial.println(DHT11LIB_VERSION);

    }

    void loop()

    {

    Serial.println("\n");

    int chk = DHT11.read();

    Serial.print("Read sensor: ");

    switch (chk)

    {

    case 0: Serial.println("OK"); break;

    case -1: Serial.println("Checksum error"); break;

    case -2: Serial.println("Time out error"); break;

    default: Serial.println("Unknown error"); break;

    }

    Serial.print("Humidity (%): ");

    Serial.println((float)DHT11.humidity, DEC);

    delay(2000);

    }

    Step 17: Connecting the Buttons

    To switch on/off our Arduino, we would be adding a on/off button. You can use a simple on/off button or a toggle switch or a slide switch. Connections are very simple. Connect one lead of the button to the positive of the battery pack and other lead to Vin of Arduino. Connect the negative of the battery pack to gnd on the Arduino board. Now by pressing the button, you can on/off your lamp.

    To choose the mode of lamp, we would be using a button switch. Connection are a bit simple. First place the button in the box as done in case of LM35(Upper part should be outside the box and lead inside the box). Connect the button according to the steps given below or refer to the circuit in the images above.

    1. Pin 1 ----- Arduino 5v
    2. Pin 2 ----- Arduino digital pin 7
    3. Pin 2 through a 10K resistor ----- Arduino gnd

    Upload the code given below to check your push button. When the button is pressed, pressed will get printed on the serial monitor and when it is unpressed, unpressed will be printed.

    int button=7;
    void setup()

    {

    pinMode(button,INPUT);

    Serial.begin(9600);

    }

    void loop()

    {

    if (digitalRead(button)==HIGH)

    {

    Serial.println("PRESSED");

    }

    else if (digitalRead(button)==LOW)

    {

    Serial.println("UNPRESSED");

    }

    delay(500);

    }

    Step 18: Connect the Bluetooth Module

    Here comes the most important step of the lamp. To control your RGB led and white led, you would be needing a Bluetooth module. It also give you wireless connectivity so you can also hang or place your lamp where you can not reach easily and control it without wires. They are very cheap and easy to use. You can purchase them for about $5 at ebay, amazon etc. Here HC06 Bluetooth module is used but you can choose others versions also like jy-mcu, HC05 . All are same and have same working range i.e. about 10m - 15m.

    Though this step is very important, it came at last because Bluetooth module is connected to the Rx and Tx of the Arduino. While checking the various modules, each and every time you have to take Bluetooth module and then again plug it after uploading the code which becomes very inconvenient. Here are the connections for the Bluetooth module(HC05 users are advised to connect their module according to the circuit diagram given in the images above):

    • Vcc ----- Arduino 3.3v or 5v
    • Gnd ----- Arduino gnd
    • Tx ----- Arduino Rx
    • Rx ----- Arduino Tx

    Step 19: Upload the CODE

    Before uploading the code, remove either Arduino from the shield or Bluetooth module Rx and Tx. Copy the code given below and paste it in your Arduino ide. I have commented in front of lines so that beginners can understand the code easily. Here the code:

    #include <LiquidCrystal.h>//Adding all the libraries

    #include <dht11.h>

    #define START_CMD_CHAR '*'

    #define CMD_ANALOGWRITE 11

    #define MAX_COMMAND 20 // max command number code. used for error checking.

    #define MIN_COMMAND 10 // minimum command number code. used for error checking.

    #define MAX_ANALOGWRITE 255

    #define PIN_HIGH 3

    #define PIN_LOW 2

    int button=7; // defining the pin number and value

    inttempPin= A1;

    float temp;

    int state=0;

    intpotPin= A0;

    int value=0;

    dht11 DHT11;

    LiquidCrystallcd(12, 16, 5, 4, 3 ,2);

    String inText;

    void setup() {

    DHT11.attach(8); // telling Arduino that to which pin DHT11 sensor is attached

    pinMode(button,INPUT);

    lcd.begin(16,2);

    Serial.begin(9600);

    Serial.flush();

    lcd.print("Arduino LED lamp"); // printing the Startup message

    delay(2000);

    lcd.clear();

    lcd.print("CONTROL:"); // Telling which mode is used to control the led board

    lcd.setCursor(0,1);

    lcd.print("Potensiometer");

    delay(2000);

    lcd.clear();

    }

    void loop()

    {

    lcd.clear();

    lcd.print("INSTRUCTABLES");

    delay(50);

    if (digitalRead(button)==HIGH && state==0) // Changing the mode by the instructions given by the user

    {

    state++;

    lcd.print("CONTROL:");

    lcd.setCursor(0,1);

    lcd.print("App");

    delay(2000);

    lcd.clear();

    }

    else if(digitalRead(button)==HIGH && state==1)

    {

    state++;

    lcd.print("CONTROL:");

    lcd.setCursor(0,1);

    lcd.print("Potensiometer");

    delay(2000);

    lcd.clear();

    }

    else if(digitalRead(button)==HIGH && state==2)

    {

    state=state-2;

    intchk = DHT11.read();

    temp = analogRead(tempPin); // receiving the output voltage from the temperature sensor

    temp = temp * 0.48828125; // converting the output voltage into temperature in degree celcius

    lcd.print("Temp: ");

    lcd.print(temp);

    lcd.print("*C");

    lcd.setCursor(0,1);

    lcd.print("Humi:");

    lcd.print((int)DHT11.humidity,DEC);

    lcd.print("%");

    delay(4000);

    lcd.clear();

    }

    if (state==1) // Code for controlloing led board from app

    {

    Serial.flush();

    intard_command = 0;

    intpin_num = 0;

    intpin_value = 0;

    charget_char = ' ';

    get_char = Serial.read();

    if (get_char != START_CMD_CHAR) return;

    ard_command = Serial.parseInt();

    pin_num = Serial.parseInt();

    pin_value = Serial.parseInt();

    if (ard_command == CMD_ANALOGWRITE) {

    analogWrite(pin_num, pin_value );

    }

    }

    else if (state==0) // Code for controlling app from Potensiometer

    {

    value = analogRead(potPin);

    value = map(value ,0 , 1023, 0, 255);

    analogWrite(11,value);

    }

    }

    Step 20: Hot Glue Everything

    After connecting all the things together and uploading the code to Arduino, hot glue everything so that they get don't displaced from their original position. Hot glue the edges of the box from inside and apply some glue at the edges where led board and the box are attached. Give some time to glue to get dry and till then proceed to next step.

    Step 21: Download the App

    The white led of the lamp can be controlled from the pot but RGB led can only be controlled by the android app. I found a lot of apps which allowed me to control RGB led from Bluetooth but those app didn't provide the option to control fourth led. Then I found a app named ArduDroid which solved my problem. From this app, you can control the PWM of Arduino as well as digital outputs and can use it as a serial monitor. Using the app is bit simple. To install it on your Android device go to Google play store and search for Ardudroid(I am sorry IOS users. I didn't found any app like this for you). Install the first app created by Hazim Bitar. After installing open it and it will ask you to turn on the Bluetooth if it is not on already. Tap on allow. Then click on then option button of your android phone. Choose the first option which is "Connect me to a Bluetooth device". A pop up window will appear. There you will find a button named "Scan for devices". Tap on that button and search for your Bluetooth module(usually Bluetooth module nae is its model name like HC06 etc). Tap on your module name and connect it. If it ask for pair code type 1234 which is the default code. Now your Phone is connected to your Arduino.

    Step 22: Checking

    After your phone is connected choose the mode of your lamp. The default mode is pot mode. By pressing the push buttons you can change the mode. In pot ,mode you only have to rotate the knob to change the intensity of light. You can't control RGB led in pot mode.

    In app mode, the white light is controlled through Analogwrite pin 11 , red color from pin 10, green from pin 9 and blue from pin 6. You can change the intensity of light by sliding the bars given in front of pin numbers. For better understanding watch the video which I would be uploading recently.

    Step 23: Done!!

    Now your Handheld LED lamp is completed and go play with it. Use it as a emergency light or to have fun. Try to mix and make different colors from the RGB leds with your friend. You can compete with them for making maximum numbers of colors. You can use this while going outside on a trip.

    Thank you everyone for being with me for such a long period. I would be glad I you post your comments and pictures. If you have any query regarding the lamp or any step feel free to ask. Your suggestions are welcomed with an open heart. If I have made mistake in any of the step or written something wrong please tell me so that I can recover from that thing. Thank you for being with me.

    Vote for me in the contest If you like It.

    Phone Contest

    Participated in the
    Phone Contest

    Soldering Challenge

    Participated in the
    Soldering Challenge

    Outside Contest

    Participated in the
    Outside Contest