DONOFF – WiFi enabled light dimmer


Part-1 – Introduction

Years ago I started building RF devices to measure temperatures and switching lights on or off. I even wrote a small book (in Dutch) about my findings and experiments. But I always wanted to overcome the main disadvantage of RF devices: no feedback about the status of the lights. I thought that could be done better and with the introduction of the small ESP8266 WiFi enabled processors it could! But SONOFF beat me with there WiFi enabled switches. One great disadvantage of the SONOFF devices is the poor software. To make the switches usable you have to upload third party (mainly Open-Source) firmware and install a Home-Automation solution to control the switches. Another disadvantage of the SONOFF switches is .. well they are switches (Switch On Off). So there is room for improvement!
Albeit: I introduce to you: DONOFF (Dimmer On Off)!

Project goals

The goals of this project is to make an ecosystem that is self sustained. So: you don’t need a Home-Automation system to control the DONOFF devices! Also, there is no substitute for a physical switch (ask your spouse)! You can attach an external toggle– or push-switch to the DONOFF hardware with which you can either switch the light On or Off (toggle-switch) or, with a push-switch, you can switch the light On or Off and dim-up and dim-down by long-pressing the (push) switch.
Every DONOFF has a web-server on board that you can use directly from any (Javascript enabled) browser. Accessing the web-server on a browser gives you the control page for this device:

I will, in four parts, explain how you can build and use this DONOFF ecosystem.

Every DONOFF installation has one DONOFF designated as a Master whilst all the others are designated as Slaves. From the Master’s webpage all the other (Slave) devices can be controlled.
Slave’s automatically register to the Master with their IP-address and Device Name. If you power-up a new DONOFF device it will automatically be added to the Master’s page. If you unplug a DONOFF device it will (after a while) disappear from the Master’s page.

Switches are always shown below the dimmers (yes, you can upgrade a SONOFF switch to this ecosystem but for obvious reasons it will not have the dimmer functionality).
The controls have the following function:

Every DONOFF device has a unique hostname (i.g. “floorlamp”) and an indication of which lamp it controls (i.g. the “Floor Lamp”). With the slider you can control the brightness of the lamp. Clicking on the Toggle-Switch-icon will turn the device “On” or “Off”, which does not affect the slider controlled brightness of the lamp. The lightbulb-icon shows whether the lamp is “On” or “Off”. Every DONOFF device has a settings page to control the various attributes of the device. Clicking on the “Settings-icon” brings you to this page.

The attributes have the following meaning:

this Device Here you can give this Device a hostname. The IP-address is assigned by the DHCP server in your network and can (will) change every time you reconnect the DONOFF device (but this will not affect the installation as the new IP-address will automatically be updated)
Device Role This can either be “Master” or “Slave”. Be aware: there can only be one (1) Master in your installation!
Master If this Device is a Slave, than you must enter the Master credentials. Every Master has the hostname “DONOFF” that can not be changed. But do enter the Master’s IP-address!
Device Type This can either be “Dimmer” or “Switch”. A Switch can only be “On” or “Off” (obviously)
BuiltIn Led pin This is the GPIO pin at which a Built In Led is connected (GPIO1 for an ESP-01, GPIO16 for a NodeMCU, GPIO13 for a SONOFF basic etc.)
External Switch This is the GPIO pin at which an external switch is attached. On the DONOFF board with the ESP-01 this is GPIO2
You have to indicate the type of external switch. Either “Toggle” or “Push”. A Push switch gives, besides the On/Off functionality also the ability to dim-up or dim-down the light
PWM out On the DONOFF board with the ESP-01 this is GPIO3. On the SONOFF basic this is GPIO12 (for a switch type there is no PWM but only HIGH [1] or LOW [0])
PWM frequency Well, the PWM frequency in Hz. A value between 200 and 900.
Min Percent This is the lowest value (in percent) at which the Led lamp still glows
Max Percent This is the maximum percentage you will control using the slider or push-switch. Normally this will be 100(%)
default Light State The value used by a Toggle-switch if the light is switched On
device Label The name of the light as shown on the web-page of this Slave or on the DONOFF Master’s web-page

So far for this short introduction of the DONOFF ecosystem.
In the next part I will introduce the DONOFF electronics.

This entry was posted in Arduino, DONOFF, ESP8266, Hardware, SONOFF, WiFi and tagged , , , , , , , , , . Bookmark the permalink.

8 Responses to DONOFF – WiFi enabled light dimmer

  1. Rob de Bie says:

    Beste Willem,
    Grandioos, wederom een hele diepe buiging !
    Mooi, zinvol en bruikbaar project.

  2. Rob says:

    Hoi Willem,
    na je slimme meter monitor gebouwd te hebben, ga ik dit zeker even volgen.
    Groet, Rob (andere rob dan hierboven!)

    • Hallo Rob,
      Het is zeker een project dat de moeite waard is. Ben nu nog druk in de Research & Development (eerste print-ontwerp heeft een verkeerd formaat Hi-Link 🙁 )
      Verder nog wat punten op I-en zetten. Maar dan krijg je ook wat!

  3. diy electric bike says:

    Your style is unique in comparison to other folks I have read stuff from.
    Many thanks for posting.
    I will just bookmark this page

  4. Roland says:

    Hi Willem,
    I’ve done your smart meter reader project with great pleasure before.
    And now see that you have another nice project; Donoff
    Maybe you have the Donoff pcb for sale separately?
    I will send you my personal data by mail
    Thnx in advance, Roland

  5. Sune Bielefeldt says:

    Dear Willem Aandewiel
    It is a great project you have made here, just what I have missed for a long time.
    I am a great consumer of Sonoff, but have missed this dimmer feature that Donoff offers.

    I want to try to build one or more sets myself.

    Is it possible to buy PCBs from you, or maybe just Gerber files so I can order them myself?

    Best regards from Denmark
    Sune Bielefeldt

Leave a Reply

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