4 Steps to make DIYHue Motion Sensor

To continue with the DIYHue build, I am going to show you how to create your own DIYHue Motion sensor. The motion sensor can be used to trigger a bunch of action via the Hue Essentials App.

If you have been following my post on the DIY Hue, you will enjoy this build as much as I do.

After tinkering around with a few circuits that are described in the DIY Hue homepage, finally I settled on the following circuit that works with the slight modification of the source code.

Step 1. Build the prototype of the above circuit

I am using the same NPN transistor s8050 that I used in building the DIY Hue dimmer switch. Another reason is because I have abundance of them. So here is the pin configuration in case you are wondering.

I have also included the picture of the PIR sensor that I used. I am using the above PIR. As you can see, there are tiny marking of +,0,- on the PCB. Connect the + to the VCC, – to the GND and 0 to the 100nF capacitor which driver the Base of the NPN Transistor.

Here are the picture of my prototype:

Step 2. Upload the code to ESP8266.

Once you have build the prototype, you can compile and upload the code using Arduino interface. You can find the code from the following link.

You will need to change the Wifi ssid, Wifi password, IP address of DIY Hue Bridge as per the following section;

/// BEGIN SETUP SENSOR PARAMETERS ///
const char* ssid = "YourWifiSSD";
const char* password = "yourWifiPassword";
//Set bridge ip
const char* bridgeIp = "192.168.8.20";

Then you need to configure the fixed IP address for the motion sensor and set the IP address for the gateway and the subnet mask as per the following:

// set the sensor ip address on the network (mandatory)
IPAddress strip_ip ( 192, 168, 8, 97); 
IPAddress gateway_ip ( 192, 168, 8, 1);
IPAddress subnet_mask(255, 255, 255, 0);

Once the code was uploaded successfully, on power up, it should registering itself to the DIY Hue Bridge. You can turn on the serial monitor to see the log to make sure everything works ok.

Step 3. Assign the Action

To configure the action, you will need the Hue Essentials app. If you don’t already have it you can download it from the app store or the play store. Open the Hue Essentials app and click on the “Devices” button at the bottom, you should see the screen similar to the following:

Select the “Hue Motion sensor” to configure it, you will be presented with the screen similar to the following:

As you can see on the picture above, you can click on the “Add action” when there is a motion even. And the picture on the right is to configure the action when the is no motion.

What I have configured in mine is to turn on the DIY Hue on when there is a motion and turn it off after a set delay of 2 minutes when there is no motion. You can see my configuration in the following picture:

Step 4. Turn it on

Now that you have configured everything, it is time to turn this on. If it all works ok, then you should have the working DIY Hue motion sensor as shown in the following video.

If you made it this far, that is great. Please subscribe if you like post and you will be informed when there are new projects that I made.

Let me know if you have any questions or comments, and I will try my best to answer them.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.