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.
Enter 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.
Hi Chris, thanks for your message. I’m glad it was useful to you. Yes, it can be a real pain sometimes. That’s why I started this blog: as a future reference for myself and maybe it will be useful to others too.
I spent a good couple of hours last week getting Eclipse setup for ESP32 development on my Linux box. Maybe I’ll write an article about that one too.
Hi,
I bought the ESP-12E/F development board, and I am having trouble flashing software to it using Kubuntu and the Arduino IDE as you described.
In Windows it works, but in Linux I get this.
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_open failed
I add myself to the dialout group, and I checked on what port the board is connected usb 3-4: ch341-uart converter now attached to ttyUSB3
Any ideas on what I am doing wrong ?
I’m sorry for the slow reply. Are you using the exact same ESP board as shown in the bog post? Did you select the correct COM port in the Arduino IDE? Did you try it on a recent Arduino IDE or an older one?
Have you tried lowering the baud rate?
Allow me to share my experience with a similar board, the Feather Huzzah ESP8266. I believe the diff between this and your board is the presence of a mini-USB port on mine.
Similar thing happened to me, even after I’d added myself to the dialout group. Logged off, then back in, started the Arduino IDE, and I saw /dev/ttyUSB0. Even managed to upload a sketch, so it worked.
I then opened another sketch, tried to upload it, and the IDE complained about not being able to open /dev/ttyUSB0. Closed the other sketch, and this time it worked.
Hope that gets you somewhere
Many thanks for the very clear, complete and step-by-step instructions. My ESP12E is happily blinking away running Ubuntu 16.04 LTS and the Arduino 1.8.5 IDE. Your help is much appreciated, and got me up and running with none of the usual agonies!
Thanks for your message Curt, it’s good to hear that it was useful to you 🙂
Can you please tell me.. Do I have to install drivers (Cp2102) in ubuntu 16.04.. But in Windows drivers are installed automatically when I connected it.. But in ubuntu when I am uploading error comm_open function failed.
I followed your steps but when I try to upload I get this error:
Build options changed, rebuilding all
ctags pattern is missing
Error compiling for board
I have tried several board types though it is a Lolin Uno. I am lost now
Hi Sean, I am not familiar with the Lolin boards. You say it’s a Lolin Uno, which sounds like an Arduino Uno clone. This may sound like a silly question, but are you sure it’s an ESP8266 based board?
Yeah it is, I programmed it ok when I had Mac OS X on the laptop. But as it is end of life for Apple, I went to Linux with it. Maybe I will back it up and try Mac again or grab a windows laptop cheap
I see. I use Windows 10 and Linux Mint and both work fine with the nodemcu boards. I would probably first try a live distro (DVD/USB) before reinstalling a whole OS :p
I installed Mac OS X and it programs the NodeMCU with the same settings I used in OpenSUSE. I think the issue is openSUSE not Arduino
I have asked also on the nodemcu forum
I’m getting the same missing ctags error on opensuse leap 15. It happens on all the ESP32 boards I have tried, and also on STM32 boards.
Great !!!
Used your installation guide for Arduino on Linux 64 bit (old HP Elitebook). Worked fine.
Installed the Nodemcu ESP8266 board on Arduino and testes the Blink test.
Excellent guide.
Hi Lurey, thank you for your message, it’s good to hear it was useful for you!
Thank you. With your guide I was able to get the basics up and and running within 5 minutes. Never used an arduino before, but I’m impressed how smooth it went. ttyUSB was working instantly. IDE runs. Used Arch linux.
Thanks for this quick and easy tutorial, is very good.
I did the installation on a MacBook Pro with Big Sur, if you are using Big Sur OS there is a small issue related to Arduino IDE and pySerial here in this form you can find the fix for the moment.
https://forum.arduino.cc/index.php?topic=702144.0