loading
A simple phone controlled RBG LED light. It communicates over bluetooth. All you need is an RBG LED, 3 resistors, a bluetooth module (like HC-05), arduino board and a mobile phone with bluetooth.




Wiring details and as well as links to the app here -> forum.arduino.cc/index.php?top­ic=148853.msg1408773#msg140877­3

Step 1: Wiring Details

Here is wiring. Make sure you double check your the datasheet of the bluetooth module that you have. You just need to connect VCC, ground and TX pin on the module to 5V+, GND and RX pin on the arduino board. Some modules are only 3.3V tolerant so make sure you READ THE DAMN datasheet first ;-)

Step 2: Arduino Code

Here is arduino code - it's a slightly modified version of an example sketch that comes with arduino IDE - the one that relies on parseInt funtion.

Note that I used baud rate of 19200 because that's the default rate for my bluetooth module. It usually takes less time to just change it in arduino sketch rather than use AT commands to change baud rate of the module so READ THE DAMN DATASHEET and check what's the default baud rate of your module. Also note that the module has to be working as 
master so if it does not work check if yours is set as master.


anyway hte code is below ->

// pins for the LED:
const int redPin = 9;
const int greenPin = 10;
const int bluePin = 11;

void setup() {
  // initialize serial:
  Serial.begin(19200);
  // make the pins outputs:
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);
  Serial.setTimeout(50);

}

void loop() {
  // if there's any serial available, read it:
  while (Serial.available() > 0) {

    // look for the next valid integer in the incoming serial stream:
    int red = Serial.parseInt();
    // do it again:
    int green = Serial.parseInt();
    // do it again:
    int blue = Serial.parseInt();

    // look for the newline. That's the end of your
    // sentence:
    if (Serial.read() == '\n') {
      // constrain the values to 0 - 255 and invert
      // if you're using a common-cathode LED, just use "constrain(color, 0, 255);"
      red = 255 - constrain(red, 0, 255);
      green = 255 - constrain(green, 0, 255);
      blue = 255 - constrain(blue, 0, 255);

      // fade the red, green, and blue legs of the LED:
      analogWrite(redPin, red);
      analogWrite(greenPin, green);
      analogWrite(bluePin, blue);

      // print the three numbers in one string as hexadecimal:
     
    }
  }
}

Step 3: Android App

Here you can download both the app and the source file that you can upload into app inventor to modify it >
https://drive.google.com/folderview?id=0B_PfPoEotOF8N2JwT3RSX011SjQ&usp=sharing
the app has .apk extension
the source file has .zip extension





TROUBLESHOOTING of this project and your own modified versions of the app.
If something does not work read the entire instructable and the datasheet of your module again. Make sure TX pin on the module is connected to RX pin on arduino board. Make sure you're powering the module with voltage it needs.

If you still can't work this out get a bluetooth dongle if your desktop/laptop doesn't have inbuilt bluetooth, and download putty (or just use serial monitor that comes with arduino IDE). First, connect the phone to the computer, open putty and see what the app sends when you move sliders. Then test the other half of the project - connect from the computer (using bluetooth of course) to the module and again open putty/serial monitor. Enter commands manually, make sure it sends a newline at the end of each command and see if the aruduino board responds. These two procedure should explain a lot and help you find out whether the phone/app is the problem or the arduino + BTmodule.
<p>Nevermind i messed up, i just used 3 different leds )) , do you have sketch for individual Led brightness control ? thanks again</p>
<p>Thanks for the tutorial!!!!!!!!!! i was looking for this for a while...... got the regular on/off led via BT and this was a pain in &gt;&gt;&gt;. Thank again for this!</p><p>however i have few questions, if you dont mind answering them :P</p><ol><li>When i connect and move any of the sliders, all of the LED's light up, so is it possible to make just individual LED to light up?<li>For some reason LED's work from High to Low( when you start moving your slider from left to right it goes high to low(off). How to reverse it?<li>can you explain how your code works? or perhaps link me to good tutorial ? thanks a bunch, cheers</ol>

About This Instructable

17,558views

57favorites

More by kerimil:Simplest and cheapest adjustable power supply How to make the simplest compression fitting for a silent air compressor / vacuum pump How to log data from the arduino board 
Add instructable to: