[ESP8266] Alternative to serial monitor: Wifi Manager + ArduinoOTA + Telnet

Arduino IDE serial monitor does not work when sketch is uploaded wirelessly,
maybe this helps a bit, this code is the junction of 3 sample codes:
ArduinoOTA (BasicOTA), WiFiManager (AutoConnectWithFeedback), and ESP8266WiFi (WiFiTelnetToSerial),

Some functions have been added for testing ,
(change the state of the LED and reset the ESP8266)

Tested with NodeMCU V3 Lolin, the LED is on pin number 2, low state makes the LED (blue) light up.
(User Manual V1.2 - ESP8266 NodeMCU WiFi Devkit)

The sketch line of the code that contains the “DEBUG” setting is used to enable or disable the “admin” password to load the sketch, and the password for Telnet is “PassWd0”.

After Telnet logging in, the “led” command toggles the status of the LED, and “reset” will restart ESP8266, as a result, the Telnet connection will be terminated.

You need to use a terminal that connects as a TCP client, to perform the Telnet connection, the program PuTTY.exe and the Hercules SETUP utility worked well.


To make Debug, the Hercules SETUP utility is very useful as it can display the characters in Hexadecimal mode. And you can also keep the tab connected on the serial port and another via TCP Client.

Hercules SETUP utility

<<< ArduinoOTA: You must have Python 2.7 installed >>>
See here: ESP8266 OTA Updates with Arduino IDE | Over the Air
(Note, the current version of python 2.7 is at 2.7.15, see here: Download Python | Python.org)

First upload is done by serial port, then it is done over the wireless network

  • Use the computer and connect to the new Wi-Fi access point, Similar to ESP1475633,
  • Enter the ip address in the browser,
  • Select your router and enter the password,
  • The connection to the ESP8266 will be undone,
  • Connect the computer back to your wifi network
  • You may need to close and reopen the Arduino IDE

Sketch uses 342281 bytes (32%) of program storage space. Maximum is 1044464 bytes.
Global variables use 36492 bytes (44%) of dynamic memory, leaving 45428 bytes for local variables. Maximum is 81920 bytes.

An important consideration for the implementation of Arduino OTA in this case is that the code should not have infinite loops, or with wide time. To circumvent this, instead of using loops with “for” or “while”, for example, use the cycle count, or time comparison with the “millis ()” function.

If the IDE returns error 11, after uploading via serial port, try pressing the reset button manually to enable the OTA function. Error message:

[ERROR]: Bad Answer: ERR: ERROR[11]: Invalid bootstrapping

Source: esp8266/Arduino/issues/3915

Note: I noticed that the sketch upload gets much faster via Arduino OTA than serial port! :wink:

After first upload - WiFi.png

First upload - serial port.png

sketch.ino (8.63 KB)


You may also be interested in esp-link:

The esp-link firmware connects a micro-controller to the internet using an ESP8266 Wifi module. It implements a number of features:

  • transparent bridge between Wifi and serial, useful for debugging or inputting into a uC
  • flash-programming attached Arduino/AVR microcontrollers and LPC800-series and other ARM microcontrollers via Wifi
  • built-in stk500v1 programmer for AVR uC's: program using HTTP upload of hex file
  • outbound REST HTTP requests from the attached micro-controller to the internet
  • MQTT client pub/sub from the attached micro-controller to the internet
  • serve custom web pages containing data that is dynamically pulled from the attached uC and that contain buttons and fields that are transmitted to the attached uC (feature not fully ready yet)

The firmware includes a tiny HTTP server based on esphttpd with a simple web interface, many thanks to Jeroen Domburg for making it available! The REST and MQTT functionality are loosely based on espduino but significantly rewritten and no longer protocol compatible, thanks to tuanpmt for the inspiration!

The following people contributed significant functionality to esp-link: brunnels (espduino integration), cskarai (custom dynamic web pages), beegee-tokyo (lots of code documentation), susisstrolch (syslog feature), bc547 and katast (misc contributions). Esp-link is the work of many contributors!

Note that http://github.com/jeelabs/esp-link is the original esp-link software which has notably been forked by arduino.org as Esp-Link and shipped with the initial Arduino Uno Wifi. The JeeLabs esp-link has evolved significantly since the fork and added cool new features as well as bug fixes.

ESP-LINK: Wifi-Serial Bridge w/REST&MQTT


If the IDE is having difficulty finding the virtual port (IP) of your OTA device:

  • Check your internal network, restart the routers and repeaters

  • Try closing the IDE, restarting the OTA device, and opening the IDE only after the OTA device is online.

You may be able to ping the IP address of the OTA device. Using static IP may make testing easier.