Arduino Lantern Light




Introduction: Arduino Lantern Light

I thought it would be fun to build one of those RGB based lights for the room.  'Mood lighting' with Arduino. That is an interesting and fun way to learn Arduino.  Now remember, these are RGB LEDS. There is RED, BLUE and GREEN inside each bulb! I am controlling them ( aka color mixing them ) with the 3 knobs. One controls the RED brightness, one the GREEN and one the BLUE.  I use 3 LEDS to get a brighter output. All the REDS dim and Brighten together with a turn of the knob. Same for Green and Blue. Got the idea? Here we go!

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Breadboarding

The first step was to setup just the RGB's on a breadboard and connect it to the Arduino Uno. I don't have a pic of that breadboard. Sorry.  Then I changed out the 10k ohm bread board mount pots for real knobs for the final build. I bought a circuit board and cut it small with snips and soldered up the RGB's and the resistors. It took me 2 or 3 times to get the layout correct and no shorts but that's the patience aspect of building. It takes practice! Also a Breadboard takes up space, wires tend to fall out etc.   There is a Fritzing drawing of the breadboard showing just  the LED wiring. Basically the RED leads connect together, the GREEN leads connect together and the BLUE leads connect together. Each color connects to a seperate Arduino PIN as an output.  The GROUND of each of the 3 LEDS need to be connected to a resistor and then to GROUND individually! not tied together. Check the diag.  I found code I could use at and then tripled the code to control each of the 3 colors. I will post that later.

Step 2: Adding the LCD

Using the standard 16x2 LCD and the LCDCrystal library straight off the Arduino site, I wired up the LCD to a copper piece after testing it on a breadboard.  The whold thing worked :) I can mix colors. Red, Orange, Blue, Teal, Purple etc. Awesome!
If you look at the diagram of the standard wiring of the LCD, there are two add'l wires needed for the LCD's back light.
On the LCD tha last two pins, 15 and 16 are marked A and K.  15 or A is 5v and 16 or K is ground. Wire those in and your back light will work.

Step 3: Knobs and Wipers

Ok,Potentiometers have 3 tabs. Use one of the outside tabs for 5volts. us the SAME tab for each of the 3 knobs. Use the other Outside tab for GROUND. , The middle is the wiper.  when you wire the potentiometers, you can connect all the 5v tabs to the 5v rail and the other GROUND tabs together to the ground rail.  Now each of the 3 middle pot tabs DO NOT CONNECT TOGETHER. They will connect to a unique pin on the arduino. thats what will adjust the voltage for that particular color. Now you may have to flip the 5v and Ground wires to get the knob to turn the way you want to dim or brighten the lights.  I like clockwise to brighten, counter clockwise to dim.

Step 4: Lets Cram This Together!

Cutting and hot gluing this all together. Many pics
BTW all the wires going to the Arduino Uno were hot glued to keep them from falling out.

Step 5: Code

// code derived from
int RpotPin = 0;    // Analog input pin that the Red potentiometer is attached to
int RpotValue = 0;  // value read from the pot
int GpotPin = 1;    // Analog input pin that the Green potentiometer is attached to
int GpotValue = 0;  // value read from the pot
int BpotPin = 2;    // Analog input pin that the Blue potentiometer is attached to
int BpotValue = 0;  // value read from the pot
int Rled = 9;       // PWM pin that the Red LED is on.
int Gled = 10;      // PWM pin that the Green LED is on.
int Bled = 11;      // PWM pin that the Blue LED is on.

   The circuit:
* LCD RS pin to digital pin 13
* LCD Enable pin to digital pin 12
* LCD D4 pin to digital pin 5
* LCD D5 pin to digital pin 4
* LCD D6 pin to digital pin 3
* LCD D7 pin to digital pin 2
* LCD R/W pin to ground
* 10K resistor:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(13, 12, 5, 4, 3, 2);

void setup() {
  // declare the Red,Green and Blue led pins as an outputs:
  pinMode(Rled, OUTPUT);
  pinMode(Gled, OUTPUT);
  pinMode(Bled, OUTPUT);

  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("Red  Green  Blue");

void loop() {
  RpotValue = analogRead(RpotPin); // read the pot value
  analogWrite(Rled, RpotValue/4);  // PWM the Red LED with the pot value (divided by 4 to fit in a byte)
  delay(10);                       // wait 10 milliseconds before the next loop
  GpotValue = analogRead(GpotPin); // read the pot value
  analogWrite(Gled, GpotValue/4);  // PWM the Green LED with the pot value (divided by 4 to fit in a byte)
  delay(10);                       // wait 10 milliseconds before the next loop
  BpotValue = analogRead(BpotPin); // read the pot value
  analogWrite(Bled, BpotValue/4);  // PWM the Blue LED with the pot value (divided by 4 to fit in a byte)
  delay(10);                       // wait 10 milliseconds before the next loop

  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  lcd.setCursor(6, 1);
  lcd.setCursor(12, 1);

Step 6: So I Think I Covered Everything..

So the parts list is an Arduino Uno $20
An 16x2 LCD Hitachi HD44780 type  $5
3 - 10k Potentiometers with knobs$6 each - $18
3 RGB LEDS with resistors. Prob $3
Lantern flashlight $10 and got an extra 6v batt with it :)
copper breadboard $6 [used half so $3]
misc wire, solder, breadboard 10k pot $7
2 9v batt $6
Priceless  fun :)

Microcontroller Contest

Participated in the
Microcontroller Contest

Be the First to Share


    • Backyard Contest

      Backyard Contest
    • Silly Hats Speed Challenge

      Silly Hats Speed Challenge
    • Arduino Contest 2020

      Arduino Contest 2020

    10 Discussions


    6 years ago

    Awesome instructable. I like the idea of being able to adjust the colors however you want. Can you get me a list of parts? Most of them I probably have, but I need to make sure.


    6 years ago on Introduction

    Nice instructable! I could see this spawning other projects using the same concept for simple RGB projects. Here's an idea; Add a button for a "random" mode where the Arduino ignores the pots and instead cycles the colors individually, but at different rates, so the resulting color would be all over the spectrum.


    Reply 6 years ago on Introduction

    one way I'm thinking is to when all colors are on maximum, then just fire a function to do what you said. great idea! it can also be done with a switch but you could fool friends with this easter egg. also have the screen blank ;)


    6 years ago on Introduction

    Thanks everyone. Here is a parts list as best I can.
    The lantern is a typical one. You can choose your own.
    the resistors for the LEDS are 200 ohm red-black-black-black-brown.
    The LEDS are from Amazon "Amico 50 Pcs 5mm Round Head Common Cathode RGB Light LED Emitting Diodes" Under $10. no resistors included. I had them from somewhere[??]. The pots and knobs are from Amazon: "10K Ohm potentiometer potential+black control Knob "about $7 each [ouch!]. The LCD is from Ebay, for about $5 "16x2 HD44780 Character LCD Display Module LCM blue blacklight "
    So It's a few bucks to put this together but that's part of it :)
    Let me know if I can be of any help.


    6 years ago on Introduction

    Nice. Suggestion: instead of 9V batteries, use 3 AA batteries in series. The UNO will work fine with 4.5V and the AA's will last a lot longer and be cheaper than the 9V. You may want to feed the 4.5 directly to the 5V pin, not to Vin to avoid the voltage drop in the regulator or diode.


    6 years ago on Step 4

    Just repaired a connector that fell out. need a new hot glue gun :)


    6 years ago

    How did you power the uno?


    Reply 6 years ago on Introduction

    You can use the standard Uno 9v battery with the barrel connector. I put 2 9v batteries together in parallel to get more hours of light.