Wouldn't it be awesome to have a mood light that you can control with your phone from the comfort of your bed?
With a simple Bluetooth module, an Arduino, and an RGB LED, you can make that dream possible.
In this tutorial, we are going to show how to setup an nRF8001 Bluetooth module to change an RGB LED color according to the value sent from our iOS device.
We need the following materials for this project:
- Arduino Pro Mini
- nRF8001 Development Board
- 330 Ohm Resistors
- RGB LED Common Cathode
- Slide Switch
- 3.7V Rechargeable Lithium Battery
- 8.5” x 11” White Paper
- 5V FTDI Basic USB to Serial Converter
- USB 2.0 Cable (A to Mini B)
- Cardboard Box
- iOS Device
Follow the pictures below to wire the Arduino to the nRF8001 Board and the RGB LED:
Note: Make sure you connect a resistor between the Arduino Pro Mini and each of the RGB LED color pins. Also, if you want to use other digital pins for the RGB LED, make sure those pins have PWM capabilities.
An RGB LED is just like a regular LED, but with the ability to change between three different colors: red, green, and blue. Hence the name “RGB.” So by combining these three colors, we can produce any color we want.
When it comes to RGB LEDs, there are two types: common cathode and common anode. So what is the difference between them? Looking at the schematics below, we can immediately see how they differ:
Common cathode means that the three colors share the negative pin while common anode means that the three colors share the positive pin.
In this project we decided to create our own paper lamp using origami. There are many tutorials on the internet that show how to create different types of paper lamps, some more complex than others. You can follow whichever you like the most to create your own paper lamp. In our case we followed this tutorial:
We connected a slide switch to the 3.7V battery to be able to turn on and off our lamp. We simply took a red wire, cut it, and stripped it as shown below:
Then we punched through the box with our slide switch and soldered the wire like this:
So now one end of the red wire is connected to the positive terminal of the battery and one end of a black wire is connected to the negative terminal of the battery.
Finally we make a small hole on one of the sides of the box to pass the red and black wires and connect them to the Arduino’s Raw and GND pins respectively. In the end, we end up with something like this:
For the code download the following GitHub Repository:
You are also going to need to download and install the following iOS App in your device:
Once the repository is downloaded, locate the folder “libraries” and extract the library inside it into your Arduino’s libraries folder. Then connect your Arduino Pro Mini, open the LightShowArduino.ino, select Arduino Pro or Pro Mini (5V, 16MHz) w/ Atmega328 as your board, choose the Serial Port that your Arduino is using, and run the program.
Once the program is running, open the Light Show App and connect to the Bluetooth module. When the connection has been locked, you can select the color that you want in your iOS device and duplicate it in the RGB LED.
Now you just need to put your paper lamp over the RGB LED, turn off the room lights, and enjoy!
Optional: We wrapped a white tissue around the LED before putting it inside our paper lamp to help diffuse the light and give it a smoother bright.