Site Loader
Zlatiborska 10a


This relay shield is designed to be used with the WeMos mini & mini Pro ESP8266 based development boards. Adding this shield to your WeMos mini development board provides it with the ability to switch high voltage, or high power devices from a single digital pin. Included with the shield is a set of header pins which can be optionally fitted (soldering required) to allow for the shield to be easily inserted and removed from the D1 mini.

Although this module is intended for use with the Wemos development boards it can of course also be used as a standalone relay module requiring a single 5V supply and one digital pin (5V & 3.3V compatible) to control it.



The circuitry of the Relay Shield is set up so that the coil (control side) of the relay is connected between 5V and the collector terminal of a transistor.  The base of the transistor is connected to a digital pin of the WeMos D1 Mini board (pinD1 when stacked) so that the state of the transistor–and thus, the state of the coil–can be turned ON and OFF based on whether the pin is at a HIGH (3.3VDC) or LOW (0VDC, ground) voltage.  We can specify the HIGH/LOW state of pin D1 in the code running on the ESP8266.

If we didn’t want to use pin D1, we could use a breadboard for the connections.  But the main advantage of using the WeMos is the ability to stack the boards on top of one another.


Code Walkthrough: IoT Device

For controlling device over the internet we add the code that allows us to connect to our local Wi-Fi network, and run a simple webserver.  In the setup() function, we configure the pin as an OUTPUT, use the WiFi object to connect to our local Wi-Fi network, and print out the assigned IP address.  Then, we use the server object to create 2 routes to our ESP8266 application.  We want to print out a “usage message” (in JSON format) when a user navigates to the top level path “/”, and we want to toggle the relay on and off when a user navigates to the “/rel=on” or “/rel=off” path.



Source code of D1 mini:





If you like my work 🙂


Also my code is free but my time not, so if you need talk with me put 5$ on

Post Author: Admin

Leave a Reply

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