Small project #12 — IKEA Samtid mood-light upgrade

This upgrade is based on the loved-by-everybody WS2812B intelligent RGB LED and works just fine with Adafruit’s NeoPixel library.

The concept is – once again – rather simple. Whack a lot of WS2812B RGB LEDs onto a small board, add an ubiquitous ‘Arduino core’ and make sure everything fits nicely and works. Well, it worked.

This post gives a short overview of V0.27.a of this project. As this is NOT a step-by-step assembly manual, please read the whole post before you start soldering. There are some important additions at the end! For the very latest tips consult the master-branch of the code-repo!

Modes of operation:

* M-button: double-click –> change MODE anytime

Depending on the current mode, the M- and E-button have additional functionality. Every time a valid button event has been detected, the on-board LED flashes briefly.

* white modes: M/E press & hold: set global brightness for most effects
* uniform static colour: E press & hold: change colour
* uniform colour fader: E/M single click: change delay
* split colour: E/M press & hold: change colours
* rainbow modes: E/M single click: change delay

IMGP10016

I added a couple of safety features to the design. There is room for poly-switch fuses and a big SK84 Schottky diode (DS1) for reverse polarity protection for the whole board. The fuses are still in the mail, so I replaced them with wire bridges. When I finally get them, I’ll do some testing with respect to voltage drop and make my decision if they will be used at all. The voltage drop across the Schottky diode is somewhere between 0.3V to 0.5V, but it turned out that is already too much and the brightness suffers considerably. One option would be to get an adjustable power supply and increase the voltage to slightly above 5V to compensate, but for now I chose to remove this diode.

IKEA-Samtid_mood-light_power-supply

As you can see, there is another Schottky diode (DS2). The reason for this one is the fact that the project is split into two boards. The main one with the LEDs (which gets the 5V after the fuses) and a control board after the 2nd Schottky diode. The control board can easily be detached for reprogramming – no need to disassemble the whole thing. “VCC.A” goes to a board-to-board connector and is then called “VCC.B” (the same naming is used for GND).

If power is applied via the main power connector, both the main board and the control board get power. No problem.

The 2nd Schottky diode is there to prevent back-feeding of power when a programming adapter is connected to the control board. The LEDs can consume up to 2.5A, which would probably burn it out. But that is not quite good enough to be somewhat on the safe side.

If power is only applied to the control board and a logic HIGH is present on the data-line, some power will bleed over to the unpowered VCC of the 1st LED (via the input clamping diode). This might over-stress and damage the GPIO pin of the micro controller.

We need to take care of input clamping diodes as well, i.e. we need a voltage level-shifter on the data-line connecting the control board to the 1st LED.

IKEA-Samtid_mood-light_level-shifter

Fortunately there are ways around this problem. You can buy dedicated level-shifter ICs (usually multi-channel), or use 2 MOSFETs + pull-up resistors for just one data-line. I chose the latter option. See the application note AN97055 for all the details.

Besides the level-shifting, this circuit has another nice feature. It isolates the side of the “bus” that is not powered. If the 5V on the LED side is not present (power only connected to the control board for programming), the MOSFET Q1 turns off and no “parasitic” power can flow. The pull-up resistors were chosen to support the 800kHz used by the WS2812B LEDs, essentially RC time constant using the input capacitance of the chip and making sure it was considerably smaller than 1/800kHz. I didn’t check the waveforms, but it works. Good enough for now.

There is one remaining issue though. If the main board is powered (5V) and therefore the control board as well (5V minus one Schottky drop), and one should connect a programming adapter with say 3.3V supply and IO levels… that could cause some damage, so please don’t.

The remaining parts are quite simple, so I’ll just refer you to the schematic. It’s really just a couple of LEDs, a ton of bypass capacitors and a micro controller + buttons + status LED + oscillator + some passives.

Now onwards to the hardware!

For severe lack of PCBs I had to resort to using cardboard mock-ups. Not the worst choice, as it worked out quite well. No unexpected mechanical interference.

IMGP9902

This time I ordered the circuit boards at DirtyPCBs. I will use them again. Initially I had self-panellized the main board + control board, but for some reason I just cannot grasp, the PCB service I usually use for this kind of job had issues with that. To be fair, it was the factory that didn’t like it. They would’ve done it for another 20 bucks or so (“self-panellization fee”), but I didn’t feel like paying that. Especially so as the control boards are very small, fit into dead space of the main board and therefore would’ve reduced waste.

I submitted 2 jobs with DirtyPCBs (main board + control board), had everything shipped with DHL and still ended up paying about 25 bucks less. We like that!

IMGP9986

Bottom side of the board, which will be facing downwards in the lamp. The control board is simply piggybacked onto it with “microMaTch” board-to-board connectors. The main reasons for choosing them was low profile + availability. You can see the footprints for the level-shifting MOSFET circuitry between the board-to-board connector footprints.

Another reason for using a daughter-board was that for some reason I had miscalculated total current consumption. I read somewhere that the WS2812B can take up to 60mA when fully on, so I would’ve ended up with about 4A. I did everything I could to keep the power planes as wide and undisturbed as possible. Now that I have the real thing sitting on my desk, it only takes 2.5A max – go figure.

IMGP9988

Top side, which will be facing towards the ceiling.

IMGP9987

The circuit boards fit nicely over the Samtid’s E27 socket. Phew!

IMGP9993

A spacer (plastic, cardboard…) is required to get a bit of distance between the circuit board and the metal rods holding the lamp shade.

IMGP10057

It has come to my attention that later Samtid models have a somewhat different arrangement for holding the shade, so I’ll have to make a field-trip to my local IKEA shop and take some measurements. I hope my board still fits the later models.

IMGP9992

Size comparison between SK84 (8A, 40V) and SS14L (1A, 40V) Schottky diodes.

IMGP10002

The very first thing I assembled was the control board, the most difficult part of this project, due to the ATmega168PA’s QFN32 package. Quite tiny. It worked out OK, using hot-air and my soldering iron for touch-up.

IMGP9994

However, I must have been quite blind… or at least severely distracted. DOH!

IMGP9995

After having fixed that inexcusable blunder, it looks like this. The microMaTch connectors interfere with the switches a bit, and I didn’t get it quite right here. The interfering pins must be absolutely flush with the circuit board. Will be fixed later.

IMGP10001

And the chip survived!

IMGP9997

There was a slight problem when programming the ATmega168PA. I was getting device signature mismatches all the time. In the end I discovered that the bootloader I used had been compiled for the ATmega168 and therefore reported a different signature than the ISP programmer. That was fixed by recompiling “optiboot” for the PA variant. This custom bootloader is part of the code repo for this project (16MHz).

Control board fully assembled.

IMGP10025

IMGP10023

Starting to assemble the level-shifter / isolation circuit (2x BSS138 n-ch MOSFET + 1.5k pull-up resistors). The slotted pads were supposed to help with alignment of the microMaTch connectors. It worked out OK.

IMGP10006

Board-to-board connectors added to main board. It helps a lot to use the control board as an alignment jig for these.

IMGP10007

Control board plugged in. Note that the push buttons are still somewhat crooked. I really would’ve like b-to-b connectors with a much lower profile. Didn’t find anything of that sort + availability in small quantities. Normal pin headers would’ve “cost” me 11mm vertically, these only take about 9-ish mm.

IMGP10009

IMGP10008

SK84 assembled.

IMGP10005

Adding flux for LEDs.

IMGP10010

Fully assembled. Please note that these LEDs are extremely sensitive to over-temperature. The plastic melts, the pads start to move, the bond-wires rip off. Especially if you use a soldering iron, you must dial down the temperature to about 260°C-ish and don’t spend to much time heating individual pins.

IMGP10027

IMGP10022

IMGP10020

Lights on!

IMGP10032

IMGP10068

IMGP10017

IMGP10016

IMGP10015

IMGP10014


A little update on the SK84 / poly-fuse issue. Best not to populate the Schottky diode at all and use a polarized connector. The voltage drop is just too high. If you want to use a poly-fuse, use a single 3A one that fits onto the SMC footprint of DS1 and bridge F1 and F2 with thick wires. The fuse shown below comes in a 1812 package, which still works kinda sorta.

I got this one on ebay. Resistance is about 30-ish mOhm and it trips at about 6A, so it only protects against catastrophic failure. If you use one of these common 5V, 3A switch-mode power supplies (wall-wart style), they should limit current way before that. Most of the good ones are short-circuit protected.

IMGP10193

Not the most beautiful bodge, but it does the job nicely.


Design files + code

This entry was posted in Arduino. and tagged , , , , , , , . Bookmark the permalink.

5 Responses to Small project #12 — IKEA Samtid mood-light upgrade

  1. mircho says:

    I don’t know if you have considered the possibility to use p-fet for polarity protection. It seems to work well and the voltage drop is significantly lower.
    Here is a popular link to one good article: http://hackaday.com/2011/12/06/reverse-voltage-protection-with-a-p-fet/

    • robert says:

      Yes, that is an option as well. I didn’t go that way because of the higher part count. It would be best to use a polarized connector.

  2. Gianni Messina says:

    Very interesting project!
    Why don’t prepare a kit or sell a build of this great stuff?

Leave a Reply

Your email address will not be published. Required fields are marked *

CAPTCHA Image

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">