MQTT WiFi Relay

From Wiki | OpenEnergyMonitor
Revision as of 10:23, 2 March 2016 by Mary201 (talk | contribs) (Created page with "= Three Channel WiFi Relay / Thermostat Board = The Three Channel WiFi Relay / Thermostat Board is a open software/hardware multi-purpose relay board based on the [https://es...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Three Channel WiFi Relay / Thermostat Board

The Three Channel WiFi Relay / Thermostat Board is a open software/hardware multi-purpose relay board based on the ESP8266 WiFi SoC. It can control up to three AC or DC loads over the Internet using web UI or MQTT. oshw-logo-100-px


  • Powered by the popular ESP8266 WiFi SoC
  • On-board power supply unit (optional)
  • Up to three high quality 10A relays for switching AC or DC loads (see DC switching notes)
  • Built-in web server with mobile device friendly UI and HTTP API to control the relays
  • ** Thermostat function with weekly scheduling
    • Manual relay control via the UI
  • MQTT support
  • NTP for network time and scheduling functionality
  • Web server settings, including HTTP port and basic HTTP authentication setup
  • Broadcast relay/sensor data using HTTP GET to services like ThingSpeak or emonCMS
    • Integration with ThingSpeak for charting/analytics visualization
  • Temperature sensor support (one of them, not both at the same time)

NOTE: The board connects to and controls high voltage, knowledge and attention is required when installing it. It is recommended to use the compatible enclosure to prevent electrical shock.

Board schematic & layout

Three Channel WiFi Relay/Thermostat Board schematic and board layout files are available on GitHub [gallery columns="2" size="medium" ids="3730,3729"] The PCB is 2mm thick with 35 micron foil. [gallery columns="2" size="medium" ids="3760,3759"] [gallery size="large" ids="3869,3868,3867"]


The latest firmware is available on Github. Firmware can be update using a *3.3V* FTDI cable, check the dedicated section of this WIKI.


The PCB is designed to fit in a high quality DIN rail-friendly enclosure. It is highly recommend to use the enclosure to protect yourself from electrical shock. Knock-out entries on the side lid allow custom configuration on the outputs: [gallery size="medium" ids="3767,3771,3769,3772,3768,3770"]

Powering it up

  • The board can be powered as follows
    • Through the on-board power supply module, if installed
    • Via the USB plug
    • Via the DC power terminal next to the USB plug (7-10V DC)
    • Via the FTDI header using a 3.3V Logic Level FTDI cable (it still supplies 5V to the power pin)
  • Mind the live and neutral markings on the board, make sure Live wire connects to the L side of the screw terminal:esp8266_relay_board_brd_in

NOTE: When connected to AC, handle the board with extreme care. Bottom and top of the high side of the board will be live and accidental touch may result in injury or death.

Connecting AC loads

Loads can be connected to the screw terminals next to the relays, please mind connecting Live and Neutral lines respectively. NOTE: The relays are rated 10A, however I'd rather not utilize all three of them at maximum load, as that would cause 30A current to flow through the source AC screw terminal

Connecting DC loads

The board can be used for DC load switching, if the power supply unit is not populated on the board. Power the board from the USB connector or DC input. Connect positive to the L and negative to the N side of the screw terminal.

Configuring the board

The board's parameters are configured through web UI. Upon first boot, the board will enter Access Point mode and you will be able to see it as such by scanning the WiFi networks. The Access Point name would start with "ESP_" followed by the access point MAC address. There will be no security or password. The access point will be switched off after a successful connection to the wireless network. AP mode   If the board does not show up, you may manually force the board into AP mode by pressing and holding the button labeled "GPIO0" for 3 seconds and then releasing it. NOTE: Mind the high voltage side of the board while doing so!! Once connected to the access point, navigate your browser to, if all worked well, this should take you to the main menu. Please note that some mobile phones will detect that the WiFi connection does not provide Internet and fall back to GSM data network. Make sure to disable mobile data so that your browser still uses that access point.

Main Menu

The main menu provides links to the respective sub-menus index-tpl

WiFi connection setup

The WiFi connection menu lets you connect to your WiFi network. It will scan for the available networks and prompt you to chose it. Select the network, type in the network key and choose whether to use dynamic IP through DHCP or static IP address. Using static IP address makes most sense, as you would be able to access the board by its known IP address. WiFi settings menu You will need to set up port forwarding if you wish to access the relay board from outside the network.