Control a power outlet with an ESP8266 running MQTT via a relay

; Date: April 17, 2017

Tags: Power Control »»»» Home Automation »»»» ESP8266 »»»» MQTT

The ESP8266 is a little computer gizmo with bundled WiFi that's easy to incorporate into a wireless control system. The on-board computer is tiny, but it's powerful enough to run a MQTT client. MQTT in turn is an extremely light-weight message-oriented communication system. The example shows an ESP8266 with custom software controlling a relay, that in turn controls enough AC power to turn a light on/off. Controlling the relay is fairly simple, since the ESP8266 has an output strong enough to drive the coil of a relay.

Code: ( ItKindaWorks ESPHelper blob master examples RelayControlV2/RelayControlV2.ino

The software is built with ESPHelper, see: (

About the Author(s)

David Herron : David Herron is a writer and software engineer focusing on the wise use of technology. He is especially interested in clean energy technologies like solar power, wind power, and electric cars. David worked for nearly 30 years in Silicon Valley on software ranging from electronic mail systems, to video streaming, to the Java programming language, and has published several books on Node.js programming and electric vehicles.