Best ESP32 board for use with uLisp?


#1

If you’re looking for an ESP32 board for use with uLisp I can recommend the DSTIKE D-duino-32 SD V2 board:

It’s available from Tindie:

DSTIKE WiFi Packet Monitor V3

or from Aliexpress:

DSTIKE WiFi Packet Monitor V3 ESP32-Wrover+OLED WiFi+BLE IOT Development Kit

It has just about every feature you’d want in a board:

  • ESP32 WROVER module
  • microSD card socket
  • JST LiPo connector.
  • Battery charging via USB.
  • Monochrome 1.3" 128x64 OLED.
  • 3-way control switch
  • WS2812b RGB LED

It uses the Silicon Labs CP2102 USB to serial chip for USB connectivity.

To use it with the Arduino IDE select the ESP32 Wrover Module board setting.

microSD cards

To use the board with an SD card you need to change the SPI pin settings to correspond to the connections on the SD card socket. The easiest way is to edit the esp32/pins_arduino.h file:

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

You should then be also to run all the examples in SD card interface.

Buttons

The board includes a navigation switch with the following connections:

  • Up: pin 32
  • Select: pin 33
  • Down: pin 25

There are also two buttons below the display:

  • Left: EN
  • Right: pin 5

RGB LED

The board has a WS2812b RGB LED connected to pin 18. Unfortunately this is difficult to drive from uLisp.

OLED display

The board includes a 128x64 OLED display, which is based on the SH1106 driver chip. Note that the I2C display is connected to pins 26 (SDA) and 27 (SCL), so you need to edit the esp32/pins_arduino.h file to:

static const uint8_t SDA = 26;
static const uint8_t SCL = 27;

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* #xA1 #xAF)))

(defun plot (x y)
  (incf x 2)
  (dotimes (p 8)
    (with-i2c (s 60)
      (write-many s #x80 (+ #x00 (logand x 15)) #x80 
                  (+ #x10 (ash x -4)) #x80 (+ #xB0 p) #xc0)    
      (if (<= 0 y 7)
          (write-byte (ash 1 y) s)
        (write-byte 0 s)))
    (setq y (- y 8))))

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

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 two cycles of a sine wave, as shown in the above photo.

For a more comprehensive graphics package that will also work on this display see Graphics display interface in Lisp.


#2

Looks really nice, I’m going to order one.
Do you know the current draw of that board (powered from a LiPo)?


#3

I just connected up a 3.7 V LiPo battery, and measured 68 mA. However, I think the consumption of the ESP32 can vary quite a lot depending on what it’s doing.