Skip to content

Latest commit

Β 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”ŠβžœπŸ’₯ dB to LCD to Action

Measure dB level, display, and take action.

My first project published on r/raspberry_pi got very nice feedback and made it to the Top 10 of 2025 posts. Published with the tongue in cheek title "Raspberry Pi decibel monitor + SNMP = instant parental justice", it showed how I hooked a dB sensor and an LCD screen to throttle bandwidth on the network switch to a loud gaming kid. "More yell ? More ping :Þ"
Here are all the details and code.

Sans-titre-3

πŸ’‘ Concept

This project has been a lot of fun with my kid actually (details in the Reddit thread comments). The idea was the following :

  • Measure noise level in dB
  • Display noise level
  • Take measure accordingly : throttle bandwidth on the network to induce lag if threshold surpassed

⚠️ Disclaimer : it won't work for you

Per popular demand I'm publishing all my code, but... It's not like there a magical universal command to adjust bandwidth on your home network switch. It's dependant on your network switch, if capable at all.

The code presented here will serve more as a starting point for your own project. Light some LEDs ? Fiddle with an SNMP capable switch ? Play a warning sound ? It all depends on your needs and hardware capability.

πŸ–₯️ Hardware I used

  • Sound sensor from PCB Artist (~$22)
  • 1.28 inch round LCD screen from Waveshare (~$15)
  • A Raspberry (I used a Pi 3 A+ for the record)
  • (A network switch with SNMP support)

🧩 Setup and code

Out of the box, the "measure and display" parts are fully functional. Everything can be configured via an .env file : copy .env-example and adjust.

  • utils/sensor.py has the very simple code to measure dB level
  • In utils/lcd.py you will find everything to display on the LCD screen. It generates an image on the fly with all the info, using a template image found in assets/db_levels
  • You will want to edit and customize utils/actions.py to code what action you will want to take. There are placeholders and messages logged to help you through it, but you will be on your own.
    You will find the exact code I used to throttle and restore the bandwidth on my network switch but, again, this won't work for you.

You will need to sudo apt get install i2c-tools, and pip install the following :

  • dotenv
  • pillow
  • spidev
  • numpy
  • smbus
  • RPi.GPIO

πŸ“· Pictures

Prototype :

image

πŸ“ License

My second Python project πŸŽ‰

Everything licensed under the WTF Public License. WTFPL Feel free to do whatever the hell you want with it.

About

πŸ”ŠβžœπŸ’₯ Monitor dB level and take action (like : throttle bandwidth of your yelling gamer kid)

Topics

Resources

Stars

15 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages