From ArduinoInfo
Jump to navigation Jump to search

WHAT IS the ESP32?

ESP32 is a series of low-cost, low-power system-on-a-chip micro-controllers designed by Espressif in Shanghai, China. It has integrated Wi-Fi and dual-mode Bluetooth radios. It has many of the capabilities of the Arduino and can be programmed with the Arduino IDE software and so is an easy upgrade path to wireless communications for Arduino users.

The ESP32 supports many peripherals such as: capacitive touch, ADC, DAC, I2C, SPI, UART, I2S, PWM. It is appropriate for Internet of Things Projects and enables Bluetooth communications for Smartphone applications.

See Wikipedia: HERE

Best Overall technical information see: HERE

The Espressif Discussion forum is HERE

AND See: HERE Neil Kolban's excellent (Slightly outdated) book and ESP32 Guide]

Rui Santos has an excellent ESP32 Education / Project series here: 70+ ESP32 Projects, Tutorials and Guides with Arduino IDE

The ESP32 is an upgrade of the earlier ESP8266 and adds a faster dual-core processor and Bluetooth interface. On the left is a block diagram of the many features inside the ESP32.

The ESP32 is usually seen as a metal-cased module (The large silver-colored square in the section below) that is then placed on slightly larger boards with added components. The metal-cased product includes a crystal oscillator, a flash memory chip. capacitors etc. See the UNcased photo at right. The Metal-cased module has been approved by European and FCC testers. This is a major plus: it can be included in other new products without more testing.

Espressif ESP32 Chip Function Block Diagram.svg.png

Espressif ESP-WROOM-32 Wi-Fi & Bluetooth Module.jpg

ESP32 Boards we are testing

YourDuino MakerSpaceESP32

This board is an unusually good place to start with ESP32 especially if you are transitioning from Arduino UNO, Mega etc. It has the same footprint and many of the same connections in the same places as an Arduino UNO. It adds 3-pin connectors for all the Analog and Digital pins, and a 4-pin I2C Bus section. It can be programmed with the Arduino IDE (with ESP32 board support). It contains the same Expressif ESP-VROOM-32 module as most "ESP32 Dev Kit" versions and you use the same "ESP32 Dev Module" selection in the IDE.

BUT: This board LOOKS like an Arduino with the same PC Board size/shape, and same connectors along the top and bottom edges. Take a look: ESP32PlusLabels1-1024.jpg
Notice all the added connectors compared to an Arduino UNO:

  • The 12 Digital I/Os (Arduino marks them as D2 through D13) also come out on 3-pin connectors.
    • The pin sequence is a standard "servo" pattern: G - V - S (Ground, Voltage, Signal).
    • There is a standard COLOR pattern: G=black, V= Red , Yellow = Signal
    • This makes it easy to connect dozens of different devices that use that connector. See Cables and Pins and Stuff
  • There is an "ANALOG" section in the center with 6 Analog Inputs and the same G-V-S connectors.
  • Above the "ANALOG" section is a "BUS I2C" section that has three 4-pin connectors.
    • These can connect to multiple I2C 'I Squared C' devices like LCD Displays, Measurement chips, etc. 4-pin cables make it easy to connect a display, for example.

Here's good information on how to use the pins on this board. (CLICK on the image for a larger version)

And here's a link to a downloadable PDF version including space for your notes. media: ESP32PLUS PinUseage.pdf

ESP32PLUS PinUseage.jpg

Getting started with ESP32 and this board

A typical ESP32 small module like those below has 38 pins sticking downward that you have to find some way to connect to. See (THIS) below. The original Arduino had the rows of female sockets you could stick wires with pins into. You could get started easily. Then a guy in Beijing named Xiao made a "sensor shield" that plugged on top of Arduino so you could just plug 3-pin cables into it. Later derivatives of Arduino were made with the 3-pin connectors fit right on the board like (THIS).

REAL SOON NOW we will have specific examples HERE... Including how to put ESP32 based Internet Of Things (IOT) on the worldwide network.

KS0413 keyestudio ESP32 Core Board

(Both of these boards, below) have 38 pins on 0.1 inch centers) If you Look-Closely-Now you will see the pinouts are the same.

Keyes ESP-32 Module.png

This keyestudio ESP32 core board is a Mini development board based on the ESP-WROOM-32 module. The board has brought out most I/O ports to pin headers of 2.54mm pitch. These provide an easy way of connecting peripherals according to your own needs. When it comes to developing and debugging with the development board, the both side standard pin headers can make your operation more simple and handy. The ESP-WROOM-32 module is the industry's leading integrated WiFi + Bluetooth solution with less than 10 external components. It integrates antenna switch, RF balun, power amplifiers, low noise amplifiers, filters and power management modules. At the same time, it also integrates with TSMC's low-power 40nm technology, so that power performance and RF performance are safe and reliable, easy to expand to a variety of applications.

The Pin Map below shows the functions that can be used on each pin. Many pins can be used for multiple functions. Esp32 DevKit pinmap.png

Technical Details
  • Microcontroller: ESP-WROOM-32 module
  • USB to Serial Port Chip: CP2102-GMR
  • Operating Voltage: DC 5V
  • Operating Current: 80mA (average)
  • Current Supply: 500mA (Minimum)
  • Operating Temperature Range: -40? ~ +85?
  • WiFi mode: Station/SoftAP/SoftAP+Station/P2P
  • WiFi protocol: 802.11 b/g/n/e/i (802.11n, speed up to 150 Mbps
  • WiFi frequency range: 2.4 GHz ~ 2.5 GHz
  • Bluetooth protocol: conform to Bluetooth v4.2 BR/EDR and BLE standards
  • Dimensions: 55mm*26mm*13mm
  • Weight: 9.3g

- "ESP32 Dev Kit V2"

By Espressif, maker of the ESP32 Chips. About $10 Amazon example The large pin-out diagram (Above) shows the connections to the ESP pins, power, ground etc. Note there are two small pushbuttons labelled BOOT and EN


- nodeMCU-32S

By Ai-Thinker. About $12 Amazon ExampleUsually received with firmware called nodeMCU which supports the LUA programming language as well as C++.

Nodemcu esp32.jpg


KEYES ESP-32 Sensor Shield

This provides 3-pin aconnections for all the ESP-32 Vroom pinout. So all the usual 3-pin cables and accessory boards can just plug in. Available HERE



The keyestudio ESP32-IO shield is designed to be compatible with the keyestudio ESP32 Core board. The ESP32-IO shield has brought out all the pins of keyestudio ESP32 Core board to 3-pin connectors. In order to connect other sensors and actuators easily, the ESP32-IO shield connectors also have ground and DC 3.3V voltage.

In order to supply power to the keyestudio ESP32 Core board, the ESP32-IO shield has a power supply circuit. You only need to input DC 7-12V voltage on the black DC jack to power the keyestudio ESP32 Core board. And the ESP32-IO shield also comes with a small On-Off switch, for controlling the power.

Performance Parameters

  • Supply voltage: DC 7-12V (NOT 6-9V as marked)
  • Working current: 60mA
  • Maximum power: 0.3W
  • Operating temperature: -25℃ to +65℃
  • Dimensions: 30mm*20mm
  • Environmental attributes: ROHS



The ESP32 development boards have pins (19 pins each side, 0.1 inch spacing, 1.0 inch spacing between rows). This does not work for typical breadboards, but two breadboards can be used as in the photo on the left. The example here was used for testing many of the example sketches below.

We also have a "Sensor Shield" (above) which ESP32 plugs into and which provides easy-to-use 3-pin connections for sensors and actuators, and onboard 3.3V power supply. See Previous section just above this...


The ESP32 can also be programmed in the Python language using a system named MicroPython. This may be an easier way for people to get started without first using Arduino IDE for coding.

We have a section of this WIKI that shows how to use MicroPython and the "mu editor". See it HERE


Installing "ESP32 Arduino" into the Arduino ISP

You need to start with the latest Arduino IDE software. Go to the download page HERE and scroll to Download the Arduino IDE. In the green box on the right, find your system. For Windows, use Windows Installer unless you have an earlier version and know how to just add the ZIP file. Run the installed Arduino IDE system to make sure it works..

UPDATE UPDATE! Below needs to be updated. For now please refer to the Expressif information (HERE)

Next you will install ESP32 capability into the Arduino environment. This installs board definitions, code libraries and much more, to allow you to program the ESP32 in the familiar Arduino ISP software. This is what we use to write and test the example sketches below. Here are the steps:

[1] At the top menu bar go to File and then Preferences. In the lower part of the screen you will see something like this:


(I already had an entry for ESP8266, which you see here) But notice the square icon at far right. Click It

Now you will get a pop-up that looks like this:


Add a line in the box (you can cut/paste) : then click OK and back at Preferences again click OK

You have told the Arduino IDE where to find the ESP32 information. Now you need to actually get it downloaded and installed. This will take quite a while, once you start.

[2] Have the Boards Manager get the ESP32 information and install it. At the top menu bar go to Tools then Board then Boards Manager You'll see a screen like this:


In the field "Filter Your Search" enter ESP32

Now you should see the esp32 by Espressif Systems entry like this:


Move you mouse down into it, and at the lower right click on Install. (Mine shows it already installed in the photo)..

NOW watch the status bar at the lower edge of the box. Get coffee or Other: It will take quite a while.


You probably do not have the USB drivers installed to support the CP2012 USB interface chip on your ESP32. Here's what to do:


Look-Closely-Now at the small square USB interface chip next to the USB connector on your ESP32. (I need reading glasses!). It is probably a CP2102 like this:

Get and Install the Drivers: HERE: You need to pick the version for your version of Windows. For WIN7 pick the first (default) entry.

Put the downloaded ZIP file in a new folder. UNZIP it there. Now there are two possibilities:

[1] You plug your ESP32 into a USB connection and Windows prompts you to install a driver

1. Use the dialog to browse for the driver location

2. Locate the driver folder (that you previously unzipped)

3. Follow the instructions

[2] Manual Install

1. Using Windows File Explorer, locate the driver folder (that you previously unzipped)

2. Determine if you have 32-bit or 64-bit Windows

3. Double click to run the .exe file named CP210xVCPInstaller_xnn.exe (where xnn is x64 for 64-bit and x86 is for 32-bit)

4. Follow the instructions

That was not a lot of fun. But NOW the fun begins!

ESP32 Details

Micro-USB jack: The micro USB jack is used to connect the ESP32 to our computer through a USB cable. It is used to program the ESP module as well as can be used for serial debugging as it supports serial communication

EN Button: The EN button is the reset button of the ESP module. Pressing this button will reset the code running on the ESP module

Boot Button: This button is used to upload the Program from Arduino to the ESP module. It has to be pressed after clicking on the upload icon on the Arduino IDE. When the Boot button is pressed along with the EN button, ESP enters into firmware uploading mode. Do not play with this mode unless you know what you are doing.

Red LED: The Red LED on the board is used to indicate the power supply. It glows red when the board is powered.

Blue LED: On some (Not all) boards a Blue LED on the board is connected to the GPIO2 pin. It can be turned on or off through programming. In some Chinese cloned boards like mine, this led might also be in red color.

I/O pins: This is where major development has taken place. Unlike ESP8266, on ESP32 we can access all the I/O pins of the module through the break-out pins. These pins are capable of Digital Read/Write, Analog Read/Write, PWM, IIC, SPI, DAC and much more.


You need a "Micro-USB" cable to run your ESP32. Make SURE it is a real USB data cable, not a charger-only cable. (I got burned-and-confused with that!)

If you do not use a breadboard at this point, make sure the ESP32 will be on a non-conductive surface, like a magazine. Like MAKE, or The New Yorker, or Vermont Life, or any of those dumb catalogs that clog up your mailbox... Anyway, Plug the USB cable into your ESP32 and then into your computer's USB port.

A Red LED should light up on your ESP32. That shows it is getting 5 Volt power over USB (An onboard regulator will provide 3.3V for the ESP32 chips).

Now: Start the Arduino IDE and let's get things set up:

[1] Select your particular ESP32 board in the Arduino IDE. Click Tools then Board and you should see something like this:


Select your board in the pulldown on the right. (You may have to scroll that section down).

[2] Select your PORT. Click Tools then Port: . You should see a new COM port, labelled COM4 or something. Select it. (Mine shows an Arduino also connected). SelectPort.jpg
[3] Open a New sketch: (Highlight and remove any template lines so you have a blank sketch page).

[4] In the section below "ESP32 EXAMPLE SKETCHES" click on YourESP32 Sketch WIFI Scan . Copy and paste it into your blank IDE page.

[5] At the top, click the button labelled Verify At the bottom green area you should see: Compiling.jpg
After several seconds (or longer for the first compile) you should see: DoneCompiling.jpg
IF that's OK, now Upload your sketch! Click the Upload button: Upload.jpg
After several seconds you should see a "Connecting" message:


If all goes well, in a few seconds you show see this message:


PROBLEM?? You see "A fatal error occurred: “Failed to connect to ESP32: Timed out… Connecting…”

When you try to upload a new sketch to your ESP32 and it fails to connect to your board, it means that your ESP32 is not in flashing/uploading mode.

Make sure you have the right board name and COM port selected. THEN: • Hold-down the “BOOT” button in your ESP32 board • Press the “Upload” button in the Arduino IDE to upload a new sketch • After you see the “Connecting….” message in your Arduino IDE, release the finger from the “BOOT” button: • After that, you should see the “Done uploading” message

NOTE: The "YourDuino MakerSpaceESP32" (Arduino-shaped) board does this automatically.

After uploading a new sketch, you may need to press the “ENABLE” button to restart the ESP32 and run the new uploaded sketch.

See the sketch work:

The Scan Wifi sketch tells your ESP32 to activate it's WiFi radio and scan for any WiFi networks it can find. You will see the results on the Serial Monitor. At the upper right of the Arduino IDE screen you will see this: SerMonitor.jpg CLICK IT
A separate window will open. Look at the lower right and you will see a place to set the Baud Rate (Speed). Set it to 115200 as shown. SerMonitorBaud.jpg

NOW you should see data scrolling by on the Serial Monitor screen. In my log cabin in Vermont all it found was my local WiFi Router:


And... That's All For Tonight!!


NOTE: Find all sketches with SEARCH on upper right. Search on "YourESP32 Sketch"

YourESP32 Sketch WIFI Scan

YourESP32 Sketch SimpleBLINK

YourESP32 Sketch NodeMCU32S SimpleBLINK This is specific to the nodeMCU-32S module with built-in LED

YourESP32 Sketch Template TouchSensitivityTest

YourESP32 Sketch TouchSensitiveLED

YourESP32 Sketch 2LEDS PWM Opposite

YourESP32 Sketch AnalogInput

YourESP32 Sketch HallEffectSensor




Rui Santos has a great page on this!! (CLICK)

Also see his excellent Books and classes on ESP-32.

ESP32 Memory Size Questions

(From compiling bare sketch with only setup and loop)

Sketch uses 173740 bytes (13%) of program storage space. Maximum is 1310720 bytes.

Global variables use 13272 bytes (4%) of dynamic memory, leaving 314408 bytes for local variables. Maximum is 327680 bytes.

ESP32 Reference Publications

Neil Kolban's excellent book and ESP32 Guide

ESP32 Projects

Internet Of Things with ESP32

Rui Santos has an excellent ESP32 Education / Project series here:

160+ ESP32 Projects, Tutorials and Guides with Arduino IDE

[Also some ESP32 examples here on DroneBotWorkshop



Located HERE

The EXPRESSIF Online Forums are HERE


The following table shows what pins are best to use as inputs or outputs and which ones you need to be cautious of because they have other uses or actions. The pins labelled OK are OK to use for digital Input or Output, and for the other functions they are labelled for such as PWM, Analog In or Out etc.

There is a PDF file available with this diagram and columns for you to note what your project will be using pins for. It's Media:ESP32-RecommendedPinsYourProject.pdf HERE ESP32PinUsage.jpg