ESP32 (with Arduino)

ESP32 microcontroller

ESP32 is a series of cheap microcontrollers with itegrated WI-Fi and Bluetooth. They run either 160MHZ or 240MHZ and therefore much more capable that the standard Arduino Uno v3.

There are many different actual physical formfactor boards with the chip embedded. It can be quite overwhleming to choose which one to use. In general they all work and what is most confusing is the pin mapping.

Technical differences between Arduino Uno and ESP32

  • The esp32 has two cores and can run concurrent code.

  • The esp32 has multiple pins that can detect capacitance.

  • It has Wi-Fi and Bluetooth.

  • It runs much faster. 16MHZ vs. 160MHz

  • Some of the analog pins only work when wifi is not used.

The ESP32 Mini form factor

This formfactor version of ESP32 is called Wemos D1 ESP32 or MH ET LIVE ESP32DevKIT or ESP32 Mini kit.

One version of the ESP32 board matches the Wemos D1 Mini footprint. This version works with some of the small wemos shields.

The small formfactor and the avaliability of shields makes it a good starting point and we will use this version for the toturials here.

Getting started

For ESP32 to run as an Arduino board we need to install the board definition in the Arduino IDE and we need to install USB serial drivers.


Install Arduino

Download Arduino ide from here -> Download -> Arduino IDE (not Online version).


Add the board to settings

Start Arduino and open the Preferences window (Arduino or Files -> Preferences).

Enter the following line into the Additional Board Manager URLs field:


Install ESP32 Board specifications

Open Boards Manager from Tools > Board menu and install ESP32 platform.

Select your ESP32 board from Tools > Board menu after installation


Choose the board

Open Boards Manager from Tools > Board menu and install ESP32 platform.

Select your ESP32 board from Tools > Board menu after installation



Choose the right port

For Mac OSX / LINUX: It will usually be called something like USBUart (see image).

For Windows: I will usually be the largest port number.

In both cases, the simplest way to find the right port is to unplug the board. Se which ports are available. Then plug-in the board and choose the port that showed up.

If the port does show up then try to restart your computer. Look in your device-manager to see if the driver has been installed and look online for a more recent or alternative driver.

While you are at it, you can also change the upload speed to "921600". It will make the upload significantly quicker.


OPTIONAL: Install USB Serial driver if port does NOT show up

To be able to communicate with the Wemos board you will need to install the Serial drivers. On the following link you can find the latest driver:


Restart your computer - and check step 5 again

For cp2104 use this driver:


Verify that everything is setup properly

When you have gone through the different steps then your Board configuration should look like this:

  • The correct Board

  • The upload speed can be set to 921600

  • The correct port


Upload test code

Copy the code below into the editor

void setup() {



void loop() {




Press the right pointing arrow button in the icon menu.

If everything works the status bar below should say "Done Uploading" as seen on the image.


Show the serial monitor

  1. Press the magnifying glass icon on the rop right corner.

  2. Choose the 9600 Baud in the bottom right corner of the serial prompt.

  3. If everything is right you should see a number incriment with about 1000 every second.


Show the serial plotter

  1. Close the serial monitor. You cannot open the serial plotter while the serial monitor is open.

  2. Open the tools menu and choose serial plotter.

  3. Choose 9600 Baud rate in the bottom right corner of the serial plotter window.

  4. If everything is right you should see a graph of the same numbers incrimenting every second.


Understanding the pin naming convention

The board has two rows of pins on each side. E.g. pin IO25 would be the third pinholde from the top on the the outer row on the right side. The pins with a IO + number can be used as either an input or an output. To read a digital input (e.g. a button) from pin IO25 you would write something like:

void setup() {


pinMode(25, INPUT_PULLUP);


void loop() {

boolean value = digitalRead(25);




Below is the diagram of a button connected to IO25 and ground.


You now have ESP32 running as an Arduino board and you can now use the board in the same ways as you would with a normal Arduino board. As you dig into the details you find that there integrate differences (see below).

Have a look in the files->Examples menu in the ESP32 section. It is filled with eamples of what you can do with the board.

Also, have a look in the Arduino section of the website for how to use input and output.

Also, have look that smart light toturial get started with working with wi-fi and browser based control.

The pin maping of the ESP32 Mini

This is a relatively technical diagram. You will not need this in the beginning but at a later state this will help you to look up the different pins and what they can do. The green boxes indicate the the pin can be used to read analog signals (0v to 3.3v). The pink boxes indicates that the pin can be used as touch sensor.