Page 3
Entering the REPL • Interacting with the REPL • Returning to the Serial Console CircuitPython Libraries • The Adafruit Learn Guide Project Bundle • The Adafruit CircuitPython Library Bundle • Downloading the Adafruit CircuitPython Library Bundle • The CircuitPython Community Library Bundle •...
Page 4
• Copy Files on MacOS Without Creating Hidden Files • Other MacOS Space-Saving Tips • Device Locked Up or Boot Looping Welcome to the Community! • Adafruit Discord • CircuitPython.org • Adafruit GitHub • Adafruit Forums • Read the Docs...
Page 5
• MAX17048 Simple Data Example I2C: On-Board Sensors • Sensor Location • BME280 and LC709203 Simple Data Example • BME280 and LC709203 Adafruit IO Example • Adafruit IO Example Secrets • Adafruit IO Example Code • Customisation • Code Walk-Through CircuitPython Internet Test •...
Page 7
• Adafruit IO Setup • Code Usage WipperSnapper Setup • What is WipperSnapper • Sign up for Adafruit.io • Add a New Device to Adafruit IO • Feedback • Troubleshooting • "Uninstalling" WipperSnapper WipperSnapper Usage • Blink a LED •...
Page 8
Going Further Monitor Battery (LC709203F) • Where is the Battery Monitor on my Feather? • Powering the Feather with a Battery • Add Battery Monitor Component to Adafruit IO • Going Further Factory Reset • Factory Reset Firmware UF2 •...
Page 9
Espressif WiFi microcontroller and lots of Flash and RAM memory for your next IoT project? What will make your next IoT project sensor project flyyyyy? That's right - it's the new Adafruit ESP32-S2 Feather and Adafruit ESP32-S2 Feather with BME280! With native USB and 4 MB flash + 2 MB of PSRAM, these boards are perfect for use with CircuitPython or Arduino with low-cost WiFi.
Page 14
(this includes two OTA option spots as well) and a 1MB section for CircuitPython scripts and files. Battery Monitor Depending on when you purchased your ESP32-S2 Feather, you may have either the LC709203 or MAX17048 battery monitor onboard. Check the back silkscreen of your Feather to see which one you have.
Page 15
LC709203 to the MAX17048. Check the back silkscreen of your Feather to see which chip you have. LC709203 Battery Monitor The Adafruit LC709203F LiPoly / LiIon Fuel Gauge and Battery Monitor reports the voltage and charge percent over I2C. Connect it to your Lipoly or LiIon battery ()
Page 17
The version of the Feather ESP32-S2 without the BME280 has an unpopulated header in the center where the sensor would go. The BME280 is only available on the Adafruit ESP32-S2 Feather with BME280 Sensor! If you purchased the version without the BME280, your board will not have one.
Page 23
LiPoly connected as a 'backup' power that will only get used when USB power is lost. The JST connector polarity is matched to Adafruit LiPoly batteries. Using wrong polarity batteries can destroy your Feather. Many customers try to save money...
Page 25
In Arduino, you can measure the battery voltage using the following script. // SPDX-FileCopyrightText: 2023 Liz Clark for Adafruit Industries // SPDX-License-Identifier: MIT // Adafruit Battery Monitor Demo // Checks for MAX17048 or LC709203F #include <Wire.h> #include "Adafruit_MAX1704X.h" #include "Adafruit_LC709203F.h"...
Page 26
Serial.println(" V"); Serial.print(F("Batt Percent: ")); Serial.print(maxlipo.cellPercent(), 1); Serial.println(" %"); Serial.println(); For CircuitPython, you can measure it like this. # SPDX-FileCopyrightText: Copyright (c) 2023 Kattni Rembor for Adafruit Industries # SPDX-License-Identifier: Unlicense import time import board from adafruit_max1704x import MAX17048 from adafruit_lc709203f import LC709203F, PackSize i2c = board.I2C()
Page 32
The Adafruit ESP32-S2 Feather ships with a UF2 bootloader which allows the board to show up as FTHRS2BOOT when you double-tap the reset button, and enables you to drag and drop UF2 files to update the firmware. On ESP32-S2/S3, there is no bootloader protection for the UF2 bootloader. That means it is possible to erase or damage the UF2 bootloader, especially if you upload an Arduino sketch to an ESP32-S2/S3 board that doesn't "know"...
Page 36
This section covers how to create and edit your first CircuitPython program. To create and edit code, all you'll need is an editor. There are many options. Adafruit strongly recommends using Mu! It's designed for CircuitPython, and it's really simple and easy to use, with a built in serial console! If you don't or can't use Mu, there are a number of other editors that work quite well.
Page 53
You can return to the REPL at any time! CircuitPython Libraries As CircuitPython development continues and there are new releases, Adafruit will stop supporting older releases. Visit https://circuitpython.org/downloads to download the latest version of CircuitPython for your board. You must download the CircuitPython Library Bundle that matches your version of CircuitPython.
Page 54
The Adafruit Learn Guide Project Bundle The quickest and easiest way to get going with a project from the Adafruit Learn System is by utilising the Project Bundle. Most guides now have a Download Project Bundle button available at the top of the full code example embed. This button downloads all the necessary files, including images, etc., to get the guide project up...
Page 56
Library Bundle. The bundle contains all the files needed to use each library. Downloading the Adafruit CircuitPython Library Bundle You can download the latest Adafruit CircuitPython Library Bundle release by clicking the button below. The libraries are being constantly updated and improved, so you'll always want to download the latest bundle. ...
Page 57
CircuitPython community. These libraries are often written when community members encountered hardware not supported in the Adafruit Bundle, or to support a personal project. The authors all chose to submit these libraries to the Community Bundle make them available to the community.
Page 65
The fourth and final section is About the Project. It includes further information including details on building, testing, and debugging CircuitPython, along with various other useful links including the Adafruit Community Code of Conduct. Whether you're a seasoned pro or new to electronics and programming, you'll find a...
Page 66
CircuitPython Library Documentation The Adafruit CircuitPython libraries are documented in a very similar fashion. Each library has its own page on Read the Docs. There is a comprehensive list available e (). Otherwise, to view the documentation for a specific library, you can visit the GitHub repository for the library, and find the link in the README.
Page 69
You may be interested in something a little more practical. Here is an example. To use the LED Animation library Comet animation, you would run the following example. # SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries # SPDX-License-Identifier: MIT """...
Page 71
This section is the same for every library. It includes a list of links to external sites, which you can visit for more information about the CircuitPython Project and Adafruit. That covers the CircuitPython library documentation! When you are ready to go...
Page 82
Circuit Playground Bluefruit () Using Older Versions As CircuitPython development continues and there are new releases, Adafruit will stop supporting older releases. Visit https://circuitpython.org/downloads to download the latest version of CircuitPython for your board. You must download the CircuitPython Library Bundle that matches your version of CircuitPython.
Page 83
Boards without long integer support are mostly SAMD21 ("M0") boards without an external flash chip, such as the Adafruit Gemma M0, Trinket M0, QT Py M0, and the Trinkey series. There are also a number of third-party boards in this category.
Page 84
MacroPad or NeoTrellis do not have enough available pins to add the hardware support. For further project examples, and guides about using AirLift with specific hardware, check out the Adafruit Learn System (). How do I do BLE (Bluetooth Low Energy) with CircuitPython? The nRF52840 and nRF52833 boards have the most complete BLE implementation.
Page 85
Are there other ways to communicate by radio with CircuitPython? Check out Adafruit's RFM boards ()for simple radio communication supported by CircuitPython, which can be used over distances of 100m to over a km, depending on the version. The RFM SAMD21 M0 boards can be used, but they were not designed for CircuitPython, and have limited RAM and flash space;...
Page 87
Issues list on github (). Adafruit considers CircuitPython for the ESP32-S2 to be beta quality software. I2C at 100 kHz bus frequency runs slowly The default I2C bus clock speed is 100 kHz (100000) . At that rate, the ESP32-S2 will leave 10ms ()
Page 89
I have to continue using CircuitPython 5.x or earlier. Where can I find compatible libraries? Adafruit is no longer building or supporting the CircuitPython 5.x or earlier library bundles. You are highly encourged to update CircuitPython to the latest version ()
Page 90
Windows 10 Did you install the Adafruit Windows Drivers package by mistake, or did you upgrade to Windows 10 with the driver package installed? You don't need to install this package on Windows 10 for most Adafruit boards. The old version (v1.5) can interfere with recognizing your device.
Page 91
Let us know in the Adafruit support forums () or on the Adafruit Discord () if this does not work for you! Windows Explorer Locks Up When Accessing boardnameBOOT Drive On Windows, several third-party programs that can cause issues. The symptom is that you try to access the boardnameBOOT drive, and Windows or Windows Explorer...
Page 104
Finder because it will still create these hidden extended attribute files in some cases (for files downloaded from the internet, like Adafruit's modules). To copy a file or folder use the -X option for the cp command in a terminal. For example to copy a file_name.mpy file to the board use a command like:...
Page 108
The Adafruit Discord server is the best place to start. Discord is where the community comes together to volunteer and provide live support of all kinds. From general discussion to detailed problem solving, and everything in between, Discord is a digital maker space with makers from around the world.
Page 109
CircuitPython.org Beyond the Adafruit Learn System, which you are viewing right now, the best place to find information about CircuitPython is circuitpython.org (). Everything you need to get started with your new microcontroller and beyond is available. You can do things like download CircuitPython for your microcontroller ()
Page 110
GitHub pull requests, or PRs, are opened when folks have added something to an Adafruit CircuitPython library GitHub repo, and are asking for Adafruit to add, or merge, their changes into the main library code. For PRs to be merged, they must first be reviewed.
Page 113
Adafruit GitHub Whether you're just beginning or are life-long programmer who would like to contribute, there are ways for everyone to be a part of the CircuitPython project. The CircuitPython core is written in C. The libraries are written in Python. GitHub is the...
Page 114
You need an Adafruit account to post to the forums. You can use the same account you use to order from Adafruit.
Page 117
(ha!). This plug-n-play pot comes with a JST-PH 2mm connector and a matching https://www.adafruit.com/product/4493 Adafruit MCP9808 High Accuracy I2C Temperature Sensor Breakout The MCP9808 digital temperature sensor is one of the more accurate/precise we've ever seen, with a typical accuracy of ±0.25°C over the sensor's -40°C to...
Page 118
CircuitPython you're using and copy the contents of that directory to your CIRCUITPY drive. Your CIRCUITPY drive should now look similar to the following image: # SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries # SPDX-License-Identifier: MIT """CircuitPython Blink Example - the CircuitPython 'Hello, World!'"""...
Page 120
CircuitPython you're using and copy the contents of that directory to your CIRCUITPY drive. Your CIRCUITPY drive should now look similar to the following image: # SPDX-FileCopyrightText: 2022 Kattni Rembor for Adafruit Industries # SPDX-License-Identifier: MIT """...
Page 126
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries # SPDX-License-Identifier: MIT """CircuitPython analog pin value example""" import time import board import analogio analog_pin = analogio.AnalogIn(board.A0) while True: print(analog_pin.value) time.sleep(0.1) Now, rotate the potentiometer to see the values change. What do these values mean? In CircuitPython ADC values are put into the range of 16- bit unsigned values.
Page 127
CIRCUITPY drive. Your CIRCUITPY drive should now look similar to the following image: # SPDX-FileCopyrightText: 2022 Kattni Rembor for Adafruit Industries # SPDX-License-Identifier: MIT """CircuitPython Analog In Voltage Example for ESP32-S2"""...
Page 128
CircuitPython code. A NeoPixel is what Adafruit calls the WS281x family of addressable RGB LEDs. It contains three LEDs - a red one, a green one and a blue one - along side a driver chip in a tiny package controlled by a single pin.
Page 132
CircuitPython you're using and copy the contents of that directory to your CIRCUITPY drive. Your CIRCUITPY drive should now look similar to the following image: # SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries # SPDX-License-Identifier: MIT """CircuitPython status NeoPixel rainbow example."""...
Page 134
(GPIO 7) to an OUTPUT and the opposite of the 'rest state' before accessing the I2C port If you are using 7.2.4 or higher version of CircuitPython for the ESP32-S2 Feather, the I2C port will be automatically activated/powered properly on boot, whether...
Page 135
This means you can have many different sensors and devices all connected to the same two pins. Both I2C connections require pull-up resistors, and most Adafruit I2C sensors and breakouts have pull-up resistors built in. If you're using one that does not, you'll need to add your own 2.2-10kΩ...
Page 136
Necessary Hardware You'll need the following additional hardware to complete the examples on this page. Adafruit MCP9808 High Accuracy I2C Temperature Sensor Breakout The MCP9808 digital temperature sensor is one of the more accurate/precise we've ever seen, with a typical accuracy of ±0.25°C over the sensor's -40°C to...
Page 137
Extract the contents of the zip file, find your CircuitPython version, and copy the matching code.py file to your CIRCUITPY drive. Your CIRCUITPY drive should now look similar to the following image: # SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries # SPDX-License-Identifier: MIT """CircuitPython I2C Device Address Scan"""...
Page 139
CircuitPython version, and copy the matching entire lib folder and code.py file to your CIRCUITPY drive. Your CIRCUITPY drive should now look similar to the following image: # SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries # SPDX-License-Identifier: MIT """CircuitPython I2C MCP9808 Temperature Sensor Example"""...
Page 140
For the ESP32-S2 Feather, you'll need to change the I2C setup to the commented out setup included in the code above. The ESP32-S2 Feather STEMMA QT connector is available on board.STEMMA_I2C() Comment out the current setup line, and uncomment the the ...
Page 141
# SPDX-FileCopyrightText: 2021-2023 Kattni Rembor for Adafruit Industries # SPDX-License-Identifier: MIT """CircuitPython I2C possible pin-pair identifying script""" import board import busio from microcontroller import Pin def is_hardware_i2c(scl, sda): try: p = busio.I2C(scl, sda) p.deinit() return True except ValueError: return False...
Page 142
The LC709203 is available over I2C. The LC709203 comes with its own Adafruit CircuitPython library that makes it simple to write code to read data from it. This example will be using, among other things, the Adafruit CircuitPython LC709203F ()
Page 144
For more details, check out the guide for the LC709203 (). MAX17048 Battery Monitor If you purchased your ESP32-S2 Feather before June 14, 2023 then your board may not have the MAX17048 battery monitor. Check the back silkscreen to see which chip is on your Feather.
Page 147
The second example takes the sensor data and sends it to Adafruit IO. It is designed to run on battery power and utilises deep sleep to keep the board cool for temperature readings.
Page 148
CIRCUITPY drive. Your CIRCUITPY/lib folder should contain the following folder and file: • adafruit_bme280/ • adafruit_lc709203f.mpy # SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries # SPDX-License-Identifier: Unlicense """ CircuitPython Simple Example for BME280 and LC709203 Sensors """ import time...
Page 149
BME280 and LC709203 Adafruit IO Example Adafruit IO gives you the option to disconnect the Feather ESP32-S2 from your computer and run it off of USB power or a battery, and still be able to see the data. This example takes the same data printed to the serial console in the example above, and also sends it to Adafruit IO.
Page 150
"aio_key": "your-super-long-aio-key", Adafruit IO Example Code To run this example, you need to first install the BME280, LC709203F, Adafruit IO, and Adafruit Requests libraries into the lib folder on your CIRCUITPY drive. Then you need to update code.py with the example script.
Page 151
ImportError: print("WiFi and Adafruit IO credentials are kept in secrets.py, please add them there!") raise # Duration of sleep in seconds. Default is 600 seconds (10 minutes). # Feather will sleep for this duration between sensor readings / sending data to...
Page 152
# Turn off the LED to indicate data sending is complete. led.value = False # Adafruit IO can fail with multiple errors depending on the situation, so this except is broad. except Exception as e: # pylint: disable=broad-except...
Page 153
Then, you setup the hardware. The red LED is used to visually indicate when data is being sent to Adafruit IO. The I2C power pin is enabled and pulled low. The BME280 and the LC708203 are both setup using I2C. And finally, the battery pack size is set.
Page 154
The first function creates an alarm that will trigger after a number of seconds, and then tells the board to sleep until the alarm is triggered. The second function sets up an Adafruit IO feed by first trying to get the feed, and if it does not exist, creating the feed on Adafruit IO.
Page 155
Adafruit IO. The LED is then turned off to indicate sending data is completed. Finally, the code tells the board to go to sleep for the sleep duration specified at the beginning of your code.
Page 157
# This is where you store the credentials necessary for your code. # The associated demo only requires WiFi, but you can include any # credentials here, such as Adafruit IO username and key, etc. WIFI_SSID = "your-wifi-ssid" WIFI_PASSWORD = "your-wifi-password"...
Page 160
NeoPixel colors. This example shows how to both send data to and receive data from Adafruit IO. It pulls from a "random" number generator and sends the "random" number to Adafruit IO, while simultaneously listening for NeoPixel color data from Adafruit IO.
Page 162
The dashboard should look something like the following. Now that things are set up on the Adafruit IO end, you can continue on to the code on your microcontroller! Adafruit IO settings.toml This example requires you to provide your Wi-Fi credentials, and your Adafruit IO username and key.
Page 163
Adafruit IO Example Code To run this example, you need to first install the NeoPixel, Adafruit IO, and Adafruit MiniMQTT libraries into the lib folder on your CIRCUITPY drive. Then you need to update code.py with the example script.
Page 164
Adafruit IO...") io.connect() # Explicitly pump the message loop. io.loop() # Obtain the "random" value, print it and publish it to Adafruit IO every 10 seconds. if (time.monotonic() - timestamp) >= 10: random_number = "{}".format(randint(0, 255)) print("Current 'random' number: {}".format(random_number)) io.publish("random", random_number)
Page 165
NeoPixel Color Change To change the color of the NeoPixel, go to the NeoPixel Adafruit IO dashboard you created at the beginning, and click on the colored circle in the ColorPicker block. It will bring up the following.
Page 166
These are included where the except code is likely to fail due to WiFi or Adafruit IO connection failures. WiFi can be finicky, and without these code blocks, if the connection was lost, the code would crash. Instead, it is designed to reset the board and start the code over again to reestablish the connection, regardless of the cause.
Page 167
Following that are two callback methods. For more details, check out this guide (). The method subscribes to the neopixel feed on Adafruit IO. The connected message callback checks for updates to the neopixel feed, and turns the pixel the color from the feed.
Page 168
'random' number: {}".format(random_number)) io.publish("random", random_number) timestamp = time.monotonic() If at any time WiFi or Adafruit IO disconnects, the code will print the error to the serial console, and the board will hard reset after 30 seconds. [...] except Exception as e: print("Failed to get or send data, or connect.
Page 171
Extract the contents of the zip file, and copy the entire lib folder and the c ode.py file to your CIRCUITPY drive. # SPDX-FileCopyrightText: Copyright (c) 2022 Dan Halbert for Adafruit Industries # SPDX-FileCopyrightText: Copyright (c) 2022 Kattni Rembor for Adafruit Industries # SPDX-License-Identifier: MIT """...
Page 177
The boot.py File The filesystem will NOT automatically be set to read-only on creation of this file! You'll still be able to edit files on CIRCUITPY after saving this boot.py. # SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries # SPDX-License-Identifier: Unlicense """...
Page 178
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries # SPDX-License-Identifier: Unlicense """ CircuitPython Essentials Storage CP Filesystem code.py file """ import time import board import digitalio import microcontroller led = digitalio.DigitalInOut(board.LED) led.switch_to_output() try: with open("/temperature.txt", "a") as temp_log: while True: # The microcontroller temperature in Celsius.
Page 182
Your CIRCUITPY drive should now look similar to the following image: Then, connect to the serial console (). # SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries # SPDX-License-Identifier: MIT """ CircuitPython Capacitive Touch Pin Example for ESP32-S2. Print to the serial console when one pin is touched.
Page 184
Then, connect to the serial console (). # SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries # SPDX-License-Identifier: MIT """ CircuitPython Capacitive Two Touch Pin Example for ESP32-S2 Print to the serial console when a pin is touched. """ import time import board import touchio touch_one = touchio.TouchIn(board.D8)
Page 185
Extract the contents of the zip file, find your CircuitPython version, and copy the matching code.py file to your CIRCUITPY drive. Your CIRCUITPY drive should now look similar to the following image: # SPDX-FileCopyrightText: 2021-2023 Kattni Rembor for Adafruit Industries # SPDX-License-Identifier: MIT """...
Page 188
CircuitPython you're using and copy the contents of that directory to your CIRCUITPY drive. Your CIRCUITPY drive should now look similar to the following image: # SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries # SPDX-License-Identifier: MIT """CircuitPython CPU temperature example in Celsius"""...
Page 189
CircuitPython you're using and copy the contents of that directory to your CIRCUITPY drive. Your CIRCUITPY drive should now look similar to the following image: # SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries # SPDX-License-Identifier: MIT """CircuitPython CPU temperature example in Fahrenheit"""...
Page 191
URLs is comma separated, and you will only have to add each URL once. New Adafruit boards and updates to existing boards will automatically be picked up by the Board Manager each time it is opened. The URLs point to index files that the Board Manager uses to build the list of available &...
Page 192
Arduino IDE preferences. https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/ package_esp32_dev_index.json If you have multiple boards you want to support, say ESP8266 and Adafruit, have both URLs in the text box separated by a comma (,) Once done click OK to save the new preference settings. The next step is to actually install the Board Support Package (BSP). Go to the Tools →...
Page 193
Select ESP32-S2/S3 Board in Arduino IDE On the Arduino IDE, click: Tools -> Board -> ESP32 Arduino -> Your Adafruit ESP32-S2/S3 board The screenshot shows Metro S2 but you may have a different board. Make sure the name matches the exact product you purchased.
Page 206
Perform an I2C scan! Install TestBed Library To scan I2C, the Adafruit TestBed library is used. This library and example just makes the scan a little easier to run because it takes care of some of the basics. You will need to add support by installing the library.
Page 207
{ Serial.begin(115200); // Wait for Serial port to open while (!Serial) { delay(10); delay(500); Serial.println("Adafruit I2C Scanner"); #if defined(ARDUINO_ADAFRUIT_QTPY_ESP32S2) || \ defined(ARDUINO_ADAFRUIT_QTPY_ESP32S3_NOPSRAM) || \ defined(ARDUINO_ADAFRUIT_QTPY_ESP32S3) || \ defined(ARDUINO_ADAFRUIT_QTPY_ESP32_PICO) // ESP32 is kinda odd in that secondary ports must be manually // assigned their pins with setPins()! Wire1.setPins(SDA1, SCL1);...
Page 208
The first thing you'll want to do is get the sensor connected so your board has I2C to talk to. Adafruit MCP9808 High Accuracy I2C Temperature Sensor Breakout The MCP9808 digital temperature sensor is one of the more accurate/precise we've ever seen, with a typical accuracy of ±0.25°C over the sensor's -40°C to...
Page 210
The LC709203 is available over I2C. The sensor comes with its own Adafruit CircuitPython library that makes it simple to write code to read data from it. This example will be using, among other things, the dafruit LC709203F ()
Page 211
When asked about installing dependencies, click Install all. LC709203 Simple Data Example Click File > Examples > Adafruit LC709203F > LC709203F_demo to open the example. #include "Adafruit_LC709203F.h" Adafruit_LC709203F lc; void setup() { Serial.begin(115200); delay(10); Serial.println("\nAdafruit LC709203F demo"); // For the Feather ESP32-S2, we need to enable I2C power first!
Page 212
The MAX17048 is available over I2C. The sensor comes with its own Adafruit CircuitPython library that makes it simple to write code to read data from it. This example will be using, among other things, the A...
Page 214
MAX17048 Simple Data Example Click File > Examples > Adafruit MAX1704X > MAX17048_basic to open the example. #include "Adafruit_MAX1704X.h" Adafruit_MAX17048 maxlipo; void setup() { Serial.begin(115200); while (!Serial) delay(10); // wait until serial monitor opens Serial.println(F("\nAdafruit MAX17048 simple demo")); if (!maxlipo.begin()) { Serial.println(F("Couldnt find Adafruit MAX17048?\nMake sure a battery is...
Page 215
Thanksfully if you have ESP32 sketches, they'll 'just work' with variations of ESP32. You can find a wide range of examples in the File->Examples->Examples for Adafruit Metro ESP32-S2 subheading (the name of the board may vary so it could be "Example s for Adafruit Feather ESP32 V2"...
Page 217
Copy the example below and paste it into the Arduino IDE: // SPDX-FileCopyrightText: 2020 Brent Rubell for Adafruit Industries // SPDX-License-Identifier: MIT Web client This sketch connects to a website (wifitest.adafruit.com/testwifi/index.html) using the WiFi module. This example is written for a network using WPA encryption. For WEP or WPA, change the Wifi.begin() call accordingly.
Page 219
WiFi connection to connect to the Twitter API. Copy and paste it into the Arduino IDE: // SPDX-FileCopyrightText: 2015 Arturo Guadalupi // SPDX-FileCopyrightText: 2020 Brent Rubell for Adafruit Industries // SPDX-License-Identifier: MIT This example creates a client object that connects and transfers data using always SSL.
Page 222
Arduino IDE. // SPDX-FileCopyrightText: 2014 Benoit Blanchon // SPDX-FileCopyrightText: 2014 Arturo Guadalupi // SPDX-FileCopyrightText: 2020 Brent Rubell for Adafruit Industries // SPDX-License-Identifier: MIT This example creates a client object that connects and transfers data using always SSL, then shows how to parse a JSON document in an HTTP response.
Page 226
The ESP32-S2/S3 is an affordable, all-in-one, option for connecting your projects to the internet using our IoT platform, Adafruit IO (). • For more information and guides about Adafruit IO, check out the Adafruit IO Basics Series. () Install Libraries In the Arduino IDE, navigate to Sketch -> Include Library->Manage Libraries...
Page 227
When asked to install dependencies, click Install all. Adafruit IO Setup If you do not already have an Adafruit IO account, create one now (). Next, navigate to the Adafruit IO Dashboards page. We'll create a dashboard to visualize and interact with the data being sent between your ESP32-S2/S3 board and Adafruit IO. ...
Page 230
Change Button Off Text to 0 Click Create block Next up, we'll want to display button press data from your board on Adafruit IO. To do this, we'll add a gauge block to the Adafruit IO dashboard. A gauge is a read only block type that shows a fixed range of values.
Page 232
Code Usage For this example, you will need to open the adafruitio_26_led_btn example included with the Adafruit IO Arduino library. In the Arduino IDE, navigate to File -> Examples -> Adafruit IO Arduino -> adafruitio_26_led_btn. Before uploading this code to the ESP32-S2/S3, you'll need to add your network and Adafruit IO credentials.
Page 233
Click the Upload button to upload your sketch to the ESP32-S2/S3. After uploading, pr ess the RESET button on your board to launch the sketch. Open the Arduino Serial monitor and navigate to the Adafruit IO dashboard you created. You should see the gauge response to button press and the board's LED light up in response to the Toggle Switch block.
Page 234
Sign up for Adafruit.io You will need an Adafruit IO account to use WipperSnapper on your board. If you do not already have one, head over to io.adafruit.com () to create a free account.
Page 235
After clicking New Device, you should be on the board selector page. This page displays every board that is compatible with the WipperSnapper firmware. In the board selector page's search bar, search for the ESP32-S2 Feather. Once you've located the board you'd like to install WipperSnapper on, click the Choose Board button to bring you to the self-guided installation wizard.
Page 236
If the installation was successful, a popover should appear displaying that your board has successfully been detected by Adafruit IO. Give your board a name and click "Continue to Device Page". You should be brought to your board's device page.
Page 237
If you're still unable to resolve the issue, or if your issue is not listed below, get in touch with us directly at https://io.adafruit.com/support (). Make sure to click "Contact Adafruit IO Support" and select "There is an issue with WipperSnapper. Something is broken!"...
Page 238
"uninstall". However, you may want to "move" your board from running WipperSnapper to running Arduino or CircuitPython. You also may need to restore your board to the state it was shipped to you from the Adafruit factory. Moving from WipperSnapper to CircuitPython...
Page 239
(or off) the LED built into your Feather from anywhere in the world. In this demo, we show controlling an LED from Adafruit IO. But the same kind of control can be used for relays, lights, motors, or solenoids.
Page 240
Verify that your Feather is online and ready to communicate with Adafruit IO by checking that the device tile says Online in green text. • If the Feather appears offline on the website but was previously connected, press the Reset (RST) button to force the board to reboot.
Page 242
Behind the scenes, Adafruit IO sends send a command to your board running WipperSnapper telling it to configure the GPIO pin as a digital output. Your Feather's page shows the new LED component. From the page, toggle the LED component by clicking the toggle switch. This should turn your Feather's built-in LED on or off.
Page 243
Adafruit IO. Let's wire up a push button to your Feather and configure it with Adafruit IO to publish a value to Adafruit IO when the button has been pressed or depressed. ...
Page 245
The Return Interval dictates how frequently the value of the push-button will be sent from the Feather to Adafruit IO. For this example, the push-button's value should only be sent when it's pressed. Select On Change Finally, check the Specify Pin Pull Direction checkbox and select Pull Up to turn on the Feather's internal pullup resistor.
Page 246
Make sure the form's settings look like the following screenshot. Then, click Create Component. Adafruit IO should send a command to your board (running WipperSnapper), telling it to configure the GPIO pin you selected to behave as a digital input pin and to enable it to pull up the internal resistor.
Page 247
Press the button to change the value of the push button component on Adafruit IO. Read an I2C Sensor Inter-Integrated Circuit, aka I2C, is a two-wire protocol for connecting sensors and "devices" to a microcontroller. A large number of sensors, including the ones sold by Adafruit, use I2C to communicate. ...
Page 250
Create the Sensor Component Now that you know the sensor can be detected by the Feather, it's time to configure and create the sensor on Adafruit IO. On the device page, add a new component to your Feather by clicking the + button or the + New Component button.
Page 251
Feather how often it should read from the AHT20 sensor and send the data to Adafruit IO. Measurements can range from every 30 seconds to every 24 hours. For this example, set the Send Every interval for both seconds to Every 30 seconds and click Create Component.
Page 252
LEDs. LED Blink In this demo, we show controlling an LED from Adafruit IO. But the same kind of control can be used for relays, lights, motors, or solenoids. One of the first programs you typically write to get used to embedded programming is a sketch that repeatably blinks an LED.
Page 253
Where is the LED on my board? The ESP32-S2 Feather's built-in LED is located above the USB-C port. Create a LED Component on Adafruit IO On the device page, click the New Component (or "+") button to open the component picker.
Page 254
On the Create LED Component form, the board's LED pin is pre-selected. Click Create Component. Behind the scenes, Adafruit IO sends send a command to your board running WipperSnapper telling it to configure "LED Pin" as a digital output. Your board's page on Adafruit IO shows a new LED component.
Page 255
LED on or off. NeoPixel LED Your board has a WS281x RGB LED (NeoPixel, in Adafruit jargon) built in. Boards running the WipperSnapper firmware can be wirelessly controlled by Adafruit IO to interact with NeoPixels.
Page 257
Click Create Component Behind the scenes, Adafruit IO sends a command to your board running WipperSnapper firmware telling it to configure the pin as a NeoPixel component with the settings from the form. The Device page shows the NeoPixel component. Set the NeoPixel's RGB Color...
Page 258
A color picker pops open! Adafruit IO uses hex color codes to represent the colors on your NeoPixel. Hex Colors 101 The color picker on Adafruit IO uses hex color codes to represent Red, Green, and Blue values. For example, is the hex color code for the color red.
Page 260
From Adafruit IO, you will configure one of the pushbuttons on your board as a push button component. Then, when the button is pressed (or released), a value will be published to Adafruit IO. Button Location This example uses the board's built-in push-button and internal pull-up resistor instead of wiring a push-button up.
Page 261
Start by selecting the board's pin connected to the push button. The Return Interval dictates how frequently the value of the push-button will be sent from the board to Adafruit IO. For this example, you will configure the push button's value to be only sent when the value changes (i.e.
Page 262
Make sure the form's settings look like the following screenshot. Then, click Create Component. Adafruit IO sends a command to your WipperSnapper board, telling it to configure the GPIO pin you selected to behave as a digital input pin and to enable it to pull up the internal resistor.
Page 263
Your board's page should also show the new push-button component. Push the button on your board to change the value of the push-button component on Adafruit IO. Analog Input Your microcontroller board has both digital and analog signal capabilities. Some pins are analog, some are digital, and some are capable of both.
Page 269
Click Update Component to send the updated component settings to your board running WipperSnapper. Now, twist the potentiometer to see the value reported to Adafruit IO in Volts! I2C Sensors While this page uses the "MCP9808 High Accuracy I2C Temperature Sensor Breakout", the process for adding an I2C sensor to your board running...
Page 270
On this page, you'll learn how to wire up an I2C sensor to your board. Then, you'll create a new component on Adafruit IO for your I2C sensor and send the sensor values to Adafruit IO. Finally, you'll learn how to locate, interpret, and download the data produced by your sensors.
Page 272
The Send Every option is specific to each sensor measurement. This option will tell the board how often it should read from the sensor and send the data to Adafruit IO. Measurements can range from every 30 seconds to every 24 hours.
Page 273
IO Feed () is also created. This Feed holds your sensor component values for long-term storage (30 days of storage for Adafruit IO Free and 60 days for Adafruit IO Plus plans). Aside from holding the values read by a sensor, the component's feed also holds met adata about the data pushed to Adafruit IO.
Page 274
Doing more with your sensor's Adafruit IO Feed This only scratches the surface of what Adafruit IO Feeds can accomplish for your IoT projects. For a complete overview of Adafruit IO Feeds, including tasks like downloading feed data, sharing a feed, removing erroneous data points from a feed, more, head over to the "Adafruit IO Basics: Feed"...
Page 275
STEMMA port, highlighted in pink. Powering the Feather with a Battery Adafruit highly advises using Adafruit batteries. They have the correct wiring and built in short circuit protection. Batteries from other sources may have incorrect wiring and/or no short protection.
Page 277
Adafruit IO. Going Further Now that you have a battery monitor component set up on Adafruit IO, follow this guide to configure Adafruit IO Action for receiving an SMS when your Feather's battery level is below a threshold. ()
Page 278
That way you can tell when the battery needs recharging. In this section, you'll connect a battery to your Feather, and configure a battery monitor component from Adafruit IO to report the board's battery voltage and charge percentage. Where is the Battery Monitor on my Feather? The Feather's LC709203F LiPoly / LiIon...
Page 279
Powering the Feather with a Battery Adafruit highly advises using Adafruit batteries. They have the correct wiring and built in short circuit protection. Batteries from other sources may have incorrect wiring and/or no short protection. You can plug any 250mAh or larger 3.7/4.2V Lipoly battery into the JST 2-PH port (identified in the diagram below) to power your Feather and charge the battery.
Page 280
Enabling the battery cell percent reading will cause the Feather to report the status of its battery expressed as a percent. Then, the battery measurement will be read and sent to Adafruit IO every "Send Every" period. In the screenshot below, we've configured the battery monitor to report its battery cell voltage and percent to Adafruit IO every 30 seconds.
Page 281
Adafruit IO. Going Further Now that you have a battery monitor component set up on Adafruit IO, follow this guide to configure Adafruit IO Action for receiving an SMS when your Feather's battery level is below a threshold. ()
Page 282
CircuitPython. However, on the ESP32-S2 the UF2 bootloader can become damaged. The Unexpected Maker FeatherS2 and the Adafruit Feather ESP32-S2 are two DIFFERENT boards. This page will NOT work with the UM Feather S2, it will ONLY...
Page 293
Load the Blink Sketch In the Tools > Boards menu you should see the ESP32 Arduino menu. In the expanded menu, look for the menu option for the Adafruit Feather ESP32-S2, and click on it to choose it. Open the Blink sketch by clicking through File > Examples > 01.Basics > Blink.
Page 294
• ESP32-S2 datasheet () • ESP32-S2 Technical Reference () • ESP32-S2 EagleCAD PCB files on GitHub () • ESP32-S2 Fritzing object in the Adafruit Fritzing Library () • ESP32-S2 PrettyPins pinout diagram PDF on GitHub () • ESP32-S2 PrettyPins SVG () • ESP32-S3 product page with resources ()
Need help?
Do you have a question about the ESP32-S2 Feather and is the answer not in the manual?
Questions and answers