Limpkin's blog - Tag - RGB LEDs<div>An electronics geek blog, dedicated to sharing and open source. Check out my stores: <a href="https://lectronz.com/stores/stephanelec" hreflang="en" title="Lectronz store">EU</a> / <a href="https://www.tindie.com/stores/stephanelec" hreflang="en" title="tindie store">EU & US</a>.</div>2024-03-29T00:41:47+00:00Mathieuurn:md5:51de6a3d917257edeff5a252fe925b02DotclearA Connected Lamp to Wake Me Upurn:md5:1d9511a1b365f4d6ffe31769ed65d00a2015-08-29T12:26:00+01:002024-03-09T11:23:44+00:00limpkinMy ProjectsDC-DCesp8266RGB LEDs<p>I've always wanted to play with these 10W RGB LEDs!<br></p>
<p><img src="https://www.limpkin.fr/public/lamp/.assembly_4_m.jpg" alt="assembly_4.JPG" class="media-center" title="assembly_4.JPG, août 2015"><br></p> <h2>The Idea<br></h2>
<p><a href="https://www.limpkin.fr/public/lamp/lamp.JPG" title="lamp.JPG"><img src="https://www.limpkin.fr/public/lamp/.lamp_m.jpg" alt="lamp.JPG" class="media-center" title="lamp.JPG, août 2015"></a><br>
So for some reason I bought 2 IKEA lamps at a flea market. As IKEA furniture has a long history of being hacker-friendly, I figured they shouldn't be an exception to the rule.<br>
My plan? Fit a few <strong>10W RGB LEDs</strong> in there together with an <strong>ESP8266</strong> to use the final result as an <strong>alarm clock</strong>.<br><br></p>
<h2>The Schematics<br></h2>
<p><a href="https://www.limpkin.fr/public/lamp/schem.png" title="schem.png"><img src="https://www.limpkin.fr/public/lamp/.schem_m.jpg" alt="schem.png" class="media-center" title="schem.png, août 2015"></a><br>
When you are dealing with a LED consuming that much current, you can't simply use a series resistor as the latter would need to <strong>dissipate R*I² in heat</strong>. I'm therefore using a dedicated LED driver that automatically <strong>adjusts the LED voltage</strong> to match a given current. As you can guess, it isn't much different than a standard step-down and just uses a shunt resistor to measure the current flowing through the LED.<br>
The <strong>A6211</strong> has an adjustable switching frequency set using R2/R3/R4 (to 700KHz in our case) and an EN input meant to be connected to a <strong>PWM signal</strong>. Its datasheet is well made so you can easily find all the information needed to select your passive components values. C13/C14/C15 are here to decrease the current ripple.<br>
The complete board is 12V powered through P1. A DC/DC is placed on the board (I was lazy) to provide the 5V needed by my <a href="https://www.tindie.com/products/limpkin/esp8266-wifi-module-breakout/" hreflang="en" title="ESP8266 Dev Board">ESP8266 dev board</a>. The P3 connector therefore serves as an interface beween the latter and our main PCB.<br>
P4 is meant as an expansion connector to which will be connected an <strong>accelerometer</strong>. The goal is to hopefully <strong>measure REM sleep cycles</strong> to gradually increase the light at optimal times.<br>
The great thing in this project is that the <strong>ESP8266 has all the required IOs</strong> for my purpose (PWM outputs, I2C, std IOs).<br><br></p>
<h2>The Realization<br></h2>
<p><a href="https://www.limpkin.fr/public/lamp/lamp_inside.JPG" title="lamp_inside.JPG"><img src="https://www.limpkin.fr/public/lamp/.lamp_inside_m.jpg" alt="lamp_inside.JPG" class="media-center" title="lamp_inside.JPG, août 2015"></a><br>
The inside of the lamp is fairly simple, I just needed to remove the socket to make room for my PCB:<br></p>
<p><a href="https://www.limpkin.fr/public/lamp/PCBA.JPG" title="PCBA.JPG"><img src="https://www.limpkin.fr/public/lamp/.PCBA_m.jpg" alt="PCBA.JPG" class="media-center" title="PCBA.JPG, août 2015"></a><br>
That was a fun PCB to design!<br>
As you can see its outline is made at the right diameter and has slots in which will fit the RGB LEDs. The ESP8266 board will nicely fit in the middle. Keeping in mind that 10W LEDs don't have a 100% efficiency, I machined an <strong>aluminum plate</strong> that will be used for <strong>heat dissipation</strong>:<br></p>
<p><a href="https://www.limpkin.fr/public/lamp/al_ring.JPG" title="al_ring.JPG"><img src="https://www.limpkin.fr/public/lamp/.al_ring_m.jpg" alt="al_ring.JPG" class="media-center" title="al_ring.JPG, août 2015"></a><br>
In this picture you can get an idea of the stackup:<br></p>
<p><a href="https://www.limpkin.fr/public/lamp/assembly.JPG" title="assembly.JPG"><img src="https://www.limpkin.fr/public/lamp/.assembly_m.jpg" alt="assembly.JPG" class="media-center" title="assembly.JPG, août 2015"></a><br>
After applying some heat paste and soldering the LEDs:<br></p>
<p><a href="https://www.limpkin.fr/public/lamp/assembly_2.JPG" title="assembly_2.JPG"><img src="https://www.limpkin.fr/public/lamp/.assembly_2_m.jpg" alt="assembly_2.JPG" class="media-center" title="assembly_2.JPG, août 2015"></a><br>
And this is what it looks like from below:<br></p>
<p><a href="https://www.limpkin.fr/public/lamp/assembly_3.JPG" title="assembly_3.JPG"><img src="https://www.limpkin.fr/public/lamp/.assembly_3_m.jpg" alt="assembly_3.JPG" class="media-center" title="assembly_3.JPG, août 2015"></a><br>
You can notice the M2x6mm brass standoff spacers and the power supply/expansion connector.<br>
Here is the final result:<br></p>
<p><a href="https://www.limpkin.fr/public/lamp/assembly_4.JPG" title="assembly_4.JPG"><img src="https://www.limpkin.fr/public/lamp/.assembly_4_m.jpg" alt="assembly_4.JPG" class="media-center" title="assembly_4.JPG, août 2015"></a><br>
Obviously the USB port won't be used ;-) .<br><br></p>
<h2>All Done!<br></h2>
<p><a href="https://www.limpkin.fr/public/lamp/lamp_on.JPG" title="lamp_on.JPG"><img src="https://www.limpkin.fr/public/lamp/.lamp_on_m.jpg" alt="lamp_on.JPG" class="media-center" title="lamp_on.JPG, août 2015"></a><br>
The hardware is tested (I've been blinded a few times!) and the software is still <strong>a work in progress</strong> but the core functionalities are there.<br><br>
<a href="https://www.limpkin.fr/public/lamp/alarm_control_panel.png" title="alarm_control_panel.png"><img src="https://www.limpkin.fr/public/lamp/.alarm_control_panel_m.png" alt="alarm_control_panel.png" class="media-center" title="alarm_control_panel.png, déc. 2015"></a><br>
You may find all my files in <a href="https://github.com/limpkin/espalarm" hreflang="en" title="espalarm repository">this repository</a> (HW part is CERN licensed). As you will see, all of the code is based on esphttpd with esp-open-sdk.<br>
Cheers!</p>