ESP32 Thing Hookup Guide

Contributors: jimblom
Favorited Favorite 22


The SparkFun ESP32 Thing is a comprehensive development platform for Espressif's ESP32, their super-charged version of the popular ESP8266. Like the 8266, the ESP32 is a WiFi-compatible microcontroller, but to that it adds support for Bluetooth low-energy (i.e BLE, BT4.0, Bluetooth Smart), and nearly 30 I/O pins. The ESP32's power and versatility will help make it the foundation of IoT and connected projects for many years to come.

SparkFun ESP32 Thing

SparkFun ESP32 Thing


The SparkFun ESP32 Thing equips the ESP32 with everything necessary to program, run, and develop on the wonderchip. In addition to the WiFi/BLE SoC, the Thing includes an FTDI FT231x, which converts USB to serial, and allows your computer to program and communicate with the microcontroller. It also features a lithium-polymer (LiPo) battery charger, so your ESP32 project can be truly wireless. Additionally, the board includes a handful of LEDs and buttons to aid in your development.

Covered In This Tutorial

This hookup guide serves as a primer on all things ESP32 Thing. It documents hardware features of the board, including a handful of assembly tips. Then it will delve into firmware development -- including demonstrating how to add ESP32 support to the popular Arduino IDE.

The tutorial is broken up into a handful of sections, which you can navigate through using the menu on the right. Those sections include:

Not Yet Implemented
The Arduino board definitions for the ESP32 are still a work in progress. There are a handful of peripherals and features that have yet to be implemented, including:
* Analog Input (`analogRead([pin])`)
* Analog Ouptut (`analogWrite([pin], [value])`)
* WiFi Server and WiFI UDP
* Real-Time Clock
* Touch-controller interface

These peripherals are available (if, also, still in their infancy) in the IoT Development Framework for the ESP32. If your application requires analog input, RTC, or any of the features above, consider giving the ESP-IDF a try!

Bill of Materials

The ESP32 Thing includes almost everything you'll need to begin using and programming the WiFi/BT SoC. In fact, the only required extra is a Micro-B USB Cable. The ESP32 Thing's USB interface can be used to both power and program the chip. Once you're done programming the chip, a 5V Micro-B USB Wall Adapter can be used to power the board.

USB micro-B Cable - 6 Foot

USB micro-B Cable - 6 Foot

USB Micro-B Cable - 6"

USB Micro-B Cable - 6"


SparkFun Cerberus USB Cable - 6ft


Wall Adapter Power Supply - 5V DC 2A (USB Micro-B)

16 Retired

As an alternative power source, the ESP32 Thing includes support for single-cell lithium-polymer (LiPo) batteries, which plug into the board's white 2-pin JST connector. LiPo's are perfect for projects on-the-go, or those that just need a little extra umph. The board includes a LiPo charger -- the rechargeable batteries can be juiced back up by plugging the Thing into a 5V USB source.

Lithium Ion Battery - 1Ah

Lithium Ion Battery - 1Ah

Lithium Ion Battery - 400mAh

Lithium Ion Battery - 400mAh

Lithium Ion Battery - 2Ah

Lithium Ion Battery - 2Ah

Lithium Ion Battery - 850mAh

Lithium Ion Battery - 850mAh


Finally, to connect the ESP32's 28 I/O pins to external components, you'll need to do some soldering. Soldering tools, including an iron and solder, are a must for any electronics workbench. And either headers or wire are our recommended mate for soldering into the Thing's pins.

Break Away Headers - Straight

Break Away Headers - Straight

Hook-Up Wire - Assortment (Stranded, 22 AWG)

Hook-Up Wire - Assortment (Stranded, 22 AWG)

Solder Lead Free - 100-gram Spool

Solder Lead Free - 100-gram Spool

Soldering Iron - 30W (US, 110V)

Soldering Iron - 30W (US, 110V)


Suggested Reading

It may look intimidating, but the ESP32 Thing -- especially when you take advantage of its Arduino compatibility -- is a perfect IoT foundation for electronics users of all experience levels. There are, however, a few concepts you should be familiar with before venturing further into this tutorial. If any of the concepts below sound foreign to you, consider reading through that tutorial first:

How to Solder: Through-Hole Soldering

