ESP8266 and friends


Other projects

This page:


A board with ‘HelloServer’

A usb connection is sufficient to power this board up and it appears in my wlan network. Obviously I once uploaded the following sketch to the board:

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>

const char* ssid = "MyWlan";
const char* password = "MyWlanPassword";

ESP8266WebServer server(80);

const int led = 13;

void handleRoot() {
  digitalWrite(led, 1);
  server.send(200, "text/plain", "hello from esp8266!");
  digitalWrite(led, 0);

void handleNotFound(){
  digitalWrite(led, 1);
  String message = "File Not Found\n\n";
  message += "URI: ";
  message += server.uri();
  message += "\nMethod: ";
  message += (server.method() == HTTP_GET)?"GET":"POST";
  message += "\nArguments: ";
  message += server.args();
  message += "\n";
  for (uint8_t i=0; i<server.args(); i++){
    message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
  server.send(404, "text/plain", message);
  digitalWrite(led, 0);

void setup(void){
  pinMode(led, OUTPUT);
  digitalWrite(led, 0);
  WiFi.begin(ssid, password);

  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
  Serial.print("Connected to ");
  Serial.print("IP address: ");

  if (MDNS.begin("esp8266")) {
    Serial.println("MDNS responder started");

  server.on("/", handleRoot);

  server.on("/inline", [](){
    server.send(200, "text/plain", "this works as well");


  Serial.println("HTTP server started");

void loop(void){

But how did I do the upload?

My old computer

Ubuntu 14.04 Trusty Tahr, Arduino IDE v1.0.5

The Arduino IDE is really old and I can’t remember how I selected the Nodemcu board. However the serial monitor on the old machine works and shows:

Connected to MyWlan
IP address:
MDNS responder started
HTTP server started

My new computer

Ubuntu 18.04 Bionic Beaver, newest Arduino IDE v1.8.5

I connect the board via micro usb cable to my computer. Unbelievable: Only half of my micro usb cables do work at all. I consider those “working” which create a /dev/ttyUSB0 device. With the other cables Ubuntu linux doesn’t even create a device when plugging. You can start ‘minicom’ to easily test which are working. If you open minicom and connect to ttyUSB0 it will not stop when device ttyUSB0 goes away. Instead, it just tells about the status.

So we continue with one of those working cables. Linux creates device /dev/ttyUSB0 and we select that in the Arduino IDE.

Problem: The Arduino IDE cannot open port /dev/ttyUSB0:

warning: espcomm_sync failed
error: espcomm_open failed

Many people seem to have this problem - see

Must read: Here’s a trouble shooting guide (!) for that problem: sparkfun - Comments: ESP8266 Thing Hookup Guide

And, the serial monitor doesn’t work.

On the other hand: When I use ‘minicom’ as serail monitor I can see exactly the same output I have on my old machine:

Connected to MyWlan
IP address:
MDNS responder started
HTTP server started

So my situation is:

  • Solved: Use a verified micro usb cable to have Linux create /dev/ttyUSB0 on plugging
  • Solved: I can receive and display serial output from the Nodemcu by using ‘minicom’ as terminal program
  • Still a problem: The Arduino IDE cannot talk to /dev/ttyUSB0
  • Still a problem: The serial monitor of the Arduino IDE cannot connect to /dev/ttyUSB0 (while minicom can)
  • Still a problem: I do not get a reaction from a brand new Nodemcu on /dev/ttyUSB0 when trying with minicom

Update: Check this wonderful documentation ESPEasy =======


How to get the ESPEasy firmware:

  1. Download a ZIP file (!) from releases. Zip already contain the complete images we need for flashing. If you just clone the repositories you would have to build those images yourself:


Ubuntu 18.04 Bionic Beaver:

➜  Apps: pip --version
pip 18.1 from /home/marble/.local/lib/python3.6/site-packages/pip (python 3.6)

pip install --upgrade esptool --user -h


Ha, this works:


(python36-kLdIL1Ub) ➜  dist git:(mega) --port /dev/ttyUSB0 erase_flash v2.5.1
Serial port /dev/ttyUSB0
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: cf:5c:ac:7f:c6:75
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in 12.9s
Hard resetting via RTS pin...

(python36-kLdIL1Ub) ➜  dist git:(mega)


(python36-kLdIL1Ub) ➜  ESPEasy_mega-20181021 --port /dev/ttyUSB0 write_flash -fm dio 0x00000 ESP_Easy_mega-20181021_normal_ESP8266_4096.bin v2.5.1
Serial port /dev/ttyUSB0
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: cf:5c:ac:7f:c6:75
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 763888 bytes to 495339...
Wrote 763888 bytes (495339 compressed) at 0x00000000 in 43.9 seconds (effective 139.4 kbit/s)...
Hash of data verified.

Hard resetting via RTS pin...
(python36-kLdIL1Ub) ➜  ESPEasy_mega-20181021


Ubuntu 18.04 LTS Bionic Beaver

Use minicom as terminal to connect to the serial port ttyUSB0. Advantage: The terminal windows immediately shows what’s going on while you plug and unplug the usb device.

See also

  • Kjeld Schmidt: ESP 20Attempts @ github

    This sketch starts a local wifi server, which serves a web page with two buttons These buttons can be used to pull a pin high or low, controlling, for example, an LED

Oh these micro usb cables

Some work, some don’t. Why? I don’t know. The only way to find out whether a cable works is to do a test.

For a test I’m starting minicom –device /dev/ttyUSB0 on Ubuntu. It opens a terminal window that complains that /dev/ttyUSB0 isn’t available. When I now connect a device with a working cable the complaint vanishes. When I unplug or use a bad cable the complaint appears again.

In my case these work:


And these do not work:


Can you see the difference? I can’t.




Recent Posts

This Page