template and projects using ESP32-S2
Go to file
King Kévin 10bf54edb9 doc: document project 2023-03-13 23:11:40 +01:00
main main: better document GPIO connections 2023-03-13 23:11:04 +01:00
.gitignore ignore managed components 2023-01-07 01:38:03 +01:00
CMakeLists.txt create blank ESP project 2022-07-18 11:32:41 +02:00
LICENSE.md add licenses 2022-07-18 11:58:28 +02:00
README.md doc: document project 2023-03-13 23:11:40 +01:00
partitions.csv conf: align partitions to 64kB 2023-01-07 06:12:32 +01:00
sdkconfig.defaults conf: set freq. to max 240 MHz 2023-01-07 06:25:38 +01:00

README.md

this project is about interfacing the GM-1352 sound level meter using an ESP32-S2-based board, so to read the sound level measurements digitally.

GM-1352

the GM-1352 is the successor of the GM-1351, and very similar to it. the main difference is that the power is not delivered by a 9V battery, but by 3x1.5V AA batteries.

CuVoodoo #030 already explained how to interface it. basically just tap on the lines between the MCU (a EFM8BB10F8G-QFN20) and LCD controller (a Chip-on-Board under a blob of epoxy). there are test points available for that:

  • CS: chip select, to start data communication
  • DATA: the actual data bits
  • WR: the data clock (not periodic)

there are additional test points to read (or assert) button presses:

  • 1: HOLD button (press low)
  • 2: MIN/MAX button (press low)
  • 3: POWER button (press low)

there is another test point marked S, but I don't know what this is for.

also note that the LCD has segments for Bluetooth and USB. there might be variants of the GM-1352 with these options.

board

this repository is the firmware for ESP32-S2-based WEMOS S2 mini board.

connect the GM-1352 to the S2 mini as follows:

  • B+ to 5V: to power or get power from the device
  • B- to GND: ground reference
  • POWER to 16: to wake up the S2 when the device is powered (the S2 will shut down shortly after the GM-1352)
  • DATA to 18: this will be the SPI MOSI line to read the measurments
  • CS to 33: this will be the SPI CS line to identify transactions
  • WR to 35: this will be the SPI SCK line to clock the data bits (not periodic)

I soldered wires to the pads, and broke them out on a 8-pin female header, located above the battery compartment. this also to easily connect on row of the S2 mini to it on the back of the GM-1352.

now you can power the sound level meter through the S2 mini USB port, and read the measurements over its serial CDC ACM interface.

compile and flash

the firmware uses ESP-IDF v5.0. See getting started to install the IDF. once installed, load the IDF tools:

get_idf

to build the firmware:

idf.py build

note that the first time it will download additional components (such as tinyUSB and esp_tinyusb).

the firmware supports USB DFU flashing. it is meant to be used along the ESP32-S2 DFU mode firmware. Once the DFU mode firmware is installed (on the factory partition), you can flash this firmware (on the ota0 partition) using dfu-util:

dfu-util --device 1d50:617b --alt 1 --download build/main.bin --reset

if the firmware is stuck, and you can't switch from runtime mode to DFU mode using dfu-util, hold pin 14 high while resetting. this will force booting the DFU mode.

you can also flash using the ESP ROM bootloader (hold GPIO0 low while resetting) and esptool:

esptool.py -p /dev/ttyACM0 --before no_reset --after no_reset --chip esp32s2 write_flash --flash_mode dio --flash_size detect --flash_freq 80m 0x50000 build/main.bin