ESP32 Thing Hookup Guide

Pages
Contributors: jimblom
Favorited Favorite 23

Arduino Example: Blink

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:

language:c
int ledPin = 5;

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.

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.