Skip to content

HalfbitStudio/Decibelmeter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Decibel Meter Project

Decibel Meter

A smart Decibel Meter based on ESP32-C3, featuring a round LCD display with a modern UI built using LVGL, and a web interface for remote monitoring and historical data analysis.

Features

  • Real-time Sound Level Measurement: Measures ambient noise levels in decibels (dB).
  • Dual UI Modes:
    • Gauge View: Analog-style gauge with current dB value and a "peak hold" indicator (red dot) that retains the maximum value for 2 seconds.
    • History Chart: Displays a bar chart of the last 2 hours of noise levels (5-minute resolution).
    • Auto-Switching: The display automatically toggles between the Gauge and History view every 30 seconds.
  • Web Interface:
    • Built-in web server accessible via local network.
    • Real-time historical chart visualization using Chart.js.
    • JSON API endpoint (/api/history) for data retrieval.
  • OTA Updates: Supports Over-The-Air firmware updates.
  • Round Display Support: UI optimized for 160x160 round TFT displays.

Hardware Requirements

  • Microcontroller: Seeed Studio XIAO ESP32C3 (or compatible ESP32-C3 board).
  • Display: Round TFT LCD (160x160 resolution) driven by TFT_eSPI (GC9A01 driver).
  • Microphone: I2S Microphone (e.g., INMP441).

Wiring

graph LR
    MCU[ESP32-C3]
    
    subgraph Display [GC9A01 Display]
        D_MOSI[MOSI]
        D_SCLK[SCLK]
        D_CS[CS]
        D_DC[DC]
        D_RST[RST]
    end

    subgraph Mic [INMP441 Microphone]
        M_WS[WS]
        M_SD[SD]
        M_SCK[SCK]
    end

    MCU -- GPIO 7 --> D_MOSI
    MCU -- GPIO 6 --> D_SCLK
    MCU -- GPIO 5 --> D_CS
    MCU -- GPIO 4 --> D_DC
    MCU -- GPIO 8 --> D_RST

    MCU -- GPIO 3 --> M_WS
    MCU -- GPIO 10 --> M_SD
    MCU -- GPIO 2 --> M_SCK
Loading

Display (GC9A01)

Pin ESP32-C3 GPIO
MOSI (SDA) 7
SCLK (SCL) 6
CS 5
DC 4
RST 8
VCC 3.3V
GND GND

Microphone (INMP441)

Pin ESP32-C3 GPIO
WS (LRC) 3
SD (DOUT) 10
SCK (BCLK) 2
VCC 3.3V
GND GND

Software Dependencies

The project is built using PlatformIO and depends on the following libraries:

  • LVGL (v9.4.0): For the graphical user interface.
  • TFT_eSPI: For display driving (included in lib/).
  • ArduinoOTA: For wireless firmware updates.
  • WebServer: For the HTTP interface.

Installation

  1. Clone the repository:

    git clone https://github.com/HalfbitStudio/Decibelmeter.git
    cd Decibelmeter
  2. Configure WiFi: Open include/network.h (or src/network.cpp depending on implementation) and set your WiFi credentials:

    const char* ssid = "YOUR_WIFI_SSID";
    const char* password = "YOUR_WIFI_PASSWORD";
  3. Build and Upload: Connect your ESP32-C3 via USB and run:

    pio run --target upload
  4. OTA Upload (Optional): If the device is already running and connected to WiFi, you can upload via OTA:

    pio run --target upload --environment esp32-c3-devkitm-1-ota

    Note: Default OTA password is set in platformio.ini.

Usage

On Device

  • Power on the device.
  • The splash screen will appear, followed by the connection status.
  • Once connected, the main Gauge View will appear.
  • The screen will automatically switch to the History Chart every 30 seconds.

Web Interface

  • Find the IP address of the device (monitor the serial output on boot or check your router).
  • Open a web browser and navigate to http://<DEVICE_IP>/.
  • You will see a live chart of the recorded sound levels.

Project Structure

  • src/main.cpp: Main entry point, setup, and loop.
  • src/ui.cpp: LVGL UI implementation (Gauge, Chart, Animations).
  • src/web_server.cpp: Web server logic and history data management.
  • src/audio_processing.cpp: dB calculation logic.
  • src/microphone.cpp: I2S microphone handling.
  • src/network.cpp: WiFi and OTA management.
  • include/lv_conf.h: LVGL configuration file.
  • include/history_storage.h: History storage API (SPIFFS persistence)
  • src/history_storage.cpp: SPIFFS-based load/save logic for chart history.

License

Copyright (c) Halfbit Studio. All rights reserved.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages