I was thinking the other day about switching the fluorescent lamps at my home to multi-colored smart LED light bulbs, that i can control from my smart phone.

Unfortunately it turned out to be a bit pricey for my taste, but the good news is it gave me another idea for an instructable so let's give it a shot.

Step 1: What We Need to Begin

A- Hardware

  1. An Arduino board (i am using an Arduino Uno here)
  2. 1sheeld which is a platform that enables us to use any of the smart phone's sensors as an Arduino shield in this case we will only use the touch screen gamepad
  3. Breadboard
  4. Common Anode RGB LED
  5. 3 X 270 ohm Resistors (Red-Violet-Brown)
  6. Jumper wires
  7. Smart phone (Android/iOS)

PS: the preferred resistor values might change with the RGB LED

B- Software
1- The Arduino IDE which you can download here

2- Get the 1sheeld Arduino library and the phone app here

PS: make sure to go through the 1sheeld intro tutorial here and how to use 1sheeld with different Arduino boards here (i will be using Arduino UNO for the rest of the tutorial)

Step 2: Wiring and Setup

  • Place your RGB LED in the Breadboard
  • Connect the Anode (the longest pin) to the 5V pin
  • Connect the other three pins to a 270 ohm resistor as shown in the schematic.
  • Connect the Resistors to the 1sheeld as stated below and in the schematic.

Green ===> pin 6

Blue ===> pin 10

Red ===> pin 11

Step 3: Software

Note: Before attempting to Upload the code make sure the 1sheeld is in uploading mode

//The code below attempts to change the color of an RBG LED using through an interactive interface on your smart phone using 1sheeld
// if you need help or want to contact me regarding the project you can do that at :adham.negm@ieee.org

int greenPin = 6;

int bluePin = 10;

int redPin = 11;

int red_intensity=0;

int blue_intensity=0;

int green_intensity=0;

//uncomment this line if using a Common Anode LED and comment it if you're using a Commone Cathode





/* Include 1Sheeld library. */


void setup() { OneSheeld.begin();

//Define the led pins as outputs

pinMode(redPin, OUTPUT);

pinMode(greenPin, OUTPUT);

pinMode(bluePin, OUTPUT); }

void loop() {

//you can try the pre-set colors or you can interact with them using 1sheeld

/* setColor(255, 0, 0);

// red


setColor(0, 255, 0);

// green


setColor(0, 0, 255);

// blue


setColor(255, 255, 0);

// yellow


setColor(80, 0, 80);

// purple


setColor(0, 255, 255);

// aqua


//if a color is pressed check if Up is pressed of Down

//if UP then increase intensity for that color if Down the decrease intensity for that color

if (GamePad.isUpPressed()&&GamePad.isRedPressed()&&(red_intensity<=255))

{ red_intensity=red_intensity+20; }

if (GamePad.isDownPressed()&&GamePad.isRedPressed()&&(red_intensity>=0)) { red_intensity=red_intensity-20; }

if (GamePad.isUpPressed()&&GamePad.isBluePressed()&&(blue_intensity<=255)) { blue_intensity=blue_intensity+20; }

if (GamePad.isDownPressed()&&GamePad.isBluePressed()&&(blue_intensity>=0)) { blue_intensity=blue_intensity-20; }

if (GamePad.isUpPressed()&&GamePad.isGreenPressed()&&(green_intensity<=255)) { green_intensity=green_intensity+20; }

if (GamePad.isDownPressed()&&GamePad.isGreenPressed()&&(green_intensity>=0)) { green_intensity=green_intensity-20; }

//make sure intensity value remains between 0 and 255

red_intensity = constrain(red_intensity, 0, 255);

green_intensity = constrain(green_intensity, 0, 255);

blue_intensity = constrain(blue_intensity, 0, 255);

//print intensity values for debugging purposes




setColor(red_intensity, green_intensity, blue_intensity); }

void setColor(int red, int green, int blue) {


red = 255 - red;

green = 255 - green;

blue = 255 - blue;


analogWrite(redPin, red);

analogWrite(greenPin, green);

analogWrite(bluePin, blue); }

Step 4: Turn on the Lights !

In order to do that we need to do the following

  • Make sure the 1sheeld is in operating mode
  • Open your 1sheeld app and connect your phone to your 1sheeld board
    (check 1sheeld tutorial here if you haven't already)
  • Select the Gamepad shield from the shield list
  • Now for the final act hold down 1 of the three colored circles (Red/Green/Blue) and press Up or Down to increase/decrease that colors intensity.
  • Have fun experimenting and mixing colors.

About This Instructable




More by AdhamN:Control an RGB LED Using Your Smart Phone Unlock your door with a hand gesture 
Add instructable to: