Because most of the examples that I saw regarding the use of the small and fancy NodeMcu controller are nothing more than simple web pages, I decided to go one step further and design a small but yet efficient system that is able to control 3 socket plugs.
Let's start with the beginning.
The html code is loaded inside the memory of the NodeMcu but the images and the javascript files are located on an external server. I used this method to save time on loading the page and also to have access to the script files for modifying them in an easy manner.
The hardware is simple:
- NodeMcu wifi controller;
- 3xBC547 transistors for driving the optocouplers leds;
- 3x OMR351 optocouplers for driving the relays.
- 3 general purpose relays with 220V coil;
- 3 modular socket plugs;
- 1 plastic case
The complete code can be downloaded from here. Please take note that the code was written in Arduino Ide. A complete tutorial on how Arduino Ide can be used to program NodeMcu can be found here.
Before you upload the code to the NodeMcu's memory please visit the links in the comment block inside the sketch. Because is crucial to understand how to use the file sytem built in NodeMcu, you should also visit the following links:
So, here is the complete project:
The web pages:
Circuit and the PCB layout:
Building the pcb:
The complete project:








Comments