Introduction: Bluetooth Controlled Sofa Lights

If you have a get-together party this weekend and want to fetch the attention of the visitors towards your new sofa or simply want to give your old sofa a new look then you definitely need this sofa light. You can buy similar lights from market but those lights come with a heavy price tag and the remote controller that you get with them is generally lost within an week or so. These sofa lights are smartphone controlled, so it's pretty easy to operate them and the process of loosing the remote controller is also gone.

Coming to the project, this sofa light is made with a RGB LED strip, some intense circuitry and a mobile app. The app gets installed on your mobile phone and the Bluetooth of your mobile phone is connected to the Bluetooth module present on the circuit board of these light. In the app you will find a circle full of colors at the center, with which you can control the color and brightness of the LED strip.

If you don't want to use the mobile app, you can control the LED strip by the three potentiometers, present on the circuit board of these lights. If you get bored with this simple color changing strip, then you can convert it into a disco light by simply connecting your smartphone and speaker system to the 3.5mm audio jack present of the circuit board ( for a more vivid explanation on working of this project, move to step 10).

Coming to circuitry, this project consists of a Arduino nano board which acts as the brain of this device. It is used here to receive signals from various things like Bluetooth module, potensiometer, audio jack and to analyze them and take necessary actions according to the data received. The Bluetooth module is used here to receive the data coming from the smartphone and potensiometer is used to control the LED strip when the device is not connect to the smartphone. The audio jack present is used to split the music signal coming from smartphone between your speaker system and Arduino.

I have been using these sofa lights from two weeks and have not faced any major problem. The only problem that I faced was that, the bluetooth connection of my phone and the lights always broke up, when I changed my room. This thing happens due to the low range of bluetooth connectivity of my phone. But that did not cause me any trouble. The light used to stay lit up on the color on which I left them and if I wanted to change their color, I simply connected my phone again and did the necessary arrangements.

Here is a video on making of this project. Don't forget to give it a thumbs up and also subscribe to my YouTube channel.

Step 1: Gather Parts

Very basic tools and parts are used in this project which you can easily get in old circuits or from you local electronic store. Here is the list:

PARTS:

  • Arduino nano or pro-mini
  • Common Anode RGB LED strip
  • TIP31C X 3
  • Bluetooth module(HC-05/HC-06)
  • 10K Potensiometer X 3
  • Push buttons
  • Red and green LED
  • 1K and 10K ohms resistors
  • Female Audio jack X 2
  • Power jack
  • 12V adapter
  • Perfboard

TOOLS:

  • Soldering iron
  • Wire striper
  • Nipper or wire cutter

Step 2: Solder the Arduino Nano

I started of by soldering my Arduino nano on a perfboard. But before soldering, I attached some female headers to the male headers of the nano. This would help us in soldering the nano to the perfboard and in removing the Arduino from the circuit if it gets damaged or we need to upload the code to it.

Arduino pro-mini would also work in place of a nano. But it is advised not to use Arduino UNO because most of the work in this project is done on a perfboard and it would be much more easier to work on Arduino nano or pro-mini compared to other boards.

Step 3: Connect TIP31C to the Perfboard

The signal coming from your smartphone to the Arduino via Bluetooth is converted into a voltage signal which ranges from 0V to 5V. This voltage is very less to drive a 12V LED strip so we either need to increase or step up the voltage to 12V or we could switch it with an external 12V power supply. Increasing the voltage from 5v to 12v would be a bit costly and less efficient, so the best way is to switch the weak signal of Arduino with 12V. This could be very easily achieved using some NPN transistors. But wait, you cannot use those basic NPN transistors (like BC547) because they are only capable of handling 800 mA of current and our LED strip require much more current than that. The solution this is to use a power transistors like TIP31C or TIP122. A mosfet can also be used but a power transistor is more cost efficient than a mosfet.

I started of by soldering the transistor on the perfboard. The first pin of the transistor is signal pin or the input, second pin is the output and third one would be connected to ground. My strip is a common anode strip so I am connecting the third pin of the transistor to ground but if your strip is common cathode strip, then you need to connect the third pin to +12V.

The signal pin of the first transistor would be connected to digital pin 9 where as the second and third pin would be connected to digital pin 10 and 11 respectively. The output pin of transistors would be connected to the LED strip afterwards.

Step 4: Connect the Bluetooth Module

In this project, we are using our smartphone to control the brightness and color of the LED strip so we somehow need to connect our circuit system to the mobile phone to make everything work. This could be very easily done by a Bluetooth module, which gets paired with our smartphone and help us in getting the necessary stimuli from the phone. We can also use a WiFi module but things would go messy when playing with a WiFi module so its better to use Bluetooth module.

