Espressif ESP32 and variants topic

Introduction

ESP32s are available everywhere. The AT commands are the same for all of them. This library requires AT command firmware versions 3.2 or higher. To update to firmware 3.2+ from versions prior to 3.2, you must re+flash the firmware. You cannot update over-the-air.

DFRobot ESPBee

I don't actually recommend this module. It gets hot and eats power for no apparent reason. And the pin connections are a bit strange. But it is cheap and available. The pins are technically available to use the ESP's "light sleep" but I've never successfully gotten the module to actually enter light sleep mode. It always runs at full power draw. It's not possible to use deep sleep on the DFRobot bee.

Manufacturer Documentation

And the page for the ESP32 is here: https://www.espressif.com/en/products/socs/esp32

Modem Constructor

EspressifESP32::EspressifESP32(Stream* modemStream, int8_t powerPin, int8_t modemResetPin, const char* ssid, const char* pwd)

Construct a new Espressif ESP32 object.

Parameters
modemStream The Arduino stream instance for serial communication.
powerPin The digital pin number of the mcu pin controlling power to the modem (active HIGH).
modemResetPin The digital pin number of the pin on the mcu attached the the hard or panic reset pin of the modem.
ssid The wifi network ID.
pwd The wifi network password, assuming WPA2.

The constructor initializes all of the provided member variables, constructs a loggerModem parent class with the appropriate timing for the module, calls the constructor for a TinyGSM modem on the provided modemStream, and creates a TinyGSM Client linked to the modem.

Should be set to a negative number if the modem should be continuously powered or the power cannot be controlled by the MCU. Should be set to a negative number if the modem reset pin is not connected to the MCU. This is the ESP's RSTB/DIO16 pin.



Example Code

The ESP32 is used in the menu a la carte example and the AWS IoT Core example.

1// For almost anything based on the Espressif ESP8266 using the
2// AT command firmware
3#include <modems/EspressifESP32.h>
4
5// NOTE: Extra hardware and software serial ports are created in the "Settings
6// for Additional Serial Ports" section
7const int32_t modemBaud = 57600; // Communication speed of the modem
8// NOTE: This baud rate too fast for an 8MHz board, like the Mayfly! The
9// module should be programmed to a slower baud rate or set to auto-baud using
10// the AT+UART_CUR or AT+UART_DEF command.
11
12// Modem Pins - Describe the physical pin connection of your modem to your board
13// NOTE: Use -1 for pins that do not apply
14// Example pins here are for a EnviroDIY ESP32 Bluetooth/Wifi Bee with
15// Mayfly 1.1
16const int8_t modemVccPin = 18; // MCU pin controlling modem power
17const int8_t modemResetPin = A5; // MCU pin connected to modem reset pin
18const int8_t modemLEDPin = redLED; // MCU pin connected an LED to show modem
19 // status
20
21// Network connection information
22const char* wifiId = WIFI_ID; // WiFi access point name
23const char* wifiPwd = WIFI_PASSWD; // WiFi password (WPA2)
24
25// Create the modem object
26EspressifESP32 modemESP(&modemSerial, modemVccPin, modemResetPin, wifiId,
27 wifiPwd);
28// Create an extra reference to the modem by a generic name
29EspressifESP32 modem = modemESP;

Classes

class EspressifESP32
The loggerModem subclass for any breakout of the Espressif ESP32 wifi chip or ESP32 wifi/bluetooth chip that has been flashed with Espressif's AT command firmware.