This tutorial covers everything you need to know about through-hole soldering.

Serial Communication

Asynchronous serial communication concepts: packets, signal levels, baud rates, UARTs and more!

How to Power a Project

A tutorial to help figure out the power requirements of your project.

What is an Arduino?

What is this 'Arduino' thing anyway? This tutorials dives into what an Arduino is and along with Arduino projects and widgets.

Looking to get hands-on with ESP32?

We've got you covered!

SparkFun ESP32 Thing

SparkFun ESP32 Thing

ESP32 Thing Stackable Header Set

ESP32 Thing Stackable Header Set

SparkFun ESP32 Thing Motion Shield

SparkFun ESP32 Thing Motion Shield

SparkFun ESP32 Thing Power Control Shield

SparkFun ESP32 Thing Power Control Shield


Hardware Overview

Espressif's ESP32 is one of the most unique microcontrollers on the market. Its laundry list of features include:

  • Dual-core Tensilica LX6 microprocessor
  • Up to 240MHz clock frequency
  • 520kB internal SRAM
  • Integrated 802.11 BGN WiFi transceiver
  • Integrated dual-mode Bluetooth (classic and BLE)
  • 2.2 to 3.6V operating range
  • 2.5 µA sleep current under hibernation
  • 32 GPIO
  • 10-electrode capacitive touch support
  • Hardware accelerated encryption (AES, SHA2, ECC, RSA-4096)

The ESP32 Thing is designed to surround the ESP32 with everything necessary to run and program the microcontroller, plus a few extra goodies to take advantage of the chip's unique features.

Annotated top diagram

Peripherals and I/O

The ESP32 features your standard fare of hardware peripherals, including:

And, thanks to the chip's pin multiplexing feature, those peripherals can be connected to just about any of the 28 broken out I/O pins. That means you decide which pins are RX, TX, MISO, MOSI, SCLK, SDA, SCL, etc.

There are, however, a few hardware features -- namely the ADC and DAC -- which are assigned static pins. The graphical reference below helps demonstrate where you can find those peripherals (click to embiggen!).

Graphical datasheet

Click the image for a closer look.

One I2C, two of the UART interfaces, and one of the SPI interfaces can be assigned to any pin your project requires.

Input Only Pins: 34-39

Pins 34, 35, 36, 37, 38 and 39 cannot be configured as outputs, but they can be used as either digital inputs, analog inputs, or for other unique purposes. Also note that they do not have internal pull-up or pull-down resistors, like the other I/O pins.

GPIO pins 36-39 are an integral part of the ultra low noise pre-amplifier for the ADC – they are wired up to 270pF capacitors, which help to configure the sampling time and noise of the pre-amp.

Schematic close up of pins 34-39

From the ESP32 Thing Schematic: GPIO 36-39 are tied together with caps. Those and pins 34 and 35 are input only!

Powering the ESP32 Thing

The two main power inputs to the ESP32 Thing are USB and a single-cell lithium-polymer (LiPo) battery. If both USB and the LiPo are plugged into the board, the onboard charge controller will charge the LiPo battery at a rate of up to 500mA.

The ESP32's operating voltage range is 2.2 to 3.6V. Under normal operation the ESP32 Thing will power the chip at 3.3V. The I/O pins are not 5V-tolerant! If you interface the board with 5V (or higher) components, you'll need to do some level shifting.

The 3.3V regulator on the ESP32 Thing can reliably supply up to 600mA, which should be more than enough overhead for most projects. The ESP32 can pull as much as 250mA during RF transmissions, but we've generally measured it to consume around 150mA -- even while actively transmitting over WiFi. The output of the regulator is also broken out to the sides of the board -- the pins labeled "3V3." These pins can be used to supply external components.

ESP32 power inputs/outputs

In addition to USB and battery connectors, the VBAT, and VUSB pins are all broken out to both sides of the board. These pins can be used as an alternative supply input to the Thing. The maximum, allowable voltage input to VUSB is 6V, and VBAT should not be connected to anything other than a LiPo battery. Alternatively, if you have a regulated voltage source between 2.2V and 3.6V, the "3V3" lines can be used to directly supply the ESP32 and its peripherals.

Assembly Tips

