ESP8266 NodeMcu and Arduino IDE on Linux
Many Arduino projects use an ESP8266 WiFi module, usually the ESP-01, just for wireless communications. But the ESP8266 is also a very powerful microcontroller on its own. It’s capable of doing many of the things the Arduino microprocessors can do. The ESP-01 is a bit limited in its possibilities because it only has a few pins, but other versions of the ESP8266 modules are much more versatile. One of those versions is the “ESP8266 NodeMcu ESP12E”, a development board. It’s an ESP-12E/F together with a USB to serial interface and a voltage regulator, fitted on a board with lots of pins. Another big advantage: the boards are very cheap. I got mine, a “Geekcreit™ Doit NodeMcu Lua ESP8266 ESP-12E WIFI Development Board” from VNG Systems for just €8,50.
ESP8266 NodeMcu ESP-12E with the Arduino IDE on Linux Mint/Ubuntu Linux
The ESP8266 NodeMcu comes with a firmware that lets you program the chip with the Lua scripting language. But if you are already familiar with the Arduino way of doing things, you can also use the Arduino IDE to program the ESP. Thanks to a project on GitHub called ‘Arduino core for ESP8266 WiFi chip‘ you can add support for the chip to the Arduino IDE. This way you can write sketches using the already familiar Arduino functions and libraries. You can upload the code directly to the chip and run your program on the ESP8266. No external microcontroller required.
The ESP8266 Arduino IDE extension comes with libraries to communicate over WiFi using TCP and UDP, set up HTTP, mDNS, SSDP, and DNS servers and do OTA updates. It will also let you use a file system in flash memory, work with SD cards and servos. Most notably, it will also let you work with SPI and I2C peripherals.
Installing the ESP8266 Arduino core
First, make sure you have a recent version of the Arduino IDE installed. It should be at least version 1.6.4, because we will need the Boards Manager function which allows the installation of third-party platform packages. You can read here how to install (or upgrade to) the latest version of the Arduino IDE on Linux Mint/Ubuntu.
When you are good to go, start the Arduino IDE and navigate to File > Preferences.
https://arduino.esp8266.com/stable/package_esp8266com_index.json into Additional Board Manager URLs field. You can add multiple URLs, separating them with commas.
Then open Boards Manager from Tools > Board:”(your currently installed board)” > Boards Manager… and enter “ESP8266” in the search field. Then select the “esp8266 by ESP8266 Community” package and click the “Install” button.
When the installation is complete, close the board manager. Navigate to Tools > Board and select your ESP8366 board, in my case the “NodeMcu 1.0 (ESP-12E module)”. Finally, make sure you have the right USB port selected under Tools > Port.
Running “Blink” on the ESP8266
To see if everything is working as it should, you can upload the “Blink” sketch to the board. Go to File > Examples > 01.Basics and select the “Blink” sketch. Then click the “upload” button (the round one with the arrow pointing right) and the sketch will be compiled and uploaded to the board. Then you should see the LED on the ESP blinking steadily after a few seconds.
Thanks a lot for this. I’ve been scratching my head over the complicated nature of getting a development system setup for various mcus other than the arduino and they all seem to require too many package downloads and battling various permissions. This is most encouraging.