book collections email follower instructable user
Picture of Control Stuff From the Internet, Create a WIFI Switch.

Learn about relay, WIFI and how to create and internet switch! Use the Wemos D1 Mini (ESP8266) and the relay shield.

Step 1: What Is a Relay

Picture of What Is a Relay
What is a Relay (extremely simple);
  • A relay is an electrically operated switch.
  • Most Relays use and Electromagnet to mechanically operate the switch.
  • Since relays are switches, the terminology applied to switches is also applied to relays; a relay switches one or more poles, each of whose contacts can be thrown by energizing the coil.
  • It is mainly used to control higher voltage circuits with lower voltage. The 'control' and 'controlled' circuits are electrically isolated from each other.
  • Normally-Open(NO) : The circuit is disconnected i.e. open when the relay is inactive.
  • Normally-Closed(NC) : The circuit is connected i.e. closed when the relay is inactive.
  • There are other relays most notably a solid state relay. Relay are extremely common electronics and really easy to use.

Relay come in many different shapes and sizes. In the images above you can see the few examples I have on my desk.

divad.ohc1 month ago
This project is missing a very important part. Wemos is 3v and relay is 5v. Wemos can NOT reliably switch the relay. It needs to convert 3v to 5v.
Dhruv Yadav5 months ago
What is the cost of the phone the?
turbiny1 year ago
Do you know how many relays can one mini d1 control?
bk991 year ago

Hi Tom,

I'm a total newby, but you've inspired me!

My question now though is whether or not - for my application - I even need a relay? Can you answer that?

I'm hoping to control via wifi, the door open button on my intercom. I don't need to have any power via a relay. I just need to take a normally open and close it for a second. Basically push the button / touch the wires together.

Can I do that with only the Wemos D1 Mini -- and skip the relay?

Thanks so much!


CarlosF1762 years ago

Does this work in every network connections? or only in home network?

KirkD25 made it!2 years ago

Hi, Tom! Thanks for putting together and sharing such a well put-together Instructable for the Wemos D1 Mini! Your instructions made my getting this far much less painful than it would have been otherwise, lol! How would I modify the code for a garage door? I have one wire connected to the common pin, and I'm guessing my other pin would go to the NC pin? Even with everything unplugged, the garage door opens/closes when the other wire is connected to that pin, but it sounds like the motor keeps going nonstop, so everything is just disconnected for the moment.