Friday, April 27, 2018

Hacking IKEA LEDBERG flexible rgb lightstrip

I got a roll of awesome rgb lights at IKEA and used part of it to make an infinity mirror (sorry the link is to IKEA Europe but for some reason it's not on the US site, but anyway it was here in large quantities in Brooklyn). It's made to cut at certain points marked with a scissors and I only used a few feet of a 5 meter roll for the mirror project. So at the time I thought I would figure out eventually how to use the rest. It would be a shame to throw away.


Well now I finally have, and I learned so much in the process.

Questions

Here are the things I had to figure out along the way:

  • What was the existing circuit? How to access the led colors when everything was sealed in rubbery material?
  • How to power it? How much voltage and amps do they require?
  • Could I run it on an ATTiny85, which I've been learning to use and think are great?
  • And more came up as I got into these questions...

Circuit

This blog was a huge help because it explained the need for using MOSFETs. In a nutshell the LED strip requires much higher voltage than the 5V an Arduino can supply so you provide the higher voltage to the MOSFET on each color which gets opened like a gate to let the voltage through by the Arduino pin it's connected to going HIGH. PWM works as well for fading, it just goes high/low very quickly. It also explained the circuit of the similar DIODER product but mine was under all that rubber. The circuit is the same as a common anode RGB LED, so that would be easy. I briefly considered ordering the MOSFET shield they linked to but decided to learn how to connect a MOSFET myself and be all the wiser.
I found I couldn't access the circuit right where I had cut with the scissors, but noticed up the strand a few LEDs a spot where solder could be seen below the rubber. Next to the solder it's even labeled, R, G, B, +24v, so that answered a lot of questions right there!

Power

So I soldered solid core wire onto each of those and followed this tutorial on how to wire up the MOSFETs. At this point I had a circuit like this, with a 3V battery pack supplying power to an ATTiny85 and the 24V AC adapter powering the LED strip.
I had them fading nicely with a program like this:
 int red = 0;  
 int green = 4;  
 int blue = 1;  
 void setup() {  
  pinMode(red, OUTPUT);  
  pinMode(green, OUTPUT);  
  pinMode(blue, OUTPUT);  
 }  
 void loop() {  
  fader();  
 }  
 void fader() {  
  for (int fade = 0; fade < 255; fade += 1) {  
   analogWrite(red, fade);  
   delay(5);  
  }  
  for (int fade = 255; fade >= 0; fade -= 1) {  
   analogWrite(red, fade);  
   delay(5);  
  }  
  for (int fade = 0; fade < 255; fade += 1) {  
   analogWrite(green, fade);  
   delay(5);  
  }  
  for (int fade = 255; fade >= 0; fade -= 1) {  
   analogWrite(green, fade);  
   delay(5);  
  }  
  for (int fade = 0; fade < 255; fade += 1) {  
   analogWrite(blue, fade);  
   delay(5);  
  }  
  for (int fade = 255; fade >= 0; fade -= 1) {  
   analogWrite(blue, fade);  
   delay(5);  
  }   
 }  

For the next step I planned to make a pcb for all of this which I have learned how to do on my school's Carvey. But it seemed silly to have separate power sources for the ATTiny and the LEDs. I went on the Arduino forum with this question, how to power the ATTiny at a lower voltage, and someone suggested "bucking it down", which I figured out with some googling meant to use a buck converter. What an amazing device!

My son and I had lots of fun watching the output voltage change on a multimeter as we turned the adjustment screw. We also connected an LED to it and dialed the voltage up and watched it get brighter until it burned out making quite a stink. This was just the thing to draw voltage from the 24v source, output it at 3.3v and connect that to the ATTiny85 VCC and GND pins. Now the circuit is more like this, though that buck converter pictured is a different version than I used:

PCB

Now to turn that into a pcb.
I had just finished testing and revising a good workflow for using Fritzing, FlatCAM, and the Carvey to make pcbs. Someone on the Inventables forum suggested I try the web based Carbide Copper to do what FlatCAM does, which is convert the Gerber files from Fritzing into Gcode files that can be uploaded to Easel for the Carvey to mill the board. I tried that out but found that while Carbide Copper is a MUCH easier process than FlatCAM, it outputs one single gcode file with tool changes—commands that stop the CNC machine so you can change the bit—which Easel can't handle when importing gcode directly. So I had to figure out how to split the file into 4 separate files—isolation routing, non-copper rubout, drilling, and cutout. I ended up writing a Python program to do it, which was fun and not too hard to learn how to use Python to create files and search and copy text from one to another. 

And It Works!

When I got it all soldered together I was frankly surprised it worked, and surprised my students who were there to see by how surprised I was! The only difficult part of assembling the board was figuring out how to make big enough holes for the barrel jack. I still don't know how and ended up doing a messy kludge of snipping the contacts to make them narrower and forcing the holes bigger with a push pin. Next step is to make a case to hold it...



...and DONE!



7 comments :

Unknown said...

Hello I saw your project and decided to try to recreate it with a NodeMCU board but I've gotten a little stuck on the coding aspect of it, or maybe the wiring. I have the rgb from the cable connected to the D0 D1 and D2 pins
Any advice?

Erik N. said...

Sorry @RileyT coming to this late, I'm not clear what problem you are having exactly. Did you make progress?

John hicksh said...

Thanks for sharing good article. If you want more information.Please visit my website. just click on this.
lighting in Perth

John hicksh said...

Thanks for sharing good article. If you want more information.Please visit my website. just click on this.
RGB strip light Perth

Guido A. said...

Hello, in the breadboard circuit I see the switch button is connected to the +24V line, shouldn’t it be on +3V instead?

Erik N. said...

Hi Guido A, long ago but as far as I can tell it looks like the switch is on the 3V line not the 24 V.

Erik N. said...

Oh I see on the breadboard circuit it is on the 24V, fortunately I fixed that before going further.