The ESP32 Thing ships without anything soldered into the header pins -- ensuring that you can mold the board to best fit your project. To use the chip's pins you'll need to solder something to the I/O and power rail vias broken out to either side of the board.

New to soldering? Check out our Through-Hole Soldering Tutorial for a quick introduction!

What you solder to the ESP32 Thing's I/O pins is completely up to you. The header rows are breadboard-compatible, so you may want to solder male headers in. (Mildly satisfying: the ESP32 Thing's pair of 20-pin headers means you can get the most out of our 40-pin header strips.)

ESP32 Thing with male headers soldered

Then plug it into the breadboard, hanging the USB and LiPo connectors off the end, and start wiring!

ESP32 Thing breadboard action shot

All those wires and components, and there are still plenty of GPIO left to use!

Alternatively, female headers (you may need two separate strips to solder all 40 pins), right-angle headers, or stranded wire are all good options, depending on your project's needs.

Installing via Arduino IDE Boards Manager

Good news! Espressif has added support for the Arduino Boards Manager and by installing this way, you get the benefit of a slew of great built-in examples. Instructions for installing via the board manager can be found at espressif's arduino-esp32 GitHub.

For more information on installing boards via the Arduino Board Manager, check out the add-ons section of our Installing Arduino IDE tutorial.

Installing Arduino IDE

March 26, 2013

A step-by-step guide to installing and testing the Arduino software on Windows, Mac, and Linux.

If you are familiar with installing boards via the Arduino IDE Boards Manager, the url to add is:

Note: If you have previously installed the ESP32 Arduino Core via the instructions in Install Option 2, we strongly recommend removing the associated folders before installing via the boards manager.

To remove previous arduino core installs for the esp32, start by finding your .../Arduino/hardware folder. This can be located by looking at your Sketchbook location under File > Preferences.

Go to this location in your finder and delete the esp32 folder.

Once you have deleted the esp32 folder, you can then install using the Arduino Boards Manager.

If you have successfully installed the ESP32 core to your Arduino IDE, you should see the following under Tools with the ESP32 Dev Module selected:

Tools menu with Board: ESP32 Dev Module option selected

Installing the ESP32 Arduino Core

For the more advanced or adventurous route, you can skip the Arduino IDE Boards Manager and install the ESP32 Arduino Core. The pair of Tensilica cores in the ESP32 are Xtensa-based – not your standard ARM or AVR. Fortunately, there is still a GNU compiler available for the ESP32, which opens up a world of possible development environment (IDE) set ups! The rest of this section covers setting up the Arduino IDE with ESP32 support.

In abstracting away a lot of the complicated overhead, the Arduino IDE for the ESP32 also eliminates access to some of the SoC's more advanced features. If you'd like to try your hand at setting up a more advanced toolchain for the ESP32, we recommend checking out Espressif's esp-idf GitHub repository. The esp-idf – short for IoT Development Framework – is Espressif's software development kit (SDK) for the ESP32.

Installing the ESP32 Core

Espressif's official ESP32 Arduino core is hosted here on GitHub. They have a fairly simple set of installation directions to help.

Clone or Download the Core

To install the ESP32 board definitions, you'll need download the contents of the esp32-arduino repository, and place them in a "hardware/espressif/esp32" directory in your Arduino sketchbook directory. You can either download those files using the git command line tool, or by downloading them from GitHub.

Alternatively, these files can be installed in your Arduino’s base directory. On Windows, that may be C:/Program Files (x86)/Arduino/hardware and on Mac that may be /Applications/

If you have git, open a terminal, navigate to your Arduino sketchbook, and type:

mkdir hardware
cd hardware
mkdir espressif
cd espressif
git clone esp32

Those commands will make a "hardware" and "espressif" directories, then download the arduino-esp32 GitHub repository into an "esp32" folder.

Example terminal commands

If you don't have git, click here to download the core (or click "Download" > "Download ZIP" on the GitHub page), and unzip it to an espressif/esp32 directory in your Arduino sketchbook.

Windows folder installation

"boards.txt", "platform.txt", and the cores, doc, tools, etc. folders should all live in the esp32 directory.

Install the Xtensa and ESP32 Tools

To compile code for the ESP32, you need the Xtensa GNU compiler collection (GCC) installed on your machine. Windows users can run get.exe, found in the "esp32/tools" folder.

