Intro: Luminch Color LED Lamp
The first time I saw the Luminch One by Francisco Castro, I was surprised by the simplicity and the magical experience. However, since there never can be enough magic, I decided to make one with a little twist: the Luminch Color.
The Luminch Color not only allows to turn the lamp on and off with a simple swipe gesture and to dim or brighten the lamp by holding your hand above the lamp, it also allows changing the color simply by touching the sides near the bottom. With these four sides, you can change the color to red, green or blue, or back to white.
The magical experience of infrared distance sensing and capacitive touch aside, this design also naturally decouples light intensity from color and saturation. Since the human eye has different sensitivities for different colors, I also made a first attempt at mixing the colors in such a way that the human eye experiences it as a uniform color space. In other words: the perceived light intensity doesn't change (much*) when changing color, and the perceived color doesn't change (much*) when changing light intensity. As such, this project was also an experiment in different color spaces (most notably sRGB and CIELAB).
(* Note that for an actual uniform experience, it is important to calibrate the LED and electronics. As I don't have the equipment for that, this is just a best effort. Also, it would be good to have more than 8 bit PWM resolution, especially for the settings with low intensity. Unfortunately, the Arduino used in this design is limited to only 8 bit.)
Step 1: Materials
1 x Ikea Grono (small version)
1 x USB wall charger (5 Volt, capable of at least 1 Ampere)
1 x USB cable (1.8 meter)
1 x Strip board (at least 8.5 x 12.0 cm)
1 x Arduino Uno
1 x Infrared sensor jumper wire (3-pin JST)
1 x Capacitor 100 uF / 25V
Break away male headers
Break away female headers
1 x RGB power led (capable of 350 mA per color, for example MULTICOMP OSW-8339)
1 x Infrared distance sensor (Sharp GP2Y0A02YK0F or GP2Y0A21YK)
3 x NPN transistor BC337
3 x Resistor 220 Ohms, 1/4 W
1 x Resistor 100 Ohms, 1/4 W
2 x Resistor 68 Ohms, 1/4 W
1 x Resistor 9 Ohms, 4 W (I used 2 x 18 Ohms, 2 W in parallel)
2 x Resistor 6 Ohms, 1.2 W (I used 2 x 3 Ohms, 0.6 W in series)
4 x Copper strips, 3.5 x 8.5 cm
Step 2: Circuit Diagram
The circuit is a simple extension of the original circuit from Francisco. However, since I used an LED that could handle more current, I used different resistor values.
As this circuit could potentially draw more than 0.5 Ampere over USB, I added a simple jumper that can switch between high power (up to 1 A) or low power (less than 0.5 A) operation. This jumper is shown in the photo above: the right header has 68 Ohm, 100 Ohm and 68 Ohm resistors while the left header has 0 Ohm resistors (simply soldering the connection points together). These resistors are resistors R46, R41 and R47 in the schematic.
WARNING! Always place the 60 / 100 / 68 Ohm resistors when connecting the lamp to the computer or any other device that cannot supply 1 Ampere! If you do connect the lamp with the 0 Ohm resistors to such a device, you risk permanently damaging the device, potentially causing a fire, burning down the house and neighborhood and causing a nuclear meltdown. (Okay, the latter risks are probably negligible, but in any case: please be careful when connecting the lamp to your computer.)
The capacitive touch is not shown in the diagrams, but it is formed by simply connecting the copper strips directly to A1 - A4 on the Arduino. The exact pinout is:
- A1: green (front)
- A2: red (left)
- A3: white (back)
- A4: blue (right)
Step 3: Heat Up Your Soldering Iron!
I forgot to take a lot of pictures during the process. Furthermore, I also had to redo some small steps a few times, as I hadn't planned it very well from the start. However, I hope these pictures and the description of the original Luminch One are sufficient to recreate the Luminch Color.
Here are a few note though:
- Use small strips of strip board as legs for the circuit. Since the bottom of the Ikea Grono is curved, the electronics will slide to one side if there are no legs. Also, the legs will be used later on to solder the capacitive touch strips onto.
- Use female pinheaders on the circuit board to connect the legs. I forgot to do that, and with my lamp it is now very difficult to unplug the Arduino.
- Place the LED in the center of the circuit to avoid an asymmetrical effect. Place the distance sensor as close as possible to reduce the shadow of the Grono glass in the operating range of the sensor.
- Raise the LED to avoid shadows from the other components (mostly the distance sensor). (Although the shadows could also be a nice surprising effect as well.)
- My JST cable used red for ground and black for Vcc. So, before you solder the connector, verify the pinning of both the distance sensor and the cable.
- Cut the USB cable near the end and solder the wires directly to the circuit board. Be careful to select the wires to the correct nets. (If in doubt, meaure the USB cable to make sure you use the correct color). Fixate the cable with some wire to the circuit board to get some strain relief.
- Some of the components of the Arduino are quite high. I therefore stacked the pinheaders to give more room for the Arduino (see picture 5).
- Since the Arduino does not have the USB pins routed to the headers, I added a few wires and a header and soldered them directly onto the Arduino. This allows you to program the Arduino without having to swap USB cables. I also keyed the header to prevent connecting it in the wrong way (see pictures 6 and 7).
- As a last step, cut the copper strips for the capacitive touch to the size such that they fit in between the legs and solder them onto the legs. Make sure that there is no short circuit between the copper strips. See the last picture for a detail of the copper strips.
Step 4: Program the Arduino
Place the 68 / 100 / 68 Ohm jumpers to prevent drawing too much current from your computer.
Download the code from https://github.com/admarschoonen/luminch-color. Open configuration.h and select the correct distance sensor (see lines 8 and 10). Next, program the Arduino.
Test the circuit by swiping on / off and changing colors. Does everything work? Congratulations! You can now unplug the lamp from the computer, replace the 68 / 100 / 68 Ohm jumpers with 0 Ohm jumpers and plug the lamp into the 5 V / 1 A wall charger.
Want to change anything in the software? Please go ahead, but remember to always place the 60 / 100 / 68 Ohm resistors when connecting the lamp to the computer or any other device that cannot supply 1 Ampere to prevent any damage to equipment.
Is something not working? See next page for help.
Step 5: Trouble Shooting
Here are some tips to help you finding the problem in your Luminch Color.
Start by uncommenting line 68 of configuration.h (#define TEST_ELECTRONICS) to enable a test program. This program cycles red, green and blue with low and high intensities. If something is wrong with the led electronics, this allows you to more easily locate where the issue is.
This test program also shows debug output on the serial port (115200 baud) for the capacitive touch and distance sensor. The debug output shows something like:
raw: 543; avg: 544; delta: 1; state: 1 raw: 568; avg: 569; delta: 1; state: 1 raw: 494; avg: 493; delta: -1; state: 1 raw: 551; avg: 552; delta: 1; state: 1 raw: 54; distance: 2642
The first 4 columns (raw, avg, delta and state) show the state of the first capacitive touch button (red). The most important is state. This value can be between 0 and 4 and has the following meaning:
- 0: calibrating
- 1: not touched
- 2: touched, but not held long enough to actually register as a touch
- 3: touched
- 4: not touched, but not yet long enough to actually register as a touch release
Columns 5 - 8 show the same information for the second capacitive touch button (green), 9 - 12 show this information for the third button (blue) and 13 - 16 show this for the 4th button (white). Finally, columns 17 and 18 show the information from the distance sensor (both raw and processed values).
If one of the capacitive touch sensors is not working, it could be one of the following cases:
- The distance from the sensor to the glass is too large. Since air is a very bad conductor for the signals of capacitive touch, a few millimeter spacing can have a big impact on the signal to noise ratio and sensitivity of the sensor. Try to bend the copper strip towards the glass. If this does not work, test by touching the sensor directly.
- The sensor has a short circuit with another sensor. Test every connection with its neighbor with a multimeter; there should not be any short circuit.
- The sensor is connected to the wrong pin or not connected at all. Test the connection with a multimeter.
- The sensor has a very low or very high sensitivity. Try adjusting the thresholds on lines 33 and 34 of captouch.h.