Adafruit ESP32 WiFi User manual

Adafruit AirLift Shield - ESP32 WiFi Co-Processor
Created by Brent Rubell
Last updated on 2021-03-29 01:04:51 PM EDT
2 4 8
8 9
9 10 10 11
12 12
16
21
21
21 22 24 24 24 28
30 31 32
33 36 36 36 36 36 37 37 38 41 41 41
42
43 44
46 47
48 48
49
50 52
53
Guide Contents Overview Pinouts
Power Pins SPI Interface Pins ESP32 Control Pins SD Card Interface LEDs Prototyping Area
Assembly Installing Standard Headers
Stack Alert!
CircuitPython WiFi
CircuitPython Microcontroller Pinout
CircuitPython Installation of ESP32SPI Library CircuitPython Usage Internet Connect! What's a secrets file? Connect to WiFi Requests
HTTP GET with Requests HTTP POST with Requests Advanced Requests Usage
WiFi Manager CircuitPython BLE CircuitPython BLE UART Example Adafruit AirLift ESP32 Shield Wiring Update the AirLift Firmware Install CircuitPython Libraries Install the Adafruit Bluefruit LE Connect App Copy and Adjust the Example Program Talk to the AirLift via the Bluefruit LE Connect App Arduino WiFi Library Install First Test
Arduino Microcontroller Pin Definition
WiFi Connection Test Secure Connection Example
JSON Parsing Example Adapting Other Examples
Upgrade External ESP32 Airlift Firmware External AirLift FeatherWing, Shield, or ItsyWing
Upload Serial Passthrough code for Feather or ItsyBitsy
External AirLift Breakout Code Usage
Install esptool.py
© Adafruit Industries https://learn.adafruit.com/adafruit-airlift-shield-esp32-wifi-co-processor Page 2 of 56
53 54
54 54
55
55 55 55
Burning nina-fw with esptool Verifying the Upgraded Firmware Version
Arduino CircuitPython
Downloads
Files Schematic Fab Print
© Adafruit Industries https://learn.adafruit.com/adafruit-airlift-shield-esp32-wifi-co-processor Page 3 of 56
Overview
Give your Arduino project a
lift
with the Adafruit AirLift Shield (https://adafru.it/F6v) - a shield that lets you
use the powerful ESP32 as a WiFi or BLE co-processor. You probably have your favorite Arduino-
compatible (like the Metro M4 (https://adafru.it/A5S) or the classic Metro
328 (https://adafru.it/METROXMETR)) that comes with its own set of awesome peripherals and lots of
libraries. But it doesn't have WiFi or BLE built in! So let's give that chip a best friend, the ESP32. This chip
can handle all the heavy lifting of connecting to a WiFi network and transferring data from a site, even if it's
using the latest TLS/SSL encryption (it has root certificates pre-burned in).
© Adafruit Industries https://learn.adafruit.com/adafruit-airlift-shield-esp32-wifi-co-processor Page 4 of 56
Having WiFi managed by a separate chip means your code is simpler, you don't have to cache socket
data, or compile in & debug an SSL library. Send basic but powerful socket-based commands over 8MHz
SPI for high speed data transfer. You can use any 3V or 5V Arduino, any chip from the ATmega328 and up
(although the '328 will not be able to do very complex tasks or buffer a lot of data). It also works great with
CircuitPython, a SAMD51/Cortex M4 minimum required since we need a bunch of RAM. All you need is the
SPI bus and 2 control pins plus a power supply that can provide up to 250mA during WiFi usage.
The ESP32 also supports BLE (Bluetooth Low Energy), though not simultaneously with WiFi. Many of our
CircuitPython builds include native support for ESP32 BLE. You use a few control pins and the RXI and
TXO pins to talk to the ESP32 when it's in BLE mode.
We placed an ESP32 module on a shield with a separate 3.3V regulator, and a tri-state chip for MOSI so
you can share the SPI bus with other shields. We also tossed on a micro SD card socket, you can use that
to host or store data you get from the Internet. Arduinos based on the ATmega328 (like the UNO) cannot
use both the WiFi module and SD library at the same time, they don't have enough RAM. Again, we
recommend an M0 or M4 chipset for use with Arduino, M4 for CircuitPython!
© Adafruit Industries https://learn.adafruit.com/adafruit-airlift-shield-esp32-wifi-co-processor Page 5 of 56
Comes fully assembled and tested, pre-programmed with ESP32 SPI WiFi co-processor firmware that you
can use in CircuitPython to use this into WiFi co-processsor (https://adafru.it/Evl). We also include some
header so you can solder it in and plug right into your Arduino-compatible, but you can also pick up a set
of stacking headers to stack above/below your board.
We've tested this with all our Metros and it should work just fine with them except the Metro M4
Airlifts (https://adafru.it/F6o) (because they already have WiFi!). For use in Arduino , the '328 and '32u4 you
can do basic connectivity and data transfer but they do not have a lot of RAM so we don't recommend
them - use the Metro M0, M4 or similar, for best results! For CircuitPython use, a Metro M4 works best -
the M0 series does not have enough RAM in CircuitPython.
© Adafruit Industries https://learn.adafruit.com/adafruit-airlift-shield-esp32-wifi-co-processor Page 6 of 56
The firmware on board is a slight variant of the Arduino WiFiNINA core, which works
great! (https://adafru.it/E7O) At this time connection to Enterprise WiFi is not yet supported.
© Adafruit Industries https://learn.adafruit.com/adafruit-airlift-shield-esp32-wifi-co-processor Page 7 of 56
Pinouts
There's a lot jam-packed into this shield! Let's take a look at what we've got going on.
Power Pins
GND - Common power/logic ground.
3V - this is the output from the 3.3V regulator. The regulator can supply 500mA peak but half of that
is drawn by the ESP32, and it's a fairly power-hungry chip.
5V - This is the input to the regulator
© Adafruit Industries https://learn.adafruit.com/adafruit-airlift-shield-esp32-wifi-co-processor Page 8 of 56
IOr - This is IORef, the IO voltage we will communicate with and is required.
SPI Interface Pins
Both ESP32 and SD card use SPI to send and receive data. These pins are labeled CLK MISO MOSI and
have level shifting so you can use this shield with 3.3V or 5V microcontroller boards.
By default the 2x3 pin ICSP header on the right hand side is where the SPI signals are found.
ESP32 Control Pins
© Adafruit Industries https://learn.adafruit.com/adafruit-airlift-shield-esp32-wifi-co-processor Page 9 of 56
Required Control Pins:
BUSY - this pin is an input from the AirLift, it will let us
know when its ready for more commands to be sent.
This is 3.3V logic out, can be read by 3-5V logic. This
pin
must
be connected.
RST- this pin is an output to the AirLift. Set low to put the
AirLift into reset. You should use this pin, even though
you might be able to run for a short while without it, it's
essential to 'kick' the chip if it ever gets into a locked up
state. Level shifted so can be 3-5V logic
Optional Control Pins:
GPIO0 - this is the ESP32 GPIO0 pin, which is used to
put it into bootloading mode. It is also used if you like
when the ESP32 is acting as a server, to let you know
data is ready for reading. IIt's not required for WiFi, but
you'll need to connect it to use BLE mode. Solder the
pad on the bottom of the shield to connect it.
RX & TX - Serial data in and Serial data out, used for
bootloading new firmware, and for communication when
in BLE mode. Leave disconnected if not using BLE or
when not uploading new WiFi firmware to the AirLift
(which is a rare occurrence). You'll need to solder the
two pads on the bottom of the shield to use these pins.
SD Card Interface
There's a lot of space available on this shield so we also stuck
on a micro SD card holder, great for datalogging or storing
data to transmit over WiFi.
In addition to the shared SPI pins, the SD (chip select) pin is
also used. It can be re-assigned to any pin by cutting the trace
underneath the board and rewiring. If the SD card is not used,
the SD pin can be used for any other purpose
LEDs
© Adafruit Industries https://learn.adafruit.com/adafruit-airlift-shield-esp32-wifi-co-processor Page 10 of 56
There is a small RGB LED to the left of the ESP32. These RGB
LEDs are available in the Arduino and CircuitPython libraries if
you'd like to PWM them for a visual alert. They're connected
to the ESP32's pins 26 (Red), 25 (Green), and 27 (Blue).
Prototyping Area
We have a big grid of prototyping holes and power rails if you
want to make some custom circuitry!
© Adafruit Industries https://learn.adafruit.com/adafruit-airlift-shield-esp32-wifi-co-processor Page 11 of 56
Assembly
Installing Standard Headers
The shield comes with 0.1" standard header. Standard header does not permit stacking but it is
mechanically stronger and they're much less expensive too! If you want to stack a shield on top, do not
perform this step as it is not possible to uninstall the headers once soldered in! Skip down to the bottom
for the stacking tutorial
© Adafruit Industries https://learn.adafruit.com/adafruit-airlift-shield-esp32-wifi-co-processor Page 12 of 56
Break apart the 0.1" header into 6, 8 and/or 10-pin long pieces
and slip the long ends into the headers of your Arduino.
Place the assembled shield on top of the header-ed Arduino
so that all of the short parts of the header are sticking through
the outer set of pads
© Adafruit Industries https://learn.adafruit.com/adafruit-airlift-shield-esp32-wifi-co-processor Page 13 of 56
Solder each one of the pins into the shield to make a secure
connection
© Adafruit Industries https://learn.adafruit.com/adafruit-airlift-shield-esp32-wifi-co-processor Page 14 of 56
That's it! Now you can install the 2x3 header
© Adafruit Industries https://learn.adafruit.com/adafruit-airlift-shield-esp32-wifi-co-processor Page 15 of 56
Solder the 2x3 header so that it's pointing downwards
Stack Alert!
If you want to stack a shield on top of the WiFi Shield, you'll want to pick up some stacking headers and
use those instead of the plain header shown here!
© Adafruit Industries https://learn.adafruit.com/adafruit-airlift-shield-esp32-wifi-co-processor Page 16 of 56
Wanna stack? This tutorial shows how to use the plain header
to connect to an Arduino. If you want to use stacking
headers (https://adafru.it/dsu), don't follow these steps!
Start by sliding the 10 pin, 2 x 8 pin and 6-pin stacking
headers into the outer rows of the shield from the top. Then
flip the board over so its resting on the four headers. Pull on
the legs if necessary to straighten them out.
Tack one pin of each header, to get them set in place before
more soldering. If the headers go crooked you can re-heat the
one pin while re-positioning to straighten them up
© Adafruit Industries https://learn.adafruit.com/adafruit-airlift-shield-esp32-wifi-co-processor Page 17 of 56
Loading...
+ 39 hidden pages