Location of get.exe

Windows users can run "get.exe" to download the ESP32 software tools.

Mac and Linux users should run the tools/ python script to download the tools. Using a terminal, navigate to the esp32/tools folder. Then type:


The "" python script will download the Xtensa GNU tools and the ESP32 software development kit (SDK), and unzip them to the proper location. You should see a few new folders in the "tools" directory, including "sdk" and "xtensa-esp32-elf" once it's done.

With the ESP32 Arduino core installed, you're ready to begin programming. If you haven't already, plug the ESP32 Thing into your computer using a micro-B USB cable.

ESP32 Thing plugged into breadboard

FTDI Drivers

If you've never connected an FTDI device to your computer before, you may need to install drivers for the USB-to-serial converter. Check out our How to Install FTDI Drivers tutorial for help with the installation.

Once the board is plugged in (and drivers installed), it should be assigned a unique port identifier. On Windows machines, this will be something like "COM#", and on Macs or Linux computers it will come in the form of "/dev/tty.usbserial-XXXXXX."

Select the Board and Port

Once the ESP32 Arduino core is installed, you should see an "ESP32 Dev Module" option under your "Tools" > "Board" menu. Select that.

Arduino board select

Then select your ESP32 Thing's serial port under the "Tools" > "Port" menu.

Arduino port select

