Poor Man's Hue Switch

2,959

27

3

Introduction: Poor Man's Hue Switch

In this instructable i'll show you how to build a very inexpensive wireless switch for Phillips Hue Lights.

The problem:

These lights needs permanent power supply, wall switches have to be always on.

If you go to bed and turn off the wall switch the light will never shine again if the hue bridge try to switch on the light, for example in the morning to wake up you softly with a "warm light".

You have to buy the Hue Tap or dimmer switches, which are very expensive, especially if you need one for each room.

The solution is the using of an ESP8266. These tiny controllers with inbuild usb adapter are available for less than 3$. For the power supply you only need 2 pcs. AAA battery, by using the DeepSleep modus of the Esp8266 the battery work for a long time.

Everytime you press the reset button the ESP wake up, connect with your WLAN, get the status of the lamp, if it is on it switches off or vice versa, after this command it falls into deep sleep

Step 1: What You Need

There are two different PCBs with Esp8266 and inbuild usb-adapter for simple programming:

or

  • NodeMCU, not so small, with USB
  • Holder for 2 Micro cells (AAA), solder tags

  • 2 pcs. AAA cell alkaline
  • wires
  • small screw 2x8mm, see picture

for housing:

  • 3D printed case(see STL files next step)

or

  • a housing from an old remote control (see picture)

or

  • place the Esp and battery behind a wall switch button

Step 2: Housing

If you an owner of a 3D Printer, then simply use the attached STLs, you even don't need an extra button, we use the onboard reset button with a 3D printed cap.

Another solution is an old remote control.

If you want to replace the wall switch with a button switch and the Esp you have to shortcut the 2 wires and ISOLATE them so that the Lamp got continous current.

!!!!!! BE AWARE OF ELECTRICAL SHOCK; YOU HAVE TO KNOW WHAT YOU DO !!!!!

Step 3: Coding the Esp8266

First you need the Arduino IDE.

Then you have to install the library for Esp8266. You'll find several tutorials here on instructables how to program these magic tiny things :-)

After opening the attached sketch with the Arduino IDE you have to do some settings depending to you local WIFI.

For a faster connecting/switching we use a static ip adress.

IPAddress gateway(192,168,178,1);

ip adress of you local wifi router where the hue bridge is connected

IPAddress ip(192, 168, 178, 216);

Ip adress of your switch, be aware of using a high adress in the range of 200-250 that is not used for other devices

IPAddress subnet(255,255,255,0);

int light = 2; //

the number of your light that is switched

const char hueHubIP[] = "192.168.178.57";

the ip adress of the hue bridge

const char hueUsername[] = "hue bridge username"

you have to create an authorized username in the hue bridge, look at this tutorial

const int hueHubPort = 80;

always "80"

const char ssid[] = "SSID"; // network SSID (name)

const char pass[] = "password"; // network password

finally SSID and password of your wifi


After changing these settings you are ready for upload !

Step 4: Schematic

The schematic is very simple, you only have to connect the battery holder to GND and 3V3.

The use of an external button is optional.

Step 5: Additional Infos

To reduce the power consumption it is necessary to remove the voltage regulator.

Measure the current before and after removing, the current in deepsleep has to be less than 0,1mA.

Sometimes you also have to remove the supply pin from the UART chip. See here for more infos.

Share

    Recommendations

    • Tiny Home Contest

      Tiny Home Contest
    • Fix It! Contest

      Fix It! Contest
    • Water Contest

      Water Contest

    3 Discussions

    I’ve got this sort of working. I’ve noticed the following

    First the response time is slow. I assume after a reset from deep sleep it has to reconnect with the router. Do you have the same delayed response?

    Second, I’m controlling 3 lights at once. When I turn them on they return to the same brightness as they were before I turned them off. Oddly if one was already off before I used this switch to turn them all off, when I turn them on, that light turns on but in a very dim state. Is there something I can add to the code to turn them all on at full brightness?

    Thanks

    John

    2 replies

    1. Yes, delay is about 2 seconds for the starting wifi connection.

    2. in ' void loop() ' replace ' String command = "{\"on\": true}"; '
    by ' String command = "{\"on\": true, \"bri\":254}"; '

    this starts the light with full brightness

    Thank you, that works.

    For some odd reason the reset switch on my D1 mini doesn’t work. I was planning on wiring in a separate push button anyway so it’s not a show stopper.

    Great instructable.