NodeMCU as WiFi Shield


I have an Arduino Leonardo that I am controlling with Blynk via ethernet shield. I have a NodeMCU 12E that I want to use as a wifi shield instead of my ethernet shield. I have seen tutorials for using the chip, the ESP8266, to connect to wifi, but none involving NodeMCU. I would appreciate code detailing how to do this, also would I have to program this in Lua or C?

Thanks in advance,


The NodeMCU is build around an ESP8266 chip (ESP-12 module), and can be programmed directly with the Arduino IDE.
Why do you want to pair it with a less capable Leonardo?

I have a program on the Leo that uses an IR led to control devices. It uses Blynk as a control panel. This requires it to be connected to the internet. I don't want to recode the IR code to be NodeMCU compatible, and I don't want to purchase a wifi shield. So I want the NodeMCU to be the WiFi shield. Even if this is wildly inefficient, I am new to NodeMCU and don't really want to learn how to recreate my code for NodeMCU.

You’re spouting nonsense. You start by saying:

I have an Arduino Leonardo that I am controlling with Blynk via ethernet shield.

Then you say:

and I don't want to purchase a wifi shield.

So, you’re not really controlling a Leonardo with a WiFi shield, right? But you want To. Got it. Sometimes you can do things for cheap. Sometimes those things can be easy. Rarely are things both cheap and easy but it can happen if you have an open mind.

If you just want to connect the Leonardo to the Internet, spend $2 on an ESP8266-01 module with AT firmware. Done. Cheap. But not as easy as a shield.

Next is both cheap and easy. A nodeMCU board, a driver transistor, IR diode and a handful of passives. That would replace the Leonardo and WiFi/Ethernet shield as your WiFi enabled Ir controller. GitHub - mdhiggins/ESP8266-HTTP-IR-Blaster: ESP8266 Compatible IR Blaster that accepts HTTP commands for u
GitHub - crankyoldgit/IRremoteESP8266: Infrared remote library for ESP8266/ESP32: send and receive infrare
And there are others...

Then there is your idea to repurpose a nodeMCU board as a WiFi shield. That’s the most difficult idea so far...

I know I don’t make that much sense, but because the NodeMCU uses an ESP8266 chip, I figured that this was possible. How could I do this?

Most Arduino code can run directly on a NodeMCU.
No “other Arduino” needed.
Post your project/code if you need help.

I’m using the IRRemote library by shirriff and Blynk to create an internet-enabled device that I can control with my smartphone that will control my tv and av receiver when certain buttons are pressed. I am currently using an ethernet shield to test, but if you say this can be run on the NodeMCU, I’ll try any code you give me. I have developed 2 libraries to store the functions required to emulate certain buttons on the physical remotes. My mainfile and the libraries are attached.


sketch_dec29a.ino (2.71 KB)

yamaha_codes.cpp (727 Bytes)

yamaha_codes.h (224 Bytes)

tcl_codes.cpp (2.43 KB)

tcl_codes.h (453 Bytes)

This guide might help you get started.

Did you even look at the links I posted? One is a ESP8266 IR device based on Ken Shirriff's work.

@WattsThat Oh thanks, I didn't notice those.