/esp32_hexastorm

ESP32 library to control hexastorm laserscanner

Primary LanguageC++

ESP32

Control a laser scanner build using the Hexastorm library with an ESP32.

Creating a binary

I follow the procedure described on esp32. I start by installing espd-idf.

$ git clone https://github.com/hstarmans/esp32_hexastorm
$ git submodule update --init
$ cd esp-idf
$ git checkout v5.0.2
$ ./install.sh       # (or install.bat on Windows)
$ source export.sh   # (or export.bat on Windows)
$ cd.. # back to starting directory

The install.sh step only needs to be done once. You will need to source export.sh for every new session. Copy partitions-4MiB.csv over the existing file in micropython/ports/esp32. A slightly larger factory partition is needed to accommodate all the C++ libraries.

$ cp partitions-4MiB.csv micropython/ports/esp32/

The code in the folder sdcard must be copied to the microSD card which is inserted in the ESP32 board. You have to do this your self. Change the wifi password in secrets.py before doing so. The code in the modules folder is frozen into micropython.

$ cp -r modules micropython/ports/esp32/

Hereafter I install Micropython and build the binary.

$ cd micropython
$ cd mpy-cross
$ make
$ cd ..
$ cd ports/esp32
$ make submodules
$ make USER_C_MODULES=../../../../micropython.cmake

You have to run make clean after make submodules, if you change the cmake file. You don't need to run make submodules each time.

Flashing the binary

The following erases and flashes the binary to the chip.

$ make erase && make deploy

On linux, ensure you are part of the dial out group. Development on Windows can be more difficult. You might not have the rights to write to the com port. Install rshell and open it.

sudo pip3 install rshell
rshell
connect serial /dev/ttyUSB0

On Windows it can be connect serial com6. The flash memory is available as /flash or /pyboard. The sdcard is available if it is mounted successfully, see boot.py.

Pinout

Pinout of the ESP32 board I used for this code, can be found here. Accessing the ports is outlined in the quickref.

Webserver

Developing a webserver is not a priority. For now, I want to work via the rpython shell. Best option for the webserver seems to be microdot. Another interesting option is MicroWebSrv2. This webserver is no longer under active development.