You can also select the "Upload Speed". 921600 baud -- the fastest selectable rate -- will get the code loaded onto your ESP32 the fastest, but may fail to upload once-in-a-while. (It's still way worth it for the speed increase!)

Loading Blink

To make sure your toolchain and board are properly set up, we'll upload the simplest of sketches -- Blink! The LED attached to GPIO 5 is perfect for this test. Plus, with the ESP32 attached to your computer, it's a good time to test out serial. Copy and paste the example sketch below, into a fresh Arduino sketch:

int ledPin = 5;

void setup()
    pinMode(ledPin, OUTPUT);

void loop()
    Serial.println("Hello, world!");
    digitalWrite(ledPin, HIGH);
    digitalWrite(ledPin, LOW);

With everything setup correctly, upload the code! Once the code finishes transferring, open the serial monitor and set the baud rate to 115200. You should see "Hello, world"'s begin to fly by.

If the blue LED remains dimly lit, it's probably still sitting in the bootloader. After uploading a sketch, you may need to tap the RST button to get your ESP32 Thing to begin running the sketch.

Example serial port output

You may also notice that when the ESP32 boots up it prints out a long sequence of debug messages. These are emitted every time the chip resets -- always at 115200 baud.

Arduino Example: WiFi

The ESP32 Arduino core includes a handful of WiFi examples, which demonstrate everything from scanning for nearby networks to sending data to a client server. You can find the examples under the File > Examples > WiFi menu.

Here's another example using the WiFi library, which demonstrates how to connect to a nearby WiFi network and poll a remote domain ( as a client:

#include <WiFi.h>

// WiFi network name and password:
const char * networkName = "YOUR_NETWORK_HERE";
const char * networkPswd = "YOUR_PASSWORD_HERE";

// Internet domain to request from:
const char * hostDomain = "";
const int hostPort = 80;

const int BUTTON_PIN = 0;
const int LED_PIN = 5;

void setup()
  // Initilize hardware:
  pinMode(LED_PIN, OUTPUT);

  // Connect to the WiFi network (see function below loop)
  connectToWiFi(networkName, networkPswd);

  digitalWrite(LED_PIN, LOW); // LED off
  Serial.print("Press button 0 to connect to ");

void loop()
  if (digitalRead(BUTTON_PIN) == LOW)
  { // Check if button has been pressed
    while (digitalRead(BUTTON_PIN) == LOW)
      ; // Wait for button to be released

    digitalWrite(LED_PIN, HIGH); // Turn on LED
    requestURL(hostDomain, hostPort); // Connect to server
    digitalWrite(LED_PIN, LOW); // Turn off LED

void connectToWiFi(const char * ssid, const char * pwd)
  int ledState = 0;

  Serial.println("Connecting to WiFi network: " + String(ssid));

  WiFi.begin(ssid, pwd);

  while (WiFi.status() != WL_CONNECTED) 
    // Blink LED while we're connecting:
    digitalWrite(LED_PIN, ledState);
    ledState = (ledState + 1) % 2; // Flip ledState

  Serial.println("WiFi connected!");
  Serial.print("IP address: ");

void requestURL(const char * host, uint8_t port)
  Serial.println("Connecting to domain: " + String(host));

  // Use WiFiClient class to create TCP connections
  WiFiClient client;
  if (!client.connect(host, port))
    Serial.println("connection failed");

  // This will send the request to the server
  client.print((String)"GET / HTTP/1.1\r\n" +
               "Host: " + String(host) + "\r\n" +
               "Connection: close\r\n\r\n");
  unsigned long timeout = millis();
  while (client.available() == 0) 
    if (millis() - timeout > 5000) 
      Serial.println(">>> Client Timeout !");

  // Read all the lines of the reply from server and print them to Serial
  while (client.available()) 
    String line = client.readStringUntil('\r');

  Serial.println("closing connection");

void printLine()
  for (int i=0; i<30; i++)

Make sure you fill in the networkName and networkPswd variables with the name (SSID) and password of your WiFi network! Once you've done that and uploaded the code, open your serial monitor.

WiFi example serial terminal output

After your ESP32 connects to the WiFi network, it will wait for you to press the "0" button. Tapping that will cause the ESP32 to make an HTTP request to You should see a string of HTTP headers and HTML similar to the screenshot above.

Arduino Example: ESP32 BLE

Both the board manager install and the ESP32 arduino core install come with Bluetooth examples that range from serial to serial to acting as a simple BLE device to functioning as either a Bluetooth server or client. Here we will briefly go over the BLE_write example that can be found in Files > Examples > ESP32 BLE Arduino. This example allows you to write messages on your phone that can then be read in a serial monitor on your computer.

This example works with a BLE scanner on your phone. A good, basic app is the BLE Scanner for iPhone or Android. Make sure to install the app to follow along with this example.

Compile and upload the following code, or if you wish, open the BLE_write example from the Files > Examples > ESP32 BLE Arduino menu. Make sure you have ESP32 Dev Module as your board and the correct port has been selected.

    Based on Neil Kolban example for IDF:
    Ported to Arduino ESP32 by Evandro Copercini

#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>

// See the following for generating UUIDs:

#define SERVICE_UUID        "4fafc201-1fb5-459e-8fcc-c5c9c331914b"
#define CHARACTERISTIC_UUID "beb5483e-36e1-4688-b7f5-ea07361b26a8"

class MyCallbacks: public BLECharacteristicCallbacks {
    void onWrite(BLECharacteristic *pCharacteristic) {
      std::string value = pCharacteristic->getValue();

      if (value.length() > 0) {
        Serial.print("New value: ");
        for (int i = 0; i < value.length(); i++)


void setup() {

  Serial.println("1- Download and install an BLE scanner app in your phone");
  Serial.println("2- Scan for BLE devices in the app");
  Serial.println("3- Connect to MyESP32");
  Serial.println("4- Go to CUSTOM CHARACTERISTIC in CUSTOM SERVICE and write something");
  Serial.println("5- See the magic =)");

  BLEServer *pServer = BLEDevice::createServer();

  BLEService *pService = pServer->createService(SERVICE_UUID);

  BLECharacteristic *pCharacteristic = pService->createCharacteristic(
                                         BLECharacteristic::PROPERTY_READ |

  pCharacteristic->setCallbacks(new MyCallbacks());

  pCharacteristic->setValue("Hello World");

  BLEAdvertising *pAdvertising = pServer->getAdvertising();

void loop() {
  // put your main code here, to run repeatedly:

Once you have uploaded your code, open a Serial Monitor set at 115200 baud so you can see the message that we will write.

Arduino Serial Monitor ESP32

Then open your BLE Scanner app on your phone. You will see multiple options; scroll through these and connect to MyESP32.

Connect to MyESP32

Now we need to drill down to the communication capability we want. Once you are connected to MyESP32, you will be taken to the following page. Select CUSTOM SERVICE.

Choose Custom Service

The next page will show you communications and options for doing so. Select Write,Read.

Choose Write,Read

Finally, we can choose the option that allows us to write a message. Select Write Value.

Choose Write

Now we can write our message. Make sure you choose Text, write yourself a message, and click the Write button.

Write your message!

So now what? Go have a look at your serial monitor. You should see "New value:" with your message.

Received message on the Serial Monitor

This is just a quick walk through of one of the provided examples. We recommend looking through the rest of the provided samples and playing with the code to see what may work for your application. For more information on Bluetooth technology and how it works, check out our Bluetooth Basics Tutorial.

Using the Arduino Addon

Before we leave you, here are a few tips, tricks, and gotcha's to look out for while you're using the ESP32 Arduino core.

Pin Mapping

The pin number you use for digitalWrite([pin], [value]) or digitalRead([pin]) should match those printed onto the board. You can also reference the graphical datasheet, if the tiny numbers are a strain on the eyes.

Both I2C interfaces are supported by the Wire library. The SDA and SCL pins are assigned, by default, to pins 21 and 22.

I2C SignalESP32 Pin

And the SPI library should support all three possible SPI interfaces. By default, here are the pin mappings for those interfaces:

SPI SignalESP32 Pin

In addition to SPI and I2C, the Arduino core also supports interrupts on any pin with the attachInterrupt() function.

Not Yet Implemented

The Arduino board definitions for the ESP32 are still a work in progress. There are a handful of peripherals and features that have yet to be implemented, including:

  • Analog Input (analogRead([pin]))
  • Analog Ouptut (analogWrite([pin], [value]))
  • WiFi Server and WiFI UDP
  • Real-Time Clock
  • Touch-controller interface

These peripherals are available (if, also, still in their infancy) in the IoT Development Framework for the ESP32. If your application requires analog input, RTC, or any of the features above, consider giving the ESP-IDF a try!

Resources and Going Further

The ESP32 Thing's design is open-source! You can download, view, and modify the Eagle files (PCB design), checkout the schematic, or suggest revisions on the ESP32 Thing GitHub repository.

The ESP32 is still in its infancy, but resources are popping up all over the place for the chip. Check out some of these links for more information, documentation, and examples.

You can also check out these links to go further.

  • ESP-IDF -- IoT Development Framework -- If you want to take your development environment up a step from Arduino, this should be your first step into ESP32 software development. Some notes on the IDF:
    • The IDF is well-documented. Check out the set up guides (for Windows, Mac or Linux) for help getting your environment set up. For help with the API's and data structures, check out
    • There are a handful of example applications, including a BLE Advertising example, which works as a proof-of-concept for the ESP32's Bluetooth support.
    • Use the ESP-IDF project template, once you're ready to start creating applications of your own.
  • Blynk -- Blynk allows you to control IoT development boards with an easily configurable iOS/Android app. And it already supports the ESP32!

For more ESP32 related tutorials, check out the following.

Transparent Graphical OLED Breakout Hookup Guide

The future is here! Our Qwiic Transparent Graphical OLED Breakout allows you to display custom images on a transparent screen using either I2C or SPI connections.

MicroPython Programming Tutorial: Getting Started with the ESP32 Thing

MicroPython is an implementation and subset of the Python 3 programming language that can be used on microcontrollers. This guide will walk you through writing MicroPython programs for the ESP32 Thing development board.

ESP32 Thing Motion Shield Hookup Guide

Getting started with the ESP32 Thing Motion Shield to detect movements using the on-board LSM9DS1 IMU and adding a GPS receiver. Data can be easily logged by adding an microSD card to the slot.

Introduction to MQTT

An introduction to MQTT, one of the main communication protocols used with the Internet of Things (IoT).

If you need some project inspiration, check out some of these IoT-focused projects and get making!

Getting Started with Load Cells

A tutorial defining what a load cell is and how to use one.

LED Cloud-Connected Cloud

Make an RGB colored cloud light! You can also control it from your phone, or hook up to the weather!

Photon Remote Temperature Sensor

Learn how to build your own Internet-connect, solar-powered temperature collection station using the Photon from Particle.

ESP8266 Powered Propane Poofer

Learn how Nick Poole built a WiFi controlled fire-cannon using the ESP8266 Thing Dev Board!

IoT Industrial Scale

What does a baby elephant weigh? How much impact force does a jump have? Answer these questions and more by building your very own IoT industrial scale using the SparkFun OpenScale.

Or check out these related blog posts.