ESP32 Thing Plus Hookup Guide
Introduction
The SparkFun ESP32 Thing Plus and the SparkFun ESP32 Thing Plus U.FL enjoy all the amenities of the ESP32 Thing, but with a few added sparkles. We've lengthened the board just a bit to accommodate a Qwiic connector for all your Qwiic breakout needs. We've also moved a few pins around to make the board compatible with the Adafruit Huzzah32 – ESP32 Feather Board such that you can use all of those lovely shields available out there! The ESP32 Thing plus also integrates a rich set of peripherals, ranging from capacitive touch sensors, SD card interface, Ethernet, high-speed SPI, UART, I2S and I2C.
With Espressif's ESP32 comprehensive development platform, Bluetooth low-energy support (i.e BLE, BT4.0, Bluetooth Smart), and nearly 30 I/O pins, these boards are jam packed with possibilities!
Not Yet Implemented: The Arduino core for the ESP32 microcontroller are still a work in progress. There are a handful of peripherals and features that have yet to be implemented, including:
- Analog Ouptut (
analogWrite([pin], [value])
)- Alternative: LED Control API
- Pulse Counter
- SDIO
Timer/Real-Time Clock- Alternative: ESP32Time Arduino library
- TWAI
The peripherals are available (if, also, still in their infancy) in the IoT Development Framework for the ESP32. If your application requires any of the features above, consider giving the ESP-IDF a try! (Updated: June 2022.)
Required Materials
-
Tested with the ESP32 Thing Plus U.FL:
-
Untested:
WLAN TRIPLE BAND ANTENNA - 150mm
WRL-17095DUAL BAND WLAN / BLUETOOTH ANTENNA - PCB V 200mm
WRL-17341
Much of the ESP32 Thing Plus's functionality can be used by simply powering the board. To do so, you'll need a Micro-B USB Cable. The ESP32 Thing Plus'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.
To avoid voltage spikes that might damage the IC, we recommend soldering a 10Ω resistor in-line. If you have v2.0 of the board [WRL-15663] , this issue has been addressed and you can disregard this message.
As an alternative power source, the ESP32 Thing Plus includes support for single-cell lithium-polymer (LiPo) batteries, which plug into the board's white 2-pin JST connector. LiPos 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 Plus into a 5V USB source.
Should you wish to make use of the board's qwiic functionality, you'll need a qwiic cable:
Tools
To take advantage of the ESP32 Thing Plus's 28 external pins, you will need a soldering iron, solder, and general soldering accessories.
Suggested Reading
It may look intimidating, but the ESP32 Thing Plus -- 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
Serial Communication
What is an Arduino?
Three Quick Tips About Using U.FL
Hardware Overview
Espressif's ESP32 WROOM is a powerful, generic Wi-Fi+BT+BLE MCU module that targets a wide variety of applications. At the core of this module is the ESP32-D0WDQ6 chip which is designed to be both scalable and adaptive. Its laundry list of features include:
- Xtensa® dual-core 32-bit LX6 microprocessor
- Up to 240MHz clock frequency
- 16MB of flash storage
- 520kB internal SRAM
- Integrated 802.11 BGN WiFi transceiver
- Integrated dual-mode Bluetooth (classic and BLE)
- 3.0 to 3.6V operating range
- 21 GPIO
- 8-electrode capacitive touch support
- Hardware accelerated encryption (AES, SHA2, ECC, RSA-4096)
- 2.5 µA deep sleep current
The ESP32 Thing Plus is designed around the ESP32-WROOM module with everything necessary to run and program the microcontroller, plus a few extra goodies to take advantage of the chip's unique features.
Peripherals and I/O
The ESP32 Thing Plus features your standard fare of hardware peripherals including:
- 13 analog to digital converter (ADC) channels
- 3 UARTs (only two are configured by default in the Arduino IDE, one UART is used for bootloading/debug)
- 3 SPI (only one is configured by default in the Arduino IDE)
- 2 I2C (only one is configured by default in the Arduino IDE)
- 2 I2S Audio
- 2 digital-to-analog converter (DAC) channels
- 16 PWM outputs
And, thanks to the chip's pin multiplexing feature, those peripherals can be connected to just about any of the broken out I/O pins. Than 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 to static pins. The graphical datasheet below helps demonstrate where you can find those peripherals (click to embiggen!).
One I2C, two of the UART interfaces, and one of the SPI interfaces can be assigned to any pin your project requires.
Powering the ESP32 Thing Plus
The two main power inputs to the ESP32 Thing Plus 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 up to 500mA.
The 3.3V regulator on the ESP32 Thing Plus 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 pin labeled "3V3". This pin can be used to supply external components.
In addition to USB and battery connectors, the VBAT, and VUSB pins are all broken out to the sides of the board. These pins can be used as an alternative supply input to the Thing Plus. The maximum, allowable voltage input to VUSB is 5.8V, and VBAT should not be connected to anything other than a LiPo battery. Alternatively, if you have a regulated voltage source between 3.0V and 3.6V, the "3V3" line can be used to directly supply the ESP32 and its peripherals.
Assembly Tips
Headers
The ESP32 Thing Plus 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.
What you solder to the ESP32 Thing Plus's I/O pins is completely up to you. The header rows are breadboard-compatible, so you may want to solder male headers in.
Then plug it into the breadboard, hanging the USB and LiPo connectors off the end, and start wiring!
Alternatively, female headers (you may need two separate strips to solder all the pins), right-angle headers, or stranded wire are all good options, depending on your project's needs.
Connecting an Antenna
U.FL connectors are very good but they are a designed to be implemented inside a small embedded application like a laptop. Exposing a U.FL connector to the wild risks it getting damaged.
Be Careful! U.FL connectors are easily damaged. Make sure the connectors are aligned, flush face to face (not at an angle), then press down using a rigid blunt edge such as the edge of a PCB or point of a small flat head screwdriver. For more information, check out our tips and tricks on using a u.FL connector.
Three Quick Tips About Using U.FL
December 28, 2018
Software Setup
Installation for the ESP32 Thing Plus is two-fold. Like the ESP32 Thing, you will want to install the board definitions via the Arduino Boards manager. In addition, you will also need to download and install the latest CP2104 USB Driver. Note, some older versions of the driver (including the version that Windows auto-installs) will cause the auto-reset to fail during upload.
Installing Board Definition
Espressif has added support for the Arduino Boards Manager that includes a slew of great built-in examples. Instructions for installing via the board manager can be found at espressif's arduino-esp32 documentation.
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
If you are familiar with installing boards via the Arduino IDE Boards Manager, the url to add is:
language:c
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
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.
Selecting the Board Definition
Once installed, use the Adafruit ESP32 Feather board in the Arduino Board dropdown.
If you are feeling strong or would like to have more control over your development environment, you can install Espressif’s official ESP32 Arduino core. Installation is covered in our ESP32 Thing Hookup Guide.
Installing the CP2104 USB Driver
You will also need to install the SiLabs CP2104 Driver, which can be found here: USB to UART Bridge VCP Driver
Arduino Example: Blink
With the ESP32 Arduino core installed, you're ready to begin programming. If you haven't already, plug the ESP32 Thing Plus into your computer using a micro-B USB cable.
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
Make sure you have the Adafruit ESP32 Feather board definition selected under your Tools > Board menu.
Then select your ESP32 Thing Plus' serial port under the Tools > Port menu.
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 13 is perfect for this test. Plus, with the ESP32 attached to your computer, this is a good time to test out serial communication. Copy and paste the example sketch below into a fresh Arduino sketch:
language:c
int ledPin = 13;
void setup()
{
pinMode(ledPin, OUTPUT);
Serial.begin(115200);
}
void loop()
{
Serial.println("Hello, world!");
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(ledPin, LOW);
delay(500);
}
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.
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 (http://example.com/) as a client.
language:c
#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 = "example.com";
const int hostPort = 80;
const int BUTTON_PIN = 0;
const int LED_PIN = 13;
void setup()
{
// Initilize hardware:
Serial.begin(115200);
pinMode(BUTTON_PIN, INPUT_PULLUP);
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 ");
Serial.println(hostDomain);
}
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;
printLine();
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
delay(500);
Serial.print(".");
}
Serial.println();
Serial.println("WiFi connected!");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
}
void requestURL(const char * host, uint8_t port)
{
printLine();
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");
return;
}
Serial.println("Connected!");
printLine();
// 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 !");
client.stop();
return;
}
}
// Read all the lines of the reply from server and print them to Serial
while (client.available())
{
String line = client.readStringUntil('\r');
Serial.print(line);
}
Serial.println();
Serial.println("closing connection");
client.stop();
}
void printLine()
{
Serial.println();
for (int i=0; i<30; i++)
Serial.print("-");
Serial.println();
}
Make sure you fill in the networkName
and networkPswd
variables with the name (or SSID) and password of your WiFi network! Once you've done that and uploaded the code, open your serial monitor.
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 example.com. 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 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.
language:c
/*
Based on Neil Kolban example for IDF: https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/tests/BLE%20Tests/SampleWrite.cpp
Ported to Arduino ESP32 by Evandro Copercini
*/
#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>
// See the following for generating UUIDs:
// https://www.uuidgenerator.net/
#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.println("*********");
Serial.print("New value: ");
for (int i = 0; i < value.length(); i++)
Serial.print(value[i]);
Serial.println();
Serial.println("*********");
}
}
};
void setup() {
Serial.begin(115200);
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 =)");
BLEDevice::init("MyESP32");
BLEServer *pServer = BLEDevice::createServer();
BLEService *pService = pServer->createService(SERVICE_UUID);
BLECharacteristic *pCharacteristic = pService->createCharacteristic(
CHARACTERISTIC_UUID,
BLECharacteristic::PROPERTY_READ |
BLECharacteristic::PROPERTY_WRITE
);
pCharacteristic->setCallbacks(new MyCallbacks());
pCharacteristic->setValue("Hello World");
pService->start();
BLEAdvertising *pAdvertising = pServer->getAdvertising();
pAdvertising->start();
}
void loop() {
// put your main code here, to run repeatedly:
delay(2000);
}
Once you have uploaded your code, open a Serial Monitor set at 115200 baud so you can see the message that we will write.
Then open your BLE Scanner app on your phone. You will see multiple options; scroll through these and 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.
The next page will show you communications and options for doing so. Select Write,Read.
Finally, we can choose the option that allows us to write a message. Select Write Value.
Now we can write our message. Make sure you choose Text, write yourself a message, and click the Write button.
So now what? Go have a look at your serial monitor. You should see "New value:" with your message.
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.
Troubleshooting
If you are having trouble uploading from the Arduino IDE, please double check that you are using the latest USB driver for the CP210X Uart IC. If you are using an older driver (or the one that automatically installs with Windows), then this can cause serial upload failures and you may experience the following error message in the debug console of Arduino:
The driver actually controls how the auto-reset circuit works, and so it is necessary to use a version at or above 10.1.3.2130.
If you want to double-check what driver you are currently using, you can open Device Manager and navigate to the properties of your COM port. You should see the following in the "driver" tab of the properties window:
To install the correct driver, please follow the driver installation instructions above.
Resources and Going Further
For more resources related to the ESP32 Thing Plus, check out the links listed here:
- ESP32 Thing Plus GitHub Repo
- ESP32 Thing Plus (U.FL) GitHub Repo
- Datasheets
- Graphical Datasheet (PDF)
- Datasheet (PDF) - ESP32-WROOM-32E with PCB antenna and ESP32-WROOM-32UE with u.FL antenna
- CP2104 USB Drivers
- SFE Product Showcase
Espressif has some great resources built around the ESP32:
- ESP32.com -- Great forums, where you can discuss ESP32 news, get help, or show off your project.
- Espressif ESP32 Resource Page -- A great source for the latest datasheets, reference manuals, and software tools.
- Espressif GitHub Repositories -- Espressif is efforting to be as open-source as possible. Among other things, you'll find repositories for Arduino ESP32 support, SDK's, and even a proof-of-concept NES emulator hosted on their GitHub page.
- 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 esp32.info.
- 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.
For more ESP32 related tutorials, check out the following.
MicroMod ESP32 Processor Board Hookup Guide
SparkFun RTK Surveyor Hookup Guide
Audio Codec Breakout - WM8960 Hookup Guide
If you need some project inspiration, check out some of these IoT-focused projects and get making!
Using Artnet DMX and the ESP32 to Drive Pixels
Using Home Assistant to Expand Your Home Automations
Artemis Development with Arduino
MicroMod Ethernet Function Board - W5500 Hookup Guide
Or check out this related blog post: