Connecting to uLisp on an ESP32 via Bluetooth


#1

If you’ve got an ESP32 board you can connect to uLisp running on the board wirelessly, via Bluetooth. I’ve tested this on a Mac, but the procedure should work in a similar way on other platforms.

An ideal board to use for this is the Adafruit HUZZAH32 ESP32 Feather board, which has a socket for an external Lipo battery that you can charge via USB:

Edit the uLisp source

You need to make a few small changes to the ESP Version 3.2 source of uLisp before uploading it to the ESP32 board:

  • Include these three lines after the comment at the beginning of the uLisp source file:
#include "BluetoothSerial.h"
BluetoothSerial SerialBT;
#define Serial SerialBT

This makes uLisp use serial Bluetooth rather than the usual Serial USB.

  • Set the terminal-related compile options as follows:
#define lineeditor
// #define vt100

For some reason the parenthesis matching doesn’t seem to work over Bluetooth.

  • Reduce the workspace size from 8000 to 4000 objects:
#elif defined(ESP32)
  #define WORKSPACESIZE 4000-SDSIZE /* Cells (8*bytes) */

The Bluetooth stack seems to require a lot of RAM.

  • Edit the first four lines of setup() as follows:
void setup () {
  // Serial.begin(9600);
  SerialBT.begin("uLisp"); //Bluetooth device name
  // int start = millis();
  // while ((millis() - start) < 5000) { if (Serial) break; }

This starts Bluetooth with the device name uLisp, and removes the code that waited for Serial to start.

  • Upload uLisp to your ESP32 board.

Connecting to uLisp

Assuming the ESP32 board is powered up, you should see the uLisp device in your Bluetooth control panel:

  • Click the Connect button.
  • In the Terminal application scan for devices with the command:
ls /dev/tty.*

On my computer this lists several Bluetooth devices; not sure why there are so many. Choose the first one containing the device name uLisp.

  • Run the screen terminal emulator with the command:
screen /dev/tty.uLisp-ESP32_SPP_SERVER

or replace the device name with the first Bluetooth device listed in the previous step.

You should now be able to interact with uLisp via the terminal over Bluetooth.

To exit from screen:

  • Type ctrl-A ctrl-\ and answer y to the prompt.

Watchy, a new hackable smartwatch, looks ideal for uLisp