Arduino ESP8266 in the Visual Studio IDE

March 2018 - Esp8266 + Silicon Labs CP210 v10x usb driver does not work. It has been reported. Please use v6x which should be available via 'device manager > cp210 > change driver'

Board Manager Package:

Esp8266 Debug Tips (applies only when the tool bar is set to Debug, not Release)

  • To use Serial debug alongisde wifi upload set the "vMicro>Debugger>Local Port" to the COM port for the Serial, set "vMicro>Debugger>Remote Port" to Serial.
  • If you code already uses Serial at a speed other than 115200 then set the LocalSpeed and RemoteSpeed properties to the speed your code uses.
  • If Serial debug is paused in a breakpoint when OTA upload is attempted it might be required to send the char 'c' via the Serial/Debug monitor to force the mcu to continue. It should then detect the waiting OTA request.

NOTE: There is a full OTA code example below.

NOTE: Make sure the Serial Monitor DTR and RTS checkboxes are OFF when using esp8266 devices alongside Serial, otherwise you will find youself pressing the reset button quite often :)

NOTE: December 2016 - WiFi (with OTA) Debug Beta has been released. Update of variables during debug is not yet supported. Uses UDP messaging. Breakpoints and debugging auto-deactivates when a debug session ends. To upload with USB and debug with WiFi set the "Remote Transport" project property to "Udp" and the "Local Port" to the IpAddress. For OTA devices there is no configuration required except to switch the tool bar from "Release" to "Debug". It is also recommended to switch on "vMicro>Debugger>Full Speed".  BETA - Do not use the WiFi debugger with remote devices that can not be manually reset.

Tip: If new hardware is installed outside of visual micro (ie: in the arduino ide) then click 'tools>visual micro>reload toolchains' or restart Visual Micro


SPIFFS File System

To publish a file system to an ESP8266 create a sub folder called "data" below any Arduino project and then click "vMicro>Publish Server Data Files".

note: This feature currently ignores the solution explorer and uploads all files and folders that exist in the "[project]\data" sub folder.

tip: The Board options provide various SPIFFS settings. Read more

Further Information can be found about using the Embedded FileSystems here (SPIFFS/LittleFS).

Serial Exception Reporting

Visual Micro provides flexible options that enable exceptions and stack addresses to be resolve back to source code. A small ! icon apears when an exception is discovered in the serial monitor. Clicking the icon produces clickable error and output reports inside the ide as shown below.




These notes explain how to upload to an Esp over net/wifi instead of usb.

A common error after implementing OTA on an Esp8266 is "Invalid Bootstrapping State". The Esp8266 documentation explains that the board needs to be manually reset after upload with Serial before OTA will work. (tip: In Visual Micro we can toggle the RTS On/Off to cause a reset via usb)

When usb debugging alongisde OTA please set "vMicro>Debugger" > "Local Port" to the local serial/usb port and the "Remote Port" to "Serial"

OTA Option 1 - With auto-discovery

"Apple Bonjor for Windows" must be installed for IP address auto discovery to work. This will automatically look for IP addresses on the local network.

Detailed instructions can be found here OTA Guide

If an upload password has been set in the espcode, a password dialog will appear when OTA begins

OTA configuration is automatic. The image shows two esp boards have been discovered using the Apple Bonjour Service.


OTA Option 2 - Without auto-discovery (optional, does not require Apple Bonjour to be instaleld and running)

Ip addresses can be manually entered into the Visual Micro ports (serial) list when the combo box is in the collapsed state. After entering the Ip address, press the ENTER key to confirm.

mDNS properties such as {network.port} will not be available when an ip address is entered manually (and the address has not been discovered by the Bonjour Service)

Instead of using mDNS a local project "board.txt" file can be added to the project.

The image shows the project's board.txt in the lower editor. Apple Bonjour or IP Auto-Discovery is not required. You can manually enter an ip address and press the ENTER key. 


Visual Micro Pro users can use board.txt in the project folder to provide overrides (instead of using Bonjour)

Board.txt password required example:-

 # local project board.txt overrides

Board.txt password not required example:-

 # local project board.txt overrides


Full working ESP8266 OTA Code Example:-

Tested with Esp OTA code (esp core v2.3.0) :-

#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
bool ota_started;

const char* ssid = "YOUR_ROUTER_SSID";
const char* password = "YOUR_ROUTER_WIFI_PASSWORD";
void setup() 
Serial.println("Connected to wifi");
void loop() 
//Serial.println("Hello world");

void ConnectToWiFi()

Serial.println("Mode set");
WiFi.begin(ssid, password);
Serial.println("Begin complete");
void HandleOTA()
void StartOTAIfRequired()
if (ota_started)
// Port defaults to 8266
// ArduinoOTA.setPort(8266);
// Hostname defaults to esp8266-[ChipID]
//if (ArduinoOTA.getHostname() && ArduinoOTA.getHostname().length())

// No authentication by default
ArduinoOTA.setPassword((const char *)"123");
ArduinoOTA.onStart([]() {
Serial.println("OTA Start");
ArduinoOTA.onEnd([]() {
Serial.println("\nOTA End");
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
Serial.printf("Progress: %u%%\r\n", (progress / (total / 100)));
ArduinoOTA.onError([](ota_error_t error) {
Serial.printf("Error[%u]: ", error);
if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed");
else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed");
else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed");
else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
else if (error == OTA_END_ERROR) Serial.println("End Failed");
ota_started = true;

void PrintWifiStatus() 
// print the SSID of the network you're attached to:
Serial.print("SSID: ");
//using dhcp? wait for ip or ip not set!
if (WiFi.localIP()[0] == 0)
Serial.println("DHCP: Waiting for IP Address ...");
while (WiFi.localIP()[0] == 0)
// print your WiFi shield's IP address:
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");