Operate 4 Channel Relay using nodeMCU (ESP12-E)

In this article, we are going to learn, how to install the driver of NODEMCU (ESP12-E) and see you and upload in Arduino IDE.

Code: Code :  https://github.com/Drjslab/4-Ch-Relay-ESP8266-sketch

Image 0: Pin Diagram of NodeMCU ref#[1]

Connect your nodeMCU to your PC using micro USB. There are chances that, your computer may not get the proper Driver. the driver error will occur in given image number 1.

Image 1: My PC is not able to get the driver of UART Bridge controller.

In this case, we can download driver from given reference number 2. Extract the Folder, in my case its “CP210x_Windows_Drivers”. Install Driver as given Image 2 and 3.

Image 2: Download Driver as per your Architecture.

Image 3: Install Driver.

Now you may be able to get your driver. In my case, my device is connected to COM Port number 3 (COM3). View image number 4.

Image 4: Now Port is visible.

Now we required necessary header file in Arduino IDE. To install go to the file >> preferences. Image number 5.

Image 5: Install ESP Board Defination to Arduno IDE

Add URL ref [3] (http://arduino.esp8266.com/stable/package_esp8266com_index.json) to “additional board manager URLs”.

Click ok

Now go to tools>> board>> Boards manager.

Image 6: Goto To the Board Manager.

Now search for ESP 8266 board manager and install it.

Image 7: Install proper version.

Once you’re done with this procedure it’s time to copy this code to your Arduino IDE and uploaded to the board.

Click here for GITHub repo.

This program can operate 4 GPIO. I am using 4 GPIO on ESPBoard. That is D0, D1, D2, and D3 (on printed Board). Actual pin number D0 is 16. So here in this program, I have represented D0 as r1, D1(pin 5) as r2, D2 as r3(pin 4) and D3 as r4(ping 0).




[1] https://pradeepsinghblog.files.wordpress.com/2016/04/nodemcu_pins.png

[2] https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers

[3] http://arduino.esp8266.com/stable/package_esp8266com_index.json

Share Post