I have recently started working on esp8266 wifi module and arduino uno. I am a little confused.

I have created a small Web page with esp8266 AT commands. Now I want use it for receiving data such as changes on the Arduino inputs.

I have seen many similar implementations using jQuery for that purpose, but I don't know where to place that jQuery file.

Furthermore, is it possible to use NODEMCU firmware and still toggle arduino pins and transmit data to esp8266?

I want to use Arduino for:

  • reading voltage levels
  • publish the values read to the Web page
  • toggle a relay when a button on the Web page is pressed.

Please kindly help me out or point me in the right direction to search


This is quite a huge topic to cover in one answer, but I will do my best.

The NodeMCU can be used in three distinctly different ways. First is the AT mode, where you have installed the AT firmware. In this mode the NodeMCU is purely a slave device to the Arduino. Once you have got the Arduino to configure the NodeMCU in the right way to receive data on a socket it will send that data back to the Arduino verbatim through the serial port with special tags added (indicating what the data is, and which socket it arrived on, etc). It is then up to you to receive that data, interpret it in whatever way you desire (as a HTTP GET request most likely) and craft the correct response (if any) and send it to the NodeMCU to send back (again using the AT commands).

What you send through the socket is entirely up to you. By the sounds of things you will be making a simple GET request from a web browser to perform an operation, and maybe respond with some data to display in the web page. That can be easy, or it can be hard - it's as hard as you want to make it. The simplest way is to rely on an external web server to serve the main content and structure of the page, then use jQuery or Prototype to make an AJAX call to your NodeMCU and receive back any data there may be. In this case everything will be on your external web server except the single (or few) URL(s) that perform operations and return data. That includes the jQuery (which is just Javascript, it's loaded from your web server into the browser and executed), any code for buttons, images, HTML, everything (on the web server, that is).

The other two ways the NodeMCU can operate are both very different to that. They differ mainly in the language that is used with them. You can use the NodeMCU with its own LUA language to get it to do almost anything you want. That includes receiving the HTTP GET request and serving the data for it, all without the help of the Arduino. In fact, doing that, there is little need for the Arduino any more - the NodeMCU has an analog input and multiple digital IO lines - it also has SPI available for interfacing with external ADC chips if you want more than one analog input. So you can have everything internal to the NodeMCU without needing the Arduino at all. If you do want to keep the Arduino then you can interface to it through the serial port (as you would in AT mode) but using your own custom protocol in whatever way you see fit.

The third way is to program the NodeMCU as if it were itself an Arduino. There is an ESP8266 core for the Arduino IDE (and for UECIDE Beta as well) which allows you to program the NodeMCU in the same language and with a similar API, as the Arduino. This even more removes the need for the Arduino. You can get the Arduino core from Github here: https://github.com/esp8266/Arduino

Incidentally, the Xtensa core in the ESP8266 is considerably more powerful than your typical Arduino, being 32-bit, having its own DSP, and with much more RAM and Flash memory. It kind of makes the Arduino redundant.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.