• 1

    BRIDGE INSTALLATION:

    install webserver (apache + php)

    debian/raspbian distributions:

    $sudo apt install apache2 php5 php5-mysql php5-curl nmap
    

    ubuntu 16.04 distribution:

    $sudo apt install apache2 php7.0 php7.0-mysqli php7.0-curl nmap
    
    install database (mysql or mariadb)
    $sudo apt install mariadb-server
    

    or

    $sudo apt install mysql-server
    
    enable rewrite module
    $sudo a2enmod rewrite
    
    edit apache config
    $sudo nano /etc/apache2/apache2.conf
    

    find:

    <Directory /var/www/>  
            Options Indexes FollowSymLinks  
            AllowOverride None  
            Require all granted  
    </Directory>
    

    change

    AllowOverride None
    

    in

    AllowOverride All
    
    copy php files in /var/www/html
    $sudo cp -r HueBridge/www/. /var/www/html  
    
    edit the settings variables in bridge-config.php
    $sudo nano /var/www/html/bridge-config.php:  
    
    • $ip_addres = 192.168.10.24; //replace with ip of the bridge
    • $gateway = 192.168.10.1; //replace with the gateway/router ip
    • $mac = 12:1F:CF:F6:90:75; // important!!! replace with bridge mac address. Cand be saw with command
      $ip a
    import sql_schema in database
    $mysql -u username -p  < file.sql
    
    add cronjob for schedulers
    $sudo crontab -e
    

    append the following line:

    * * * * * php -f /var/www/html/cron.php
    
    connect to bridge

    Open official smartphone application, click help, insert the bridge ip and connect.

    GitHub project page:

    https://github.com/mariusmotea/diyHue

    Installation and demo video:

  • 2

    LIGHTS:

    LIGHT STRIPS:

    Supported neopixel led are WS2812B and SK6812 (rgbw).
    Data in pin of the leds must be connected to dedicated harware pin of the esp8266 platforms (rx pin on wemos d1 mini and esp-12e)
    Compilation require Makuna/NeoPixelBus library that can be founded and downloaded automatically from Arduino library mannager.

    Options in skeches:

    • const char* ssid = "...."; // your wi-fi netwotk mane
    • const char* password = "....";// your wi-fi password
    • lightsCount x //number of emulated lights per strip
    • pixelCount xx // number of leds in strip
    • startup_brightness 0 // between 0 ( no light on power) and 255 (max brightness on power)
    • startup_color 0// 0 = warm_white, 1 = neutral, 2 = cold_white, 3 = red, 4 = green, 5 = blue
    • IPAddress strip_ip ( xxx, xxx, xxx, xxx); //if you want to use static ip uncommented with gateway_ip, subnet_mask and WiFi.config(strip_ip, gateway_ip, subnet_mask); lights can be controlled with any browser. example url:
    "http://{light ip}/set?light=1&r=0&g=60&b=255&transitiontime=2000"
     "http://{light ip}/discover" 
    

    list of arguments that can be passed in url for lights direct control:

    • "on": 1 to set light on, 0 to set the light off.
    • "r", "g", "b": setup light color using rbg values between 0 and 255.
    • "x" and "y": values between 0.0 and 1.0 to setup light color in CIE chart.
    • "ct": value between 153 (max warm white) and 500 (max could white) http://en.wikipedia.org/wiki/Mired
    • hue: value between 0 and 65535, represent the hue of the light.
    • sat: saturation of the light. 255 is the most saturated and 0 is the least saturated.
    • bri: brightness of the light, 255 is the maximum brightness, 1 is the minimum, 0 will turn the light on to previews state
    • transitiontime: duration of the transition from the light’s current state to the new stat. default 4 represent 0.4 seconds.


    COLOR DREAM RGBW BULBS:

    I found these bulbs are esp8266 based devices that can be adapted to work with this bridge. Despite the low price these bulbs feels solid, are more heavy than regular bulbs and i expect to be modium to long life. I was not able to flash the memory by connecting vdd, gnd, rx, tx, rst and gpio0 pins to a nodemcu dev board, but was very easy for me to replace the SPI flash chip from an already programmed epb8266 board. This operation took me about 30 seconds, while soldering the small wires took me more than 5 minutes. Future firmware updates will be easy to perform via Arduino OTA (wifi). Sketch for these bulbs can be found in RgbwHueBulb folder, the gpio pins defined (12, 13, 14 and 5) are the correct ones connected to leds. Bulbs where buyed from here:https://www.aliexpress.com/item/AC85-240V-5W-7W-9W-RGBW-WIFI-LED-Bulb-Light-Colorful-Dimmable-LED-Light-Support-IOS/32785628736.html?spm=2114.13010608.0.0.B8FcLh

  • 3

    SENSORS:

    DIMMER SWITCH and TAP SWITCH

    Require basic knowlege of electronics, in order to build the circuit from picture!

    If is used an ESP-12E module, then must connect pin gpio15 with a 10k resitor to ground and pin CH_PD with a 10k resistor to VDD.

    If everything is ok on first power on you will be able to see and configure a new switch in application. Is important to use static ip's because dhcp require extra time to perform the action. Switch will stay alive just 5 seconds, then will enter in deep sleep mode and will consume just 17uA. Once a button is pressed there will be a short negative pulse on RST pin that will wake up the module. This operation will take about 0.5 seconds. If the button is released in this period the chip will be unable to detect what button was pressed and will not send any requests to bridge.