EasyManua.ls Logo

Adafruit ESP32-S3 User Manual

Adafruit ESP32-S3
263 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #220 background image
// wait for serial port to connect. Needed for native USB port only
delay(10);
}
#endif
// attempt to connect to Wifi network:
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
#if defined(USE_OLED)
display.clearDisplay(); display.setCursor(0,0);
display.print("Connecting to SSID\n"); display.println(ssid);
display.display();
#endif
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("Connected to WiFi");
#if defined(USE_OLED)
display.print("...OK!");
display.display();
#endif
printWifiStatus();
}
uint32_t bytes = 0;
void loop() {
WiFiClientSecure client;
client.setInsecure(); // don't use a root cert
Serial.println("\nStarting connection to server...");
#if defined(USE_OLED)
display.clearDisplay(); display.setCursor(0,0);
display.print("Connecting to "); display.print(SERVER);
display.display();
#endif
// if you get a connection, report back via serial:
if (client.connect(SERVER, 443)) {
Serial.println("connected to server");
// Make a HTTP request:
client.println("GET " PATH " HTTP/1.1");
client.println("Host: " SERVER);
client.println("Connection: close");
client.println();
}
// Check HTTP status
char status[32] = {0};
client.readBytesUntil('\r', status, sizeof(status));
if (strcmp(status, "HTTP/1.1 200 OK") != 0) {
Serial.print(F("Unexpected response: "));
Serial.println(status);
#if defined(USE_OLED)
display.print("Connection failed, code: "); display.println(status);
display.display();
#endif
return;
}
// wait until we get a double blank line
client.find("\r\n\r\n", 4);
©Adafruit Industries Page 220 of 263

Table of Contents

Question and Answer IconNeed help?

Do you have a question about the Adafruit ESP32-S3 and is the answer not in the manual?

Adafruit ESP32-S3 Specifications

General IconGeneral
Microcontroller/ChipESP32-S3
Clock Speedup to 240 MHz
RAM512 KB
Flash Memory8MB
GPIO Pins45
DAC Channels2
Operating Voltage3.3 V
Input Voltage5 V
I2C2
I2S2
CPUXtensa LX7 dual-core
Wi-Fi802.11 b/g/n
BluetoothBluetooth 5.0

Summary

Overview

Pinouts

Power

Explains the different ways to power the Feather board.

TFT Display

Describes the board's built-in color TFT display.

ESP32-S3 WiFi Module

Details the ESP32-S3 System-on-Chip and its capabilities.

LC709203 Battery Monitor

Explains the battery monitoring chip for LiPoly/LiIon batteries.

BME280 Temperature, Humidity and Pressure Sensor

Describes the sensor for ambient weather sensing.

Logic Pins

Details the general-purpose pins for connecting peripherals.

NeoPixel and Red LED

Explains the onboard addressable RGB NeoPixel and red status LEDs.

STEMMA QT

Details the STEMMA QT connector for I2C devices.

Buttons

Describes the onboard reset and boot buttons.

Debug

Explains the hardware UART debug pin for low-level output.

Low Power Usage

Power Management

Battery + USB Power

Details powering the Feather board using a USB cable or LiPoly battery.

Power Supplies

Discusses available power supply options and pinouts.

Measuring Battery

Explains how to check battery voltage and charge percentage.

ENable pin

Describes using the ENable pin to turn off the 3.3V regulator.

Alternative Power Options

Suggests alternative powering methods and lists what to avoid.

CircuitPython

CircuitPython Quickstart

Provides a step-by-step guide to get CircuitPython running on the board.

Installing the Mu Editor

Download and Install Mu

Explains how to download and install the Mu editor from its website.

Starting Up Mu

Covers the initial setup and mode selection when first launching Mu.

Using Mu

Introduces the main sections of the Mu editor interface.

The CIRCUITPY Drive

Boards Without CIRCUITPY

Discusses alternative file transfer methods for boards without native USB.

Creating and Editing Code

Creating Code

Guides on writing and saving the first CircuitPython program.

Editing Code

Explains how to modify existing code and the importance of saving safely.

Back to Editing Code...

Demonstrates making simple code changes and observing their effects.

Naming Your Program File

Lists the valid filenames CircuitPython looks for to run code.

Exploring Your First CircuitPython Program

Imports & Libraries

Explains the role of import statements for modules and libraries.

Setting Up The LED

Details how to initialize and configure the board's LED.

Loop-de-loops

Explains the concept of `while True` loops for continuous execution.

What Happens When My Code Finishes Running?

Describes board behavior after code execution, including resets.

What if I Don't Have the Loop?

Discusses program exit behavior and the necessity of loops.

Connecting to the Serial Console

Are you using Mu?

Details how to use Mu's built-in serial console and autodetection.

Serial Console Issues or Delays on Linux

Addresses common serial connection issues and troubleshooting on Linux.

Setting Permissions on Linux

Guides on granting necessary permissions for serial console access on Linux.

Using Something Else?

Suggests alternative programs for serial console interaction.

Interacting with the Serial Console

The REPL

Entering the REPL

Details how to access the REPL from the serial console.

Interacting with the REPL

Covers running commands and exploring modules within the REPL.

Returning to the Serial Console

Explains how to exit the REPL and return to the serial console.

CircuitPython Libraries

The Adafruit Learn Guide Project Bundle

Describes using Project Bundles for easy project setup.

The Adafruit CircuitPython Library Bundle

Explains how to download and use the library bundle.

The CircuitPython Community Library Bundle

Covers community-contributed libraries and their usage.

Understanding the Bundle

Details how to extract and organize downloaded library bundles.

Example Files

Explains the purpose and inclusion of example files in bundles.

Copying Libraries to Your Board

Guides on copying libraries and example files to the CIRCUITPY drive.

Understanding Which Libraries to Install

Explains how to determine which libraries are needed based on import statements.

Example: ImportError Due to Missing Library

Demonstrates how to resolve ImportError by installing missing libraries.

Library Install on Non-Express Boards

Provides instructions for installing libraries on specific board types.

Updating CircuitPython Libraries and Examples

Discusses the importance of keeping libraries and examples up-to-date.

CircUp CLI Tool

Introduces CircUp, a command-line tool for managing libraries.

CircuitPython Documentation

CircuitPython Core Documentation

Details the extensive documentation for the CircuitPython core modules.

CircuitPython Library Documentation

Explains how to find and use documentation for individual CircuitPython libraries.

Recommended Editors

Recommended editors

Lists editors that safely write changes and are recommended for CircuitPython.

Recommended only with particular settings or add-ons

Describes editors requiring specific configurations for safe use.

Editors that are NOT recommended

Lists editors that are not recommended due to potential issues.

Advanced Serial Console on Windows

Windows 7 and 8.1

Covers driver installation and OS recommendations for Windows 7/8.1.

Advanced Serial Console on Mac

What's the Port?

Explains how to identify the serial port your board is using on Mac.

Connect with screen

Details using the `screen` command to establish a serial connection.

Advanced Serial Console on Linux

What's the Port?

Explains how to identify the serial port your board is using on Linux.

Connect with screen

Details using the `screen` command to establish a serial connection.

Permissions on Linux

Addresses permission issues for serial port access on Linux.

Frequently Asked Questions

What are some common acronyms to know?

Defines common acronyms used in CircuitPython documentation.

Using Older Versions

Provides guidance on using older versions of CircuitPython and libraries.

Python Arithmetic

Discusses support for floating-point numbers in CircuitPython.

Does CircuitPython support long integers, like regular Python?

Explains support for arbitrary-size integers in CircuitPython.

Wireless Connectivity

Covers connecting to the internet using Wi-Fi with CircuitPython.

How do I connect to the Internet with CircuitPython?

Guides on using ESP32 chipsets for Wi-Fi connectivity.

How do I do BLE (Bluetooth Low Energy) with CircuitPython?

Explains BLE implementation status and capabilities for ESP32 boards.

Are there other ways to communicate by radio with CircuitPython?

Suggests using RFM boards for radio communication.

Asyncio and Interrupts

Discusses asyncio support and the lack of interrupt support.

Is there asyncio support in CircuitPython?

Confirms asyncio support starting from version 7.1.0.

Does CircuitPython support interrupts?

States that CircuitPython does not support interrupts directly.

Status RGB LED

Explains the function of the onboard RGB NeoPixel/DotStar LED.

Memory Issues

Discusses memory errors and how to resolve them.

What is a MemoryError?

Defines MemoryError and its causes.

What do I do when I encounter a MemoryError?

Provides steps to troubleshoot MemoryErrors.

Can the order of my import statements affect memory?

Explains how import order can impact memory fragmentation.

How can I create my own .mpy files?

Guides on creating custom .mpy files using mpy-cross.

How do I check how much memory I have free?

Shows how to check available memory using `gc.mem_free()`.

Unsupported Hardware

Lists hardware that is not supported or has limited support.

Is ESP8266 or ESP32 supported in CircuitPython? Why not?

Explains ESP8266 support changes and ESP32/S2/S3 support.

Does Feather M0 support WINC1500?

Addresses WINC1500 compatibility with Feather M0 boards.

Can AVRs such as ATmega328 or ATmega2560 run CircuitPython?

Confirms that AVR microcontrollers cannot run CircuitPython.

Troubleshooting

Always Run the Latest Version of CircuitPython and Libraries

Emphasizes the importance of using the latest versions for compatibility and support.

I have to continue using CircuitPython 5.x or earlier. Where can I find compatible libraries?

Guides users on finding libraries for older CircuitPython versions.

Bootloader (boardnameBOOT) Drive Not Present

Addresses issues with the BOOT drive not appearing.

MakeCode

Provides specific instructions for Circuit Playground Express using MakeCode.

MacOS

Discusses potential interference from macOS software.

Windows 10

Covers driver issues and recommendations for Windows 10.

Windows 7 or 8.1

Details driver installation requirements for Windows 7/8.1.

Windows Explorer Locks Up When Accessing boardnameBOOT Drive

Identifies third-party programs that can cause Windows Explorer to freeze.

Copying UF2 to boardnameBOOT Drive Hangs at 0% Copied

Addresses issues with copying UF2 files, potentially caused by WD utilities.

CIRCUITPY Drive Does Not Appear or Disappears Quickly

Discusses how antivirus software can affect CIRCUITPY drive visibility.

Device Errors or Problems on Windows

Offers solutions for Windows USB device installation confusion.

Serial Console in Mu Not Displaying Anything

Troubleshoots issues with the serial console panel not showing output.

code.py Restarts Constantly

Explains why code.py might restart and how to disable auto-reload.

CircuitPython RGB Status Light

Details the function and behavior of the onboard status LED.

CircuitPython 7.0.0 and Later

Describes changes to status LED behavior in CircuitPython 7.0.0 and later.

CircuitPython 6.3.0 and earlier

Explains status LED behavior in older CircuitPython versions.

Serial console showing ValueError: Incompatible .mpy file

Addresses errors caused by incompatible .mpy library files.

CIRCUITPY Drive Issues

Discusses problems with saving files or the drive disappearing.

Safe Mode

Explains how to enter safe mode to resolve drive or code issues.

Entering Safe Mode in CircuitPython 7.x and Later

Provides steps to enter safe mode for newer CircuitPython versions.

Entering Safe Mode in CircuitPython 6.x

Provides steps to enter safe mode for older CircuitPython versions.

In Safe Mode

Describes LED behavior when the board is in safe mode.

To erase CIRCUITPY: storage.erase_filesystem()

Explains how to use `storage.erase_filesystem()` to reformat the drive.

Erase CIRCUITPY Without Access to the REPL

Offers methods for erasing CIRCUITPY when REPL access is unavailable.

For the specific boards listed below:

Provides links to specific erase files for various boards.

For SAMD21 non-Express boards that have a UF2 bootloader:

Guides for erasing SAMD21 non-Express boards with UF2 bootloaders.

For SAMD21 non-Express boards that do not have a UF2 bootloader:

Guides for erasing SAMD21 non-Express boards without UF2 bootloaders.

Running Out of File Space on SAMD21 Non-Express Boards

Offers tips for freeing up space on boards with limited storage.

Delete something!

Suggests deleting unused files to free up space.

Use tabs

Discusses using tabs for code indentation to save space.

On MacOS?

Addresses macOS specific issues related to hidden files.

Prevent & Remove MacOS Hidden Files

Provides commands to disable hidden file creation on macOS.

Copy Files on MacOS Without Creating Hidden Files

Explains how to copy files on macOS while avoiding hidden metadata.

Other MacOS Space-Saving Tips

Offers additional methods for saving space on macOS.

Device Locked Up or Boot Looping

Guides on recovering boards stuck in a boot loop.

Welcome to the Community!

Adafruit Discord

Describes Adafruit's Discord server as a hub for support and community.

CircuitPython.org

Points to the official CircuitPython website for downloads and information.

Adafruit GitHub

Explains how to contribute to CircuitPython projects via GitHub.

Adafruit Forums

Recommends Adafruit Forums for support and community interaction.

Read the Docs

Guides users to detailed API and library documentation.

CircuitPython Essentials

Blink

LED Location

Identifies the location of the onboard red LED.

Blinking an LED

Provides code and explanation for making the LED blink.

Digital Input

LED and Button

Locates the onboard LED and button components.

Controlling the LED with a Button

Shows how to use a button press to control the LED.

Analog In

Analog to Digital Converter (ADC)

Describes the ADC's role in converting analog signals to digital values.

Potentiometers

Explains what potentiometers are and how they work as variable resistors.

Hardware

Lists the necessary hardware, like a potentiometer, for the example.

Wire Up the Potentiometer

Provides instructions for wiring a potentiometer as a voltage divider.

Reading Analog Pin Values

Shows how to read raw analog pin values and print them.

Reading Analog Voltage Values

Demonstrates converting raw analog values to human-readable voltage readings.

NeoPixel LED

NeoPixel Location

Identifies the location of the onboard NeoPixel LED.

NeoPixel Color and Brightness

Guides on controlling the NeoPixel's color and brightness.

RGB LED Colors

Explains how RGB colors are represented and combined.

NeoPixel Rainbow

Provides code to create a rainbow color cycle effect with the NeoPixel.

CircuitPython Internet Test

Adafruit IO: Send and Receive Data

NeoPixel Location

Identifies the location of the onboard NeoPixel LED.

Adafruit IO Feeds and Dashboard

Guides on creating feeds and dashboards on Adafruit IO.

Adafruit IO Example Secrets

Explains how to use a secrets.py file for credentials.

Adafruit IO Example Code

Provides the example code for interacting with Adafruit IO.

Code Walkthrough

Explains the structure and logic of the Adafruit IO example code.

I2C

I2C and CircuitPython

Explains how CircuitPython simplifies interaction with I2C devices.

Necessary Hardware

Lists hardware required for I2C examples.

Wiring the MCP9808

Provides wiring instructions for the MCP9808 temperature sensor.

Find Your Sensor

Guides on performing an I2C scan to detect connected devices.

I2C Sensor Data

Shows how to read data from an I2C sensor.

Where's my I2C?

Helps identify I2C pin pairings supported by different microcontrollers.

Storage

The boot.py File

Explains the role of boot.py in managing filesystem write access.

The code.py File

Details the code.py file used for logging temperature data.

Logging the Temperature

Guides on implementing temperature logging to a file.

Recovering a Read-Only Filesystem

Provides methods to recover a filesystem that has become read-only.

Capacitive Touch

One Capacitive Touch Pin

Demonstrates reading touch input from a single pin.

Pin Location

Identifies the location of the touch-capable pin A4.

Reading Touch on the Pin

Shows code for detecting touch on a single pin.

Multiple Capacitive Touch Pins

Demonstrates reading touch input from multiple pins simultaneously.

Pin Location

Identifies the location of touch-capable pins A4 and D12.

Reading Touch on the Pins

Provides code for detecting touches on multiple pins.

The Available Touch-Capable Pins

Lists the available touch-capable pins and their Arduino equivalents.

I2S

I2S and CircuitPython

Explains how CircuitPython simplifies using the I2S interface.

Necessary Hardware

Lists hardware needed for I2S audio examples.

Wiring the MAX98357A

Provides wiring instructions for the MAX98357A amplifier.

I2S Tone Playback

Guides on playing tones using I2S and the audiocore module.

I2S WAV File Playback

Shows how to play WAV files using I2S and audiocore.

CircuitPython I2S-Compatible Pin Combinations

Helps identify pins compatible with I2S audio playback.

Multitasking with asyncio

asyncio Demonstration

Demonstrates basic asyncio usage with NeoPixel rings and a button.

Wiring

Provides wiring instructions for connecting NeoPixel rings and a button.

asyncio Example Code

Presents the example code for the asyncio demonstration.

Code Walkthrough

Explains the code structure, including async def, await, and tasks.

My program ended? What happened?

Discusses why tasks might end and how to ensure continuous execution.

Arduino IDE Setup

Using with Arduino IDE

Blink

Introduces the basic Blink sketch for testing uploads.

Select ESP32-S2/S3 Board in Arduino IDE

Details how to select the correct board in the Arduino IDE.

Launch ESP32-S2/S3 ROM Bootloader

Explains how to manually enter bootloader mode if native USB fails.

Arduino Blink

Pre-Flight Check: Get Arduino IDE & Hardware Set Up

Lists prerequisites for using the Arduino IDE and hardware.

Start up Arduino IDE and Select Board/Port

Guides on launching the IDE and configuring board and port settings.

New Blink Sketch

Instructs on creating and pasting the Blink sketch code.

Verify (Compile) Sketch

Explains the verification (compilation) process and potential errors.

Upload Sketch

Details the process of uploading the compiled sketch to the board.

Native USB and manual bootloading

Discusses native USB functionality and manual bootloading procedures.

Enter Manual Bootload Mode

Provides specific steps to enter manual bootload mode.

Finally, a Blink!

Confirms successful upload and suggests modifying the sketch.

I2C Scan Test

Common I2C Connectivity Issues

Lists common problems and solutions for I2C connectivity.

Perform an I2C scan!

Details the steps to perform an I2C scan using the TestBed library.

Search for TestBed and install the Adafruit TestBed library

Explains how to find and install the necessary Arduino library.

LC709203 Simple Data

Arduino Library Installation

Guides on installing the Adafruit LC709203F library via the Library Manager.

LC709203 Simple Data Example

Presents the Arduino example code for reading battery data.

WiFi Test

WiFi Connection Test

Shows how to connect to a Wi-Fi network and test internet connectivity.

Secure Connection Example

Demonstrates establishing a secure SSL connection, e.g., to Twitter API.

JSON Parsing Demo

Explains how to parse JSON data received from APIs.

Usage with Adafruit IO

Install Libraries

Guides on installing necessary libraries like Adafruit IO Arduino from the Library Manager.

Adafruit IO Setup

Details creating an Adafruit IO account and setting up a dashboard.

Adafruit IO Dashboards

Explains how to create and customize dashboards for data visualization.

Add a toggle button to our dashboard

Guides on adding a toggle button component to control the board's LED.

Display button press data

Shows how to add a gauge block to display button press data.

Code Usage

Explains how to use example code with Adafruit IO credentials.

WipperSnapper Setup

What is WipperSnapper

Introduces WipperSnapper as firmware to turn WiFi boards into IoT devices.

Sign up for Adafruit.io

Instructs on creating an Adafruit IO account for WipperSnapper.

Add a New Device to Adafruit IO

Details adding a new device, like the ESP32-S3 TFT Feather, to Adafruit IO.

Troubleshooting

I don't see my board on Adafruit IO, it is stuck connecting to WiFi

Troubleshoots Wi-Fi connection issues with Adafruit IO.

I don't see my board on Adafruit IO, it is stuck "Registering with Adafruit IO"

Addresses issues with the board getting stuck during registration.

"Uninstalling" WipperSnapper

Explains that WipperSnapper cannot be uninstalled, but rather replaced or restored.

Moving from WipperSnapper to CircuitPython

Moving from WipperSnapper to Arduino

Factory Resetting a WipperSnapper Board

WipperSnapper Usage

Blink a LED

Demonstrates controlling the built-in LED remotely via Adafruit IO.

Read a Push-Button

Guides on reading a push-button state and sending it to Adafruit IO.

Read an I2C Sensor

Shows how to configure and read data from an I2C sensor using WipperSnapper.

Factory Reset

Factory Reset Firmware UF2

Guides on using the UF2 bootloader for factory reset.

Factory Reset and Bootloader Repair

Covers repairing the bootloader if it becomes damaged.

Download .bin and Enter Bootloader

Instructs on downloading the reset file and entering the bootloader.

Step 1. Download the factory-reset-and-bootloader.bin file

Provides the link to download the factory reset firmware file.

Step 2. Enter ROM bootloader mode

Details the button sequence to enter the ROM bootloader.

The WebSerial ESPTool Method

Connect

Guides on connecting the board to the WebSerial ESPTool interface.

Erase the Contents

Details the process of erasing the board's contents.

Program the ESP32-S2/S3

Covers programming the board with the factory reset firmware.

Older Versions of Chrome

Provides instructions for enabling Web Serial on older Chrome versions.

The esptool Method (for advanced users)

Install ESPTool.py

Guides on installing esptool.py using pip.

Test the Installation

Verifies the esptool.py installation.

Connect

Details connecting to the board using esptool.py.

Installing the Bootloader

Covers writing the UF2 bootloader using esptool.py.

Reset the board

Instructs on resetting the board after reprogramming.

The Flash an Arduino Sketch Method

Arduino IDE Setup

Guides on setting up the Arduino IDE and board support packages.

Load the Blink Sketch

Details loading the basic Blink sketch into the Arduino IDE.

Install UF2 Bootloader

Downloads

Files

Lists links to product resources, datasheets, and technical references.

Schematic and Fab Print

Offers access to the board's schematic and fabrication files.

FAQ

The TFT appears to be attached crookedly to the Feather?

Addresses issues with the TFT display being misaligned due to shipping.

Related product manuals