Tuesday, February 16, 2016

The ESP8266 NodeMCU using the Arduino IDE for development (with optional MQTT and Bluemix)

I bought a NodeMCU (ESP8266) board from Aliexpress for just a few dollars.
The NodeMCU ESP8266 is cheaper than the Arduino and has more memory, includes wifi, and runs faster.

After a lot of false starts, I arrived at this process to allow development using the Arduino IDE that I'm already familiar with.

I received help from my fellow IBMer, Neil Kolban, who wrote this free eBook about the ESP8266:

Most of this information is also found in the article here:

The ebook and that article have much more information about other ESP8266 boards, so I've "boiled it down" here to what is necessary.

1. Download the latest Arduino IDE (1.6.7 or above)

2. add the ESP8266 board manager to the Ardujino IDE

Start up the Arduino IDE software
go to file, preferences, additional boards manager URLs and enter
click OK
Go to Tools, board, board manager. Scroll down to the ESP8266 and on the bottom right click "install" (if there are multiple options, choose the latest)

3. Install a USB Driver for the NodeMCU.
Driver is here:
I suggest you reboot after installing it.
4. Connect the NodeMCU board to PC via a cable that has USB on one end and the microUSB on the other.

5. Look in Windows Device manager to find the driver for the NodeMCU under comm ports (windows start, device manager)

6. in the Arduino IDE, select the NodeMCU board
go to tools, board, scroll down to generic 8266, and select NodeMCU 1.0 in the menu.

7. Run the Blink code
in the IDE, select  file, examples, basic, blink
change the  three places where there is a number 13 to 2
go to the menu at top and select: sketch, upload
(note: if it fails, just restart and try again or click sketch, upload again)

Further exploration:
8. Use with MQTT and IBM Bluemix IoT Foundation
download the pubsub library to talk over MQTT

Install a program - you can google many. The examples for the pubsub library are a good start.


if you want to read this about MQTT on IBM Bluemix

Note: you may also find these helpful




No comments: