Port of my M5Stack Core 2 audio monitor project to generic ESP32s with TFT screens

Overview

ESP32 Audio Monitor

This is a port of this project to work with any ESP32 device with a TFT display.

You can watch a video explainer here (YouTube) which goes into a bit more detail on the audio capabilities of the device.

Demo Video

You'll need to use PlatformIO to build the project.

To clone the repo use:

git clone --recursive [email protected]:atomic14/esp32-tft-audio-monitor.git

This will make sure you get the TFT library as well.

Hopefully, the code should be easy to understand.

If you want to add some more visualisations then please open up a pull request and contribute some code.

To modify the code to work with your particular device you will need to change the settings in platformio.ini to match your TFT. The easiest way to do this is to look in the lib/TFT_eSPI/User_Setups for your device and copy the required pre-processor defines.

If you are feeling lazy then you can just copy the setup for you TFT over the User_Setup.h and remove the defines from the build settings.

If you take the lazy option, then remember to remove -DUSER_SETUP_LOADED=1.

; setup for the TTGO T4
  -DTFT_WIDTH=135
  -DTFT_HEIGHT=240
  -DST7789_DRIVER=1
  -DCGRAM_OFFSET=1
  -DTFT_MISO=-1
  -DTFT_MOSI=19
  -DTFT_SCLK=18
  -DTFT_CS=5
  -DTFT_DC=16
  -DTFT_RST=23
  -DTFT_BL=4
  -DTFT_BACKLIGHT_ON=HIGH
  -DLOAD_GLCD=1
  -DLOAD_FONT2=1
  -DLOAD_FONT4=1
  -DLOAD_FONT6=1
  -DLOAD_FONT7=1
  -DLOAD_FONT8=1
  -DLOAD_GFXFF=1
  -DSMOOTH_FONT=1
  -DSPI_FREQUENCY=40000000
  -DSPI_READ_FREQUENCY=6000000

And if you'd like to buy me a coffee...

ko-fi

Comments
  • no compile

    no compile

    src\Application.cpp:1:22: fatal error: TFT_eSPI.h: No such file or directory


    • Looking for TFT_eSPI.h dependency? Check our library registry!
    • CLI > platformio lib search "header:TFT_eSPI.h"
    • Web > https://platformio.org/lib/search?query=header:TFT_eSPI.h

    compilation terminated. Compiling .pio\build\ttgo\src\UI\GraphicEqualiser.cpp.o .pio\libdeps\ttgo\FastLED\src\platforms\esp\32\clockless_rmt_esp32.cpp: In static member function 'static void ESP32RMTController::interruptHandler(void*)': .pio\libdeps\ttgo\FastLED\src\platforms\esp\32\clockless_rmt_esp32.cpp:318:10: warning: unused variable 'stuff_to_do' [-Wunused-variable] bool stuff_to_do = false; ^ *** [.pio\build\ttgo\src\Application.cpp.o] Error 1 src\UI\GraphicEqualiser.cpp:3:22: fatal error: TFT_eSPI.h: No such file or directory


    • Looking for TFT_eSPI.h dependency? Check our library registry!
    • CLI > platformio lib search "header:TFT_eSPI.h"
    • Web > https://platformio.org/lib/search?query=header:TFT_eSPI.h

    compilation terminated. *** [.pio\build\ttgo\src\UI\GraphicEqualiser.cpp.o] Error 1

    opened by girs1982 3
  • Cloning Git Repo

    Cloning Git Repo

    Sorry for another question,

    git clone --recursive [email protected]:atomic14/esp32-tft-audio-monitor.git

    Cloning into 'esp32-tft-audio-monitor'... [email protected]: Permission denied (publickey). fatal: Could not read from remote repository.

    Please make sure you have the correct access rights and the repository exists.

    Is there something I need to do to gain permission?

    opened by anthonyjclarke 1
  • I2S_BITS_PER_SAMPLE_16BIT creates folding around Fs/2 with ICS-43434

    I2S_BITS_PER_SAMPLE_16BIT creates folding around Fs/2 with ICS-43434

    Hi Chris,

    Great project !

    I noticed that you have folding of the input frequencies around Fs/2.

    So for example, your FFT display goes up to 4kHz, but an input signal of 4.1kHz is displayed as 3.9kHz (ie Fs/2-4.1kHz, this alias frequency is apparent even on the time domain plot)

    I had similar problems with very different code (MicroPython, though of course still using espidf like Arduino under the hood), with a 1kHz input being aliased to 7kHz (Fs=16000, I2S_BITS_PER_SAMPLE_16BIT )

    image

    At first I thought it was ESP-IDF, but it seems it may be related to how the ICS-43434 decimation filter works; the datasheet shows 32 bitclocks per sample, not 16 (w. 24 bits of data). In any case, I found that using I2S_BITS_PER_SAMPLE_32BIT and dumping the bottom 8 bits fixed the issue for me.

    image

    opened by jetpax 1
  • Readme Git Wrong

    Readme Git Wrong

    Think your readme git is wrong. I just cloned your repository with recursive.

    This is awesome. Two other modifications (other than the Platformio changes):

    in main.cpp: //TFT_eSPI *display = new TFT_eSPI(240, 240); TFT_eSPI *display = new TFT_eSPI();

    In application.cpp:

    #define GPIO_BUTTON 0

    And then in Application::loop():

    digitalRead(GPIO_BUTTON);

    opened by dredvard 1
  • Adds support for analogue microphones

    Adds support for analogue microphones

    This is completely untested code. My TTGO is currently dead so I can't really test very much at the moment.

    This PR cleans up some of the I2S code and adds support for reading data from the ADC so you can use analog microphones.

    To enable the ADC just comment out line 16 of config.h and connect your mic to GPIO35.

    opened by cgreening 0
  • Feature request

    Feature request

    Hi! Thank you very much for your tutorials on ESP32 audio! I see you have starred pschatzmann/arduino-audio-tools - Is it likely that you can add your visualization classes to that library? ) It would be kind of Audio Swiss Knife...

    opened by UT2UH 0
  • Sketch coredumps because of race conditions and then aborts from time to time because of watchdog timer

    Sketch coredumps because of race conditions and then aborts from time to time because of watchdog timer

    1. Sketch core-dumps in infinite loop on the first m_sampler->read(m_sample_buffer, WINDOW_SIZE) call with the following output: ELF file SHA256: e1628abd6cce84a4

    Rebooting... ets Jun 8 2016 00:22:57

    rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:2 load:0x3fff0030,len:1184 load:0x40078000,len:13104 load:0x40080400,len:3036 entry 0x400805e4 [ 51][E][esp32-hal-gpio.c:102] __pinMode(): Invalid pin selected E (32) gpio: gpio_set_level(226): GPIO output gpio_num error Display is 240 x 135 Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.

    Core 0 register dump: PC : 0x400d9f34 PS : 0x00060030 A0 : 0x800d53a4 A1 : 0x3ffd6750 A2 : 0x00000000 A3 : 0x3ffb93b8 A4 : 0x00000400 A5 : 0x3ffd679c A6 : 0xffffffff A7 : 0x3ffc2858 A8 : 0x00000000 A9 : 0x3ffbea9c A10 : 0x3ffc2c90 A11 : 0x3ffc2c90 A12 : 0x3ffc2c90 A13 : 0x00060023 A14 : 0x00060021 A15 : 0x00000001 SAR : 0x00000000 EXCCAUSE: 0x0000001c EXCVADDR: 0x0000001c LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00000000

    Backtrace: 0x400d9f31:0x3ffd6750 0x400d53a1:0x3ffd6790 0x400d1af1:0x3ffd67c0 0x400d1b0d:0x3ffd67e0

    #0 0x400d9f31:0x3ffd6750 in i2s_read at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/driver/i2s.c:2264 (discriminator 2) #1 0x400d53a1:0x3ffd6790 in ADCSampler::read(short*, int) at lib/audio_input/src/ADCSampler.cpp:41 #2 0x400d1af1:0x3ffd67c0 in Application::process_samples() at src/application.cpp:50 #3 0x400d1b0d:0x3ffd67e0 in processing_task(void*) at src/application.cpp:17 (discriminator 1)

    Apparently, processing_task (and attempts to read samples) starts before i2s driver is initialized. It happens because of race conditions in void Application::begin() asynchronous processing task is created before i2s is initialized: xTaskCreatePinnedToCore(processing_task, "Processing Task", 4096, this, 2, &processing_task_handle, 0); ... m_sampler->start(); //here i2s driver is initizlied so processing task might already call i2s_read which would cause abort.

    The fix would be to call m_sampler->start(); first in the void Application::begin() and only then call xTaskCreatePinnedToCore(processing_task, "Processing Task", 4096, this, 2, &processing_task_handle, 0);

    After fixing the problem above, I've got another: 2. Sketch is running, but from time to time is aborts and restarts with the following output: E (30476) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time: E (30476) task_wdt: - IDLE (CPU 0) E (30476) task_wdt: Tasks currently running: E (30476) task_wdt: CPU 0: Processing Task E (30476) task_wdt: CPU 1: Drawing Task E (30476) task_wdt: Aborting.

    abort() was called at PC 0x400e04f5 on core 0

    Backtrace: 0x40083729:0x3ffbea2c |<-CORRUPTED

    #0 0x40083729:0x3ffbea2c in panic_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/panic.c:402

    This happens because all the tasks runs infinitely, but FreeRTOS wants at least some yeld for its housekeeping. Fix is to add vTaskDelay(1); inside the loop in the processing_task function

    opened by arek-jamanskiy 0
Owner
atomic14
atomic14
Serial Data Monitor is a multiplatform (Windows, Linux, Mac, ...) tool to interactively receive/edit/monitor data and send commands to an embedded system via the serial bus

See wiki for full documentation Serial Data Monitor Description Serial Data Monitor is a multiplatform (Windows, Linux, Mac, ...) tool to interactivel

monnoliv 4 Oct 29, 2021
A secure backup communication system. Doesn't use screens. Doesn't rely on cellular networks.

Secure Backup Communication Network (SEBCOM) A secure backup communication system. Doesn't rely on cellular networks. Doesn't use screens. What is it?

null 2 Oct 10, 2022
Bluetooth Monitor port for the ESP32

ESP32 BT Monitor What is it? This is a (at the moment partial) port of andrewjfreyer/monitor for the popular and super cheap ESP32 boards. For a more

null 38 Dec 28, 2022
Remote Arduino Uno-based TFT graphical display for VSR Mini Mega Alternator Regulator

VSMMAR_Remote_Display Remote Arduino Uno-based TFT graphical display for VSR Mini Mega Alternator Regulator This project is an optional accessory for

null 1 Nov 6, 2021
Prueba del Raspberry PI PICO con un display Raspberry PI TFT 3.5"

Raspberry-PI-PICO-display-RPI35 Prueba del Raspberry PI PICO con un display Raspberry PI TFT 3.5" Con ayuda de la libreria https://github.com/khoih-pr

null 1 Nov 10, 2021
ESP32-S2 1.54" x 1.54" TFT Display Board

ESP32-S2_Display_Board ESP32-S2 1.54" x 1.54" TFT Display Board This ESP32 internet of things device was an experiment to try out the new ESP32-S2 pro

Mike Rankin 8 Dec 8, 2022
Displaying @colorschemez tweets on 2.4" TFT display

colorschemez display This code takes the most recent tweet from the twitter account @colorschemez, and displays it onto a 2.4" TFT display. If you use

null 2 Dec 28, 2021
Arduino core for GD32 devices, community developed, based on original GigaDevice's core

GD32 Arduino Core (New) This is a Arduino core is based off of the original GigaDevice core that was provided by the company in early June 2021 (see h

null 46 Dec 24, 2022
PP-Speaker is a linux kernel alsa driver (parallel port audio, covox)

// SPDX-License-Identifier: GPL-2.0-or-later PP-Speaker driver for Linux Copyright (C) 2022-2022 ariel/KotCzarny ([email protected]) Small FAQ: Q: What

null 3 May 30, 2022
Heart Rate Monitor for FPV drones

Heart Rate Monitor for FPV drones Watch your heart rate on Betaflight OSD ?? See how excited you are while: Diving the highest skyscraper ?? Flying lo

Alexey Stankevich 16 Aug 7, 2022
ON AIR or OFF AIR Monitor with WFH

wfh_monitor_m5 M5 Stack ON AIR or OFF AIR Monitor with WFH Dependency Arduino IDE==1.8.13 Blynk==1.0.0 Setup Hardware M5 Stack Smartphone(Android or i

karaage 4 Feb 26, 2022
A tiny external monitor for PC using STM32 and ST7789. Connects to PC over USB and displays the captured screen on ST7789 (240x240) display.

STM32 Tiny Monitor A super tiny monitor for your PC, suitable for your pet ant. A python script sends the captured screen over USB to the STM32 microc

Avra Mitra 69 Dec 27, 2022
Vaccine Monitor app implemented in C with system Programming techniques.Projects implemented as part of the course Syspro K24

System_Programming_Projects Vaccine Monitor app implemented in C with system Programming techniques.Projects implemented as part of the course Syspro

Aristi_Papastavrou 10 Dec 30, 2021
Universal State Monitor software for home automation input devices

Universal State Monitor Copyright 2019-2021 SuperHouse Automation Pty Ltd www.superhouse.tv A binary state monitor for DIY home automation projects. T

SuperHouse Automation 3 Aug 24, 2021
A no bullshit battery monitor for OpenBSD

A no bullshit battery monitor for OpenBSD. In particular, really useful for running alongside cwm in case you don't run something like dzen2 or lemonbar. It is designed to be remisicent of the little boxes you get on FVWM and GNUStep.

Ashton Fagg 7 Dec 25, 2022
How To Build The NeXT ROM Monitor From Sources

How To Build The NeXT ROM Monitor From Sources

Jeffrey H. Johnson 15 Nov 20, 2022
ESP Insights is a remote diagnostics solution that allows users to remotely monitor the health of ESP devices in the field.

ESP Insights is a remote diagnostics solution that allows users to remotely monitor the health of ESP devices in the field.

Espressif Systems 46 Dec 26, 2022
jvm-monitor is a lightweight monitoring tool that logs all the local variables whenever exceptions occur.

jvm-monitor jvm-monitor is a Java agent attached to a Java VM (virtual machine), which logs all the local variables when exceptions occur. Rationales

Barosl Lee 13 Nov 21, 2021
An embedded CAN bus sniffer which is able to monitor any of the vehicle internal CAN bus and perform some action by triggering new CAN messages.

An embedded CAN bus sniffer which is able to monitor any of the vehicle internal CAN bus and perform some action by triggering new CAN messages. In this way certain vehicle functionality can be triggered by responding to custom steering wheel button events, or use the vehicle virtual cockpit to display OBD-PIDs values instead of relying on an external display to present new information to the user

null 18 Dec 28, 2022