Control ANY Light With Philips Hue

10,126

50

28

Posted

Introduction: Control ANY Light With Philips Hue

I'm a big fan of Philips Hue lighting. It's easy to use, reliable and integrates really well with the Amazon Echo. I always intended to make my own home automation and lighting system but other projects tended to get in the way. I must admit that the Hue works so well and my wife is happy with it so I think it's here to stay. No point rolling my own.

Having said how good it is, it isn't perfect. What is? There is a nice range of B22, E27, and GU10 bulbs and also some other lamps. I notice an E14 (candle) bulb has recently been added. Philips have got most stuff covered. However, I was all my house working together. When I say "Alexa, all lights off" I really want that to mean all.

For instance, what do you do if you have a room with lots of downlighters? Even if they're GU10, at £25 a go that can get expensive quickly. How about floodlights, 12V track lighting, or flourescent tubes? Philips don't make these. What I wanted was to have any light I wanted controlled by Hue. What I really wanted was my own relay or SSR that fits in with the Philips ecosystem. And with a little bit of work that's now what I've got.

I'm entering this Instructable in the Lights contest. If you like it, a vote would be appreciated. I'm sure there are lots of other great projects too, so take a look and vote for whoever you think has done a great job.

Step 1: First, You Need to Make a Sacrifice

So, I decided the best way to create a stable, reliable product was to adapt an existing Hue bulb. It involves cracking open one of the cheaper B22 white bulbs (LBW010) and altering it to do your bidding. Some might call this "hacking" into the Philips Hue system. Maybe this is true, but I feel I've hacked on the right side of the moral line. I may have tampered with the hardware that I've purchased but I've not delved in the firmware. I've not broken any encryption or proprietary secrets. I've paid for this bulb - I just want it to do a little more. So, let's take it apart.

Go buy a B22 bayonet fitting white bulb (LBW010). In the UK they're only £15, so you shouldn't feel too bad about destroying it.

The first thing to do it remove the translucent plastic cover. Grip the bulb in a vice and go at it with a hacksaw. That cover can actually be prised off without cutting, but the hacksaw help encourage it to pop off. None of the externals will be needed, by the way. If you damage it, don't worry.

Next, prise out the white PCB with the LEDs. Ignore those screws you can see. They just attach the PCB to the heatsink. Just get a small flat balded screwdriver and gently prise out the PCB and heatsink together.

You then need to remove the main PCB from the bulb. One thing worth noting on the B22 bulbs is that the two main contacts for mains power are actually made of solder. Before pulling the PCB out you should melt the solder on these. I didn’t and I ripped off one of the 15Ω resistors that are used as fuses from the PCB. Easily replaced, but annoying that I was heavy handed with this.

The PCB is embedded in a sort of rubbery black resin. You need to get all this off. It's actually strangely satisfying peeling it off. It comes off in chunks or crumbles depending how you attack it. (The eagle-eyed amongst you might notice that this photo is of a slightly different E27 bulb. I played around with those too.)

Firstly, let me get the safety warning out of the way. Never play around with this board when it's powered from the mains. None of it is isolated as you're not supposed to take them apart. Anywhere on the PCB can be at a dangerous voltage. Anyway, there's a better and safer way so there's no need.

Step 2: Begin the Hacking

Now I've done a fair bit of poking around on this PCB so you don't have too, but being a curious Instructables reader, I'm sure you're interested. None of this step is necessary but I thought you might like to know how we got to the end result.

Onboard you'll find the largest IC is a SAM21R21E18A. This is a nice 32-bit ARM microcontroller with built-in Zigbee. It's the brains and communications for the device.

There are a number of test point accessible on the underside of the PCB. It took a fair bit of following traces, checking continuity with a multimeter and probing with an oscilloscope, but I managed to work out what many of these were for. This is what I found:

TP1 - Ground
TP2 - SWCLK
TP3 - SWDIO
TP4 - Serial TX
TP5 - Serial RX
TP6 - LED output (about 32V)
TP7 - Regulated 3.3V power to microcontroller
TP8 - RESET
TP11 - Ground
TP25 - power supply to LM2204 regulator

