Tuesday, May 3, 2016

Fun with RGB LED

People often need home lighting control in their lives. These individuals can easily find relevant products which often use different methods to reach their goal. One of the method is LED lighting, which uses new principles, materials, and means of control. All signs point to a significant increase in the use of LED lighting systems, replacement lamps, and retrofits worldwide, with the greatest growth in general illumination applications.

An RGB LED is actually three LEDs, red, green, and blue inside one package, A single LED die can only emit monochromatic light which could be one of the three primary colors - red, green and blue, known as RGB. To realize more colors, three LED dies need to be used together for RGB color mixing. By controlling the brightness of each of the individual LEDs you can mix pretty much any color you want. Using an RGB LED you can cycle through all colors. Useful to make, Mood Lamp, expressive robot or cool light effects.


Credit: Pavan Kumar Jarmale
Credit: Pavan Kumar Jarmale

Idea

 

Most Android-powered devices have built-in sensors that measure motion, orientation, and various environmental conditions. These sensors are capable of providing raw data with high precision and accuracy. By using Accelerometer and Magnetometer, we can calculate the orientation (tilt) around Y-axis (Roll) and we can control the color variations of an RGB LED which is connected to Intel Edison based on these angles over Bluetooth.



How it works

 

Android device comes with few built-in sensors amongst those we have used accelerometer and magnetometer. Accelerometer data will contain noise in its output therefore will not be able to give stable values. To overcome this, we combined magnetometer data with accelerometer data to get stable orientation values / angles. The data is the rotational angle from 0 degree to 360 degrees. In Intel Edison, these values are mapped to change in the Intensity of the Red, Green and Blue colors. By changing the duty cycle of the Pulse Width Modulated signal, we can change the brightness of the LED. A particular color when varied can be kept constant by turning off the switch in the app UI or by disconnecting the Bluetooth connection.


Hardware 

 

3. Android Smartphone (Accelerometer and Magnetometer are must)
5. Wires / Connectors


Setup

 

1. Connect Red LED pin to pin 3 of Intel Edison via 220 Ohm resistor
2. Connect Blue LED pin to pin 5 of Intel Edison via 220 Ohm resistor
3. Connect Green LED pin to pin 6 of Intel Edison via 220 Ohm resistor
4. Connect Anode LED pin to 3.3 V supply of Intel Edison



Credit: Mukesh G
Credit: Mukesh G


Software

 

On Android: 

Build the BTRGBControl project using Android Studio and upload the generated apk to your smartphone.
 OR
Download the apk from this link.

On Edison:

  • Bluetooth-SPP Python wrapper
  • PyBluez
The above two application packages are Intel Edison specific. To install and run the program, please follow this link.



Outcome


The outcomes of the project are as follows:

1. Orientation from 180deg to 360deg gives luminous light. Each angle when the
2. Gave better results when the LED was powered at 5V than when it was powered at 3.3V.
3. In one of the program, the red and blue remains constant and green varies at the extreme end of orientation. The other program portrays that blue and green remains constant and red varies at the extreme end of orientation. Similarly, LED can produce many colors by varying the combinations of R, G and B.
4. The color can be kept constant by turning off the switch in the app UI or by disconnecting the Bluetooth connection.


Demo

 






Real life Connect


Using the most simple and direct method, the idea empowers people to control their personal lighting environment from their mobile device. You can easily customize your lighting colors to match your desired mood and atmosphere, transforms your living room into a dance floor and simulate calming moonlight to improve sleep and enhance rest, mimics the sunrise in the morning and synchronize your music with lighting effects. Similarly, we can apply the same concept to control other home appliances.


Credits

On Edison, program was written by Kiran Hegde (Email: kiranmadansar@gmail.com)


Fun with RGB LED

People often need home lighting control in their lives. These individuals can easily find relevant products which often use different meth...