In this project we are using a HC-06/HC-05 Bluetooth module. This module has four pins in total. The first one is vcc , second one is gnd, third one is Tx and the fourth one is RX. The vcc of the Bluetooth module would be connected to +5V of the Arduino, gng to gnd, Tx to the RX pin or digital pin 0 of the Arduino. For the Rx pin, we need to make a voltage divider circuit because this pin of module works on 3.3V and 5V signals of Arduino can kill it. To make the voltage divider circuit you need a 2K and 1K ohms resistor. Connect them in series first. The junction of the two resistors would be connect to Rx of of the Bluetooth module. The first pin of 1K ohms resistor would be connected to Tx pin of Arduino and 2K ohms resistor to ground. If you want you can leave the connection of Rx pin of Bluetooth module because in this project, we are only receiving the data from phone and not sending any necessary feedback to it so the Rx pin of the module would be free all the time.

The pairing process and the connection of the Bluetooth module to smartphone could be found in step 10.

Step 5: Connecting the Potensiometer

Three potensiometer are also connected to the circuit. These potensiometers are used here to control the color of the LED strip when your device is not connected to the smartphone. Each potensiometer is for each color of LED strip. For example when you rotate the dial of first potensiometer, the LED strip will glow red. Rotating the potensiometer further will increase the brightness of the red color. Same is the case with second and third potensiometer. You can tune two or more potensiometer simultaneously to get a different color of LED strip. If you set the first and second potensiometer to half (i.e the brightness of red and blue color line to 50%) then the color that you get will be violet.

A push button with a green and red led is also attached to the circuit. This push button is used here to lock and unlock the controls of potensiometer. That mean your potensiometers will work only when the push button is pressed. That could be very well understood by the working of the device. When you turn on the project, the LED strip could only be controlled by the mobile app. But, when you press the push button, the control of the LED strip jumps from mobile app to potensiometers. Now you can control LED strip only through the potensiometer and the mobile app will not work now. Pressing the push button again will transfer the control of LED strip again to the mobile phone.

The red and green LED is used here to indicate weather the controlling of LED strip is being done through mobile app or with potensiometer. When LED is turned red, that means the mobile app is controlling the LED whereas when the color is turned green, that means potensiometer is controlling the LED strip.

The connection of the potensiometer and LED is as follow:

POTENSIOMETER:

  • Pin 1 of all potensiometer to 5V
  • Pin 2 of first, second and third potensiometer to analog pin A0, A1 and A2 respectively
  • Pin 3 of all potensiometer to ground(gnd)

PUSH BUTTON:

  • Pin 1 of push button to 5v
  • Pin 2 to digital pin 5 of arduino
  • Short pin 2 with ground(gnd) through a 10K ohms resistor in between

LED:

  • Anode of red color LED to digital pin 3 of arduino with a 58 ohms resistor in between
  • Anode of green color LED to digital pin 4 of arduino with a 58 ohms resistor in between
  • Cathode of the LED to ground(gnd)

Step 6: Connecting the Audio and Power Jack

If you are using these sofa lights for a get-together party, what could be better than turning it into a music reactive or disco lights by simply plugging an AUX cable coming from the device to your smartphone.So what these music reactive disco light do is they change their color according to the beats of the music playing on your smartphone.

Two audio jacks are attached to the circuit which help in carrying the audio signal coming from the smartphone to the arduino board. The AUX cable coming from your smartphone is inserted into the first audio jack whereas the AUX cable going to your speaker system is inserted into second audio jack. Arduino gets the data from these audio jacks, analyses them and turns on LED strip to some random color. A power jack is also connected to the main circuitry so that you can easily connect your power adapter to the circuit board.

Before connecting anything to the arduino, first connect both the audio jacks in parallel. This is done to split the audio signal coming from your smartphone between your speaker system and arduino circuitry. Here are the connections of the Audio and power jack:

  • Connect L-input of audio jack to analog pin A3
  • Connect R-input of audio jack to analog in A4
  • Connect sleeves of audio jack to ground(gnd)
  • Connect the switch pin of audio jack to vcc
  • Short L-input of audio jack with ground(gnd) through a 10K ohms resistor in between
  • Connect pin 1 of power adapter to vcc of arduino
  • connect pin 2 of power adapter to ground(gnd)

Step 7: Connecting the LED Strip

Now the main part comes which is connecting the LED strip to the project. The LED strip that I am using is a 12V common anode RGB LED strip. It is advised that you also use the same because all the connections and coding is done according to this strip and if you choose some other strip( like a common cathode strip), you need to change many thing like the connection of the LED strip, transistor and to some extent the code also, which could be a pain in the ass.

The connector of my LED strip was bit different because I was not able to insert normal male headers into its connector. So what I did was I inserted the pins of female headers and then used some male to male jumper cable to connect it to my circuit.

Here are the connections other LED strip:

  • Vcc of the LED strip to 12V
  • Cathode of Red color line to the first transistor
  • Cathode of Green color line to the second transistor
  • Cathode of Blue color line to third transistor

Generally LED strips work on 12V but if you strip works on some other voltage then you need to take some precautions and need to edit the project according to your LED strip.

Step 8: Attaching the LED Strip to Sofa

Now its time to attach the LED strip to the sofa. Push your sofa forward so as to expose its back side. Then measure the length of sofa and cut your LED strip according to that. Use the stick back part of the strip to stick it to your sofa. You can also use some cellophane tape or some double sided tape to stick the strip on the back.

Finally I added this small wooden piece to my circuit board so as to provide it some durability. Use some nuts and bolts to hold the circuit board on its place and also to give it some height to prevent breaking of connections.

Step 9: Uploading the Code

Now plug out the arduino from it place and connect it to your PC. Here is the code that you need to upload to your arduino to make this project work.

<p>#include <wire.h><br> 
//RGB LED strip pins
int PIN_RED = 11;
int PIN_GREEN = 10;
int PIN_BLUE = 9;</p><p>int pot1=A0;
int pot2=A1;
int pot3=A2;
int audio1=A3;
int audio2=A4;</p><p>int push_button=5;
int state=0;</p><p>int led1=4;
int led2=3;</p><p>int threshold=20;</p><p>String RGB = ""; //stores the signals coming from smartphone
String RGB_Previous = "255.255.255)"; //stores the default value
String ON = "ON"; //Checks if ON command is received
String OFF = "OFF"; //Checks if OFF command is received
boolean RGB_Completed = false;
 
void setup() {
  Serial.begin(9600); //Arduino serial port's baud rate is set to9600</p><p>  pinMode(push_button,INPUT);
  pinMode(led1,OUTPUT);
  pinMode(led2,OUTPUT);
  pinMode(audio1,INPUT);
  
  RGB.reserve(30);
  
}
 
void loop() {</p><p>  if(digitalRead(audio1)==LOW)
  {
    digitalWrite(led1,HIGH);
    digitalWrite(led2,HIGH);
    
  disco_lights();</p><p> return;
 
}
  
 if(digitalRead(push_button)==HIGH && state==0)
 {
  state=1;
  delay(500);
 }
 else
 if(digitalRead(push_button)==HIGH && state==1)
 {
  state=0;
  delay(500); 
 }</p><p> if(state==0)
 {
  
  digitalWrite(led1,HIGH);
  digitalWrite(led2,LOW);
  
  while(Serial.available()){
    char ReadChar = (char)Serial.read();
 
    // Right parentheses ) indicates complet of the string
    if(ReadChar == ')'){
      RGB_Completed = true;
    }else{
       RGB += ReadChar;
    }
  }
      if(RGB_Completed){
      if(RGB==ON){
          digitalWrite(13,HIGH);
          RGB = RGB_Previous; //when RGB led is turned ON again, the previous color is light up
          color_of_strip();          
 
      }else if(RGB==OFF){
          digitalWrite(13,LOW);
          RGB = "0.0.0)"; //Send OFF string to turn light off
         color_of_strip();
      }else{
          //Turn the color according the color code from Bluetooth Serial Port
          color_of_strip();   
          RGB_Previous = RGB;     
      }
      //Reset RGB String  
 
      RGB = "";
      RGB_Completed = false;
      }
      }
      else
      if(state==1)
      {
        digitalWrite(led2,HIGH);
        digitalWrite(led1,LOW);
        int value1=analogRead(pot1);
        int value2=analogRead(pot2);
        int value3=analogRead(pot3); </p><p>        value1=map(value1,0,1023,0,255);
        value2=map(value2,0,1023,0,255);
        value3=map(value3,0,1023,0,255);
        </p><p>        analogWrite(PIN_RED,value1);
        analogWrite(PIN_GREEN,value2);
        analogWrite(PIN_BLUE,value3);
      }
}
  </p><p> 
void color_of_strip()
{
 
  int SP1 = RGB.indexOf('.');
  int SP2 = RGB.indexOf('.', SP1+1);
  int SP3 = RGB.indexOf('.', SP2+1);</p><p>   String R = RGB.substring(0, SP1);
  String G = RGB.substring(SP1+1, SP2);
  String B = RGB.substring(SP2+1, SP3);</p><p>   Serial.print("R=");
  Serial.println( constrain(R.toInt(),0,255));
  Serial.print("G=");
  Serial.println(constrain(G.toInt(),0,255));
  Serial.print("B=");
  Serial.println( constrain(B.toInt(),0,255));
 </p><p>//Because these RGB LED are common anode so we need to take 255 to minus R,G,B value to get correct RGB color code
  analogWrite(PIN_RED,  (R.toInt()));
  analogWrite(PIN_GREEN, (G.toInt()));
  analogWrite(PIN_BLUE,  (B.toInt()));
}</p><p>void disco_lights()
{
   if(analogRead(audio2) > threshold) // check if audio signal goes above threshold
 {
   int a = random(1, 6); // store a random number
   
   if(a == 1) // glow red
   {
     digitalWrite(9, HIGH);
     digitalWrite(10, LOW);
     digitalWrite(11, LOW);
   }
   if(a == 2) // glow green
   {
     digitalWrite(9, 0);
     digitalWrite(10, 1);
     digitalWrite(11, 0);
   }
   if(a == 3) // glow orange
   {
     analogWrite(9, random(100, 255));
     analogWrite(10, random(100, 255));
     digitalWrite(11, 0);
   }
   if(a == 4) // glow cyan
   {
     digitalWrite(9, 0);
     analogWrite(10, random(100, 255));
     analogWrite(11, random(100, 255));
   }
   if(a == 5) // glow purple
   {
     analogWrite(9, random(100, 255));
     digitalWrite(10, 0);
     analogWrite(11, random(100, 255));
   }
   if(a == 6) // glow blue
   {
     digitalWrite(9, 0);
     digitalWrite(10, 0);
     digitalWrite(11, 1);
   }
   delay(20); // wait for 20ms
 }
 else
 digitalWrite(9, LOW); // if audio signal is less than 20, set all the pins low
 digitalWrite(10, LOW);
 digitalWrite(11, LOW);</p><p>}</p>

Step 10: How It Works?

Plug your Power adapter to the circuit and the project should start working. By default the project is in app control mode so we need to move to the mobile app to make this project work. First download this app called BT_LED_controller from the play store. Install the app and then launch it. On top left corner, you will find a button with name BT_LIST. Click on that and pair your phone with the Bluetooth module of the project. Now move your finger on the colored circle present in the center of the screen and as you move your finger, the color of LED strip would change.

Now press the push button and the color of the LED strip would stop changing when moving your finger on the mobile screen because now your project is in potensio control mode. This mean now you can control the color of LED strip only through the potensiometers present in the circuit. The first potensiometer will control the color of red color LED strip whereas the second and third potensiometer will control the color of green and blue color line.

If you plug in your mobile phone into the 3.5mm female audio jack present on the circuit and play a song, then the color of LED strip would start changing on the beats of the music. Plug your speaker system into the second audio jack to listen to the music playing in your smartphone.

Step 11: The END

This is the end of this project hope you liked it. Stay tuned for more awesome projects. Don't forget to follow me on instructable and subscribe to my YouTube channel. Here is the link of the video.

A big shout out to Yuanryan & Stonez for making this awesome app and allowing me to use it.

NAMASTE.........

Comments

author
mistergjk (author)2017-01-24

I loved this tutorial!!

author
Dushyanta (author)mistergjk2017-05-20

Thank you!

author
stonez56 (author)2017-03-12

Hi there,
I'm the author of this App. This mobile App was developed by my son and me together. We are very pleased someone is using our App in other projects.

Yuanryan & Stonez

author
Dushyanta (author)stonez562017-03-12

Hello sir,
I am glad to meet you. Firstly I tried to make my own app for this project but failed. Then I found this app on the play store which was perfect for my project. It was because of you, I was able to complete this project. Thank you for allowing me to use it. I will surely give a shout out at the end of this instructable to you and your son. Keeping making such awesome app.
Best,
Dushyanta

About This Instructable

5,176views

102favorites

License:

Bio: An electronic hobbist and a tech-savvy. Love to know and publish good electronic projects. I use some popular micro controller like raspberry pi, arduino, linkit ... More »
More by Dushyanta :Homemade Fidget SpinnerBluetooth Controlled Sofa LightsSelfie flashlight
Add instructable to: