ESP32 boards

The ESP32 is a series of low-cost, low-power microcontrollers with integrated Wi-Fi and dual-mode Bluetooth, developed by the Chinese company Espressif Systems. It's a successor to their ESP8266 microcontroller. It's based on an Xtensa dual-core (or single-core) 32-bit LX6 microprocessor, operating at 160 or 240 MHz, and features 4 Mbyte of flash and 520 Kbytes of RAM.

Several manufacturers have made boards based on the ESP32, and here I've reviewed a selection of four different ones that I can recommend for use with uLisp. All the boards I've tested are based on the Silicon Labs CP2102 or CP2104 USB to serial interface. There are also boards available based on the CH340, but I've avoided these as the drivers don't seem as reliable.

For examples of using the Wi-Fi features see Wi-Fi examples, and for reference information see Wi-Fi extensions.

Adafruit HUZZAH32 - ESP32 Feather

The Adafruit HUZZAH32 [1] adopts the same format as Adafruit's other Feather boards, making it compatible with a number of their interface boards:

ESP32Feather.jpg

It's based on the ESP-WROOM-32 version of the ESP32, and uses the Silicon Labs CP2104 USB to serial chip for USB connectivity. A bonus is a JST connector for a Lipo battery, and a Lipo charger to allow the battery to be charged from the USB port.

For information about the I/O pins and interfaces see: Adafruit HUZZAH32 - ESP32 Feather Pinouts.

LEDs

As is traditional for Arduino boards the HUZZAH32 has a red LED connected to the digital pin 13 which you can flash with the following program:

(defun blink (x)
  (pinmode 13 t)
  (digitalwrite 13 x)
  (delay 1000)
  (blink (not x)))

Run it by typing:

(blink t)

Exit by entering ~.

DOIT ESP32 DEVKIT V1

The DOIT ESP32 DEVKIT V1 was one of the first ESP32 boards available [2]:

ESP32DOIT.jpg 

It's based on the ESP-WROOM-32 version of the ESP32, and uses the Silicon Labs CP2102 USB to serial chip for USB connectivity.

LEDs

The DOIT ESP32 DEVKIT V1 has a blue LED connected to the digital pin 2 which you can flash with the following program:

(defun blink (x)
  (pinmode 2 t)
  (digitalwrite 2 x)
  (delay 1000)
  (blink (not x)))

Run it by typing:

(blink t)

Exit by entering ~.

Wemos ESP32 OLED Module

This Wemos ESP32 module [3] features an integrated I2C monochrome 0.96" 128x64 OLED display:

ESP32OLED2.jpg

Again, it's based on the ESP-WROOM-32 version of the ESP32, and appears to use the Silicon Labs CP2102, although there are no markings on the chip on my sample board.

In the Arduino IDE use the WEMOS LOLIN32 option on the Board menu.

There is no on-board user LED.

Note that the I2C display is connected to pins 5 (SDA) and 4 (SCL), so you need to edit the lolin32/pins_arduino.h file to:

static const uint8_t SDA = 5;
static const uint8_t SCL = 4;

OLED display

The OLED display is based on an SSD1306 driver. Here's a simple program to initialise the display, and then plot a function on the display:

(defvar *address* 60)

(defvar *commands* #x00)

(defvar *data* #x40)

(defun write-many (s &rest b)
  (dolist (i b) (write-byte i s)))

(defun init-display ()
  (with-i2c (s *address*)
    (write-many s *commands* #x8D #x14 #x20 #x01 #xA1 #xDB #x40 #xAF)))

(defun plot (x y)
  (with-i2c (s *address*)
    (write-many s *commands* #x21 x x #x22 0 7)
    (restart-i2c s)  
    (write-byte *data* s)
    (dotimes (p 8)
      (cond
       ((> y 7) (write-byte 0 s))
       ((< y 0) (write-byte 0 s))
       (t (write-byte (ash 1 y) s)))
      (setq y (- y 8)))))

(defun test ()
  (init-display)
  (dotimes (x 128)
    (plot x (round (+ 31 (* 31 (sin (* x (/ (* 2 3.14) 128)))))))))

The routine (plot x y) plots a point on the display, where x can be from 0 to 127 and y from 0 to 63, and (plot 0 0) is the lower left-hand corner. Note that plot can only plot a function; ie only one point can be plotted in each column. The routine (test) plots one cycle of a sine wave.

Wemos ESP32-WROVER

Unlike the other boards tested here the Wemos ESP32-WROVER [4] is based on the ESP32-WROVER module, which includes an additional 4 Mbytes of PSRAM:

ESP32WROVER.jpg

It uses the Silicon Labs CP2104 USB to serial chip for USB connectivity. It also includes a Micro-SD card socket, and a JST socket for a Lipo battery.

To use the board with an SD card you need to edit the appropriate pins_arduino.h file to make the SPI pins correspond to the connections on the SD card socket:

static const uint8_t SS    = 13;
static const uint8_t MOSI  = 15;
static const uint8_t MISO  = 2;
static const uint8_t SCK   = 14;

Acknowledgements

I'm grateful to Klaus Fuerth for help completing the ESP32 version, and in particular the SD Card support.


  1. ^ Adafruit HUZZAH32 - ESP32 Feather Board on Adafruit.
  2. ^ DOIT ESP32 Development Board on Aliexpress.
  3. ^ Wemos ESP32 OLED Module on Banggood.
  4. ^ Wemos ESP32-WROVER on Banggood.