Smart Home – ESP8266 module with NodeMCU
ESP8266 wifi module is going to be our endpoint where we will be controlling through our Homebridge device. For the moment, we will be simply controlling a 5V relay which will control the power of any electrical device ( ex: Lights, TV, Wall outlets etc )
NodeMCU is a firmware that allows you to program the ESP8266 modules with LUA script. And you’ll find it very similar to the way you program an Arduino. With just a few lines of code you can establish a WiFi connection, control the ESP8266 GPIOs, turning your ESP8266 into a web server and a lot more. In our case, we will only be needing two URL endpoints to switch on / off the relays. Which we can call from our homebridge device.
First things first, unless your module is having pre installed firmware, we need to write the nodeMCU firmware to it before we start. Thanks to the open source community, this is fairly simple. you just need the right tools.
I’ve bought the device with loaded firmware. you can follow these few steps to get your device up and running.
https://github.com/nodemcu/nodemcu-devkit/wiki/Getting-Started-on-OSX
If everything worked well, you should now be able to run lua scripts inside your module!
We will be using ESPlorer for that.