So there a number of interesting signal here. TP1 and TP11 are the signal ground for the microcontroller and logic circuitry. TP7 is the regulated supply voltage.

SWCLK (TP2), SWDIO (TP3) and RESET (TP8) are interesting. You'd need these if you want to load new firmware onto the microcontroller or debug it. Interesting stuff, but this is arguably starting to head over the ethical line of hacking. It's more complicated than we need anyway.

The serial port (TP4 and TP5) are also interesting. You see some debug output on TP4 as the device powers up. Nothing as you use the device and switch the bulb on and off so not much use to us. Once again, more complicated than we need. If you want to take a look, it's 3.3V TTL 115200 8N1.

I told you it was possible to play around with the device safely, and it is. NEVER power your device from the mains whilst poking around. If you have a clean 3.3V supply you can connect that to TP7 and power the device that way. Better still is to supply a slightly higher voltage to TP25. It's usually at about 24V but even 5V (e.g. from a USB charger) will do the job. You might not be able to light up the LED board but it will connect to you Hue hub. At this voltage but you will be able to look at signals, but most importantly you'll be able to do it safely.

Step 3: Some More Useful Signals

OK all the poking around in the previous step was nice, but how do I know if the light should be on or off? None of the signals on the test point are all that useful. What we really want would be a nice on/off signal or a brightness one. Well, you're in luck.

Everything will be controlled by the microcontroller, so I probed all those tiny GPIO pins on the device. These pins are only 0.4mm apart so it took a steady hand, a sharp probe and it was made far more easy by a microscope. It turns out that PA16 contains that nice on/off TTL signal and a PA17 contains a nice neat PWM output of the brightness. Jackpot!

Now, soldering to the pins of a QFN (Quad Flatpack No leads) IC is definitely on the tricky side. I managed to trace that PA16 output to a slightly more accessible place - one end of the diode D3. It's still small, but a whole lot easier than the IC. See the photo for the location. Unfortunately I couldn't find any easier place to access the PWM signal, but we don't need that right now anyway.

So once this is plugged in to the mains again we have ground, 24V power and a 3.3V on/off signal. Anyone feel we could do something with this and a relay? Yeah - me too.

Step 4: Make Use of These Signals

Now, driving a relay from a microcontroller is something that's been done many times. There are even boards you can find on eBay. Just search for something like "arduino relay 24V" and you're all set.

A cheap SSR like the Fotek will do the job really well too. All you need it to connect the ground to - and the 3.3V output to +. I couldn't be easier.

I had the components I needed lying around so I decided to build my own relay board anyway - a 24V relay, a NPN transistor, a flyback diode and a couple of resistors. I also added a varistor just in case I decided to switch something like a fluorescent tube or an inductive load. (Think of it as a bit like a flyback diode but for AC.)

I knocked up a schematic and a PCB layout, but then prototyped it on some stripboard for speed.

Step 5: Testing It Out Before Fitting

OK, so this should all work, but let's test it out before going to the effort of putting it inside a light fitting. Here I'm using a multimeter on the continuity setting. When the relay closes the meter beeps and flashes. Success! The slight delay when switching on is because Hue lights always fade up. The output signal doesn't go high and the relay doesn't close until the light is set to 100% on.

Step 6: Connecting It to the Light Fitting

All that was left was to connect the Hue and relay PCBs to the light fitting. Luckily there was plenty of room inside the transformer enclosure for my track lighting so they're safely and easily enclosed and out of harm's way.

You don't have to put it inside the light fitting though. Maybe yours hasn't got enough room. It could go inside a light switch back-box. If you made a suitable (i.e. safe) enclosure it could be added to the lead of a lamp.

The best thing about this hack is that you now have control. It doesn't even need to be a light that you control, although of course your Hue system will tell you that it is. And teh best thing about this hack is that all the usual Philip firmware update will go through just fine. Philips will never drop support for your custom light because it shows as one of theirs.

I hope you've found this useful. Feel free to ask any questions, and please let me know in the comments if you connect up something to your Hue system.

Share

    Recommendations

    • Microcontroller Contest

      Microcontroller Contest
    • Science of Cooking

      Science of Cooking
    • Pocket-Sized Contest

      Pocket-Sized Contest
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    19 Comments

    It appears the newer Hue lights have a daughter board with the processor on it. It's connected to the mainboard by 7 connections. Possibly similar (I appreciate not identical) to the Cree lamps documented here: https://www.instructables.com/id/Controlling-Any-Light-With-Philips-HUE/

    IMG_20180110_161915.jpgIMG_20180110_164335.jpgIMG_20180110_161942.jpg

    Hi everyone!
    The daughterboard runs fine with DC 5V! and after desoldering one of the transistors you get a good PWM signal (inverted) which could be used to drive a NPN standard transistor. Now you're free to drive whatever you want :-)
    I use a powerful MOSFET (375W) to dim 21 x 10W halogen lamps (12VDC).
    First test with single 40W lamp was nice! no heat at all (except the lamp) ;-)
    The board itself runs with 3.3V but I use 5V to drive the MOSFET for "better" switching and lower heat on the power circuit.

    PCB BOT.pngPCB TOP.pngPCB BOT TRANS.pngMOSFET AND LAMP.pngPCB AND MOSFAT AND LAMP.png

    Hi,

    This is very interesting for me, thanks for sharing, as I had the previous board of the B22 which doesn't have the daughter board. I wonder if you could give me some information on where you bought the newer B22 with the daughter board ? Is there a serial number change on this new version of it ?

    I bought mine from amazon and I have these numbers:

    ASIN : B0152WXDD

    SKU : 929001137101

    I'd like to get the daughter board but I don't want to waste another similar B22 bulb without it.

    Could you describe the wiring and the parts on your last photo ?
    Another question, but the last one, could you give me some information on the NPN transistor and the mosfet so I can buy them too for my project.

    Thanks in advance for your time.

    Hi. I would like to thank you all, for your import. But I do have a question if I feed the daughter board with 5v can I run a 3-32vdc ssr straight off the 3.3v connection that you indicated, or do I need to use a mosfet or a transistor before the ssr?

    Hi William-George. Actually the daughter board runs at anything from 4-12.5v. I did a little more reverse engineering of the main B22 power board to see what else was going on. There is also a status pin that indicates 3 states, ON, OFF and CHANGE. My only worry (before I separated was if the micro would know if it didn't see the LED feedback signal (there's a divider from the full 90v on the LED string) that goes back to the daughter board.
    But as it seems happy running my under kitchen cupboard with CW/WW strips I'm hoping it's not going to shutdown on a diagnostics feedback failure ..
    BTW you don't need to take the transistor off, you still get the nice square 3.3v 1KHz PWM from the pin you indicated. My feeling is (not tried yet) is that you can just add a pull-up from the OC PWM signal on the daughter board to the 12v supply. It is strange that the TP6/7 didn't have the clean PWM.
    Anyway I'm driving some of the cheap "RGB LED Amplifiers" which actually work well.

    I've not seen the newer bulbs. There does seem to be significant differences between the E27 and B22 bulbs so I'm not too surprised. Those 7 connections are likely to be very useful and easier to solder to. Somebody needs to get a scope on them!

    Yep Fred, I've done it and know what the 7 pins do. Oh, and I've nearly finished the main power board cct diagram. The daughter boards are very very good, just wish we could purchase without the rest of the bulb @£5 each, ... and would have been great if they were inside the B27's!!!

    Hi Fred27, nice work!!

    What still makes me wonder is why not to directly use the 32 LED output to connect to a SSR accepting 32 V as your FOTEC example. If PWM switched, a diode between LED connectors and SSR combined with a RC parallel to the SSR might help. Will this do it too?

    Thx

    Well I did what you suggested and the on/off works well but you can't dim. As to why you can't dim I think it has to do with the response time of the SSR :

    ON < 10ms , OFF < 10ms ( http://www.fotek.com.hk/solid/SSR-1.htm )

    It is in my opinion too slow to keep up with the 3.3v 1KHz PWM signal mentionned by tekkfreakk.

    Hi
    This Projekt is very nice.
    Can you help me with a Problem?
    I want to control a LDD700H it needs 2-6V PWM Signal, could i use the PWM of the Controller direct?
    Or do i need a Transistor?
    Thx