Do you struggle to keep your hands off the snack cabinet? We’ve all been there, opening the cupboard at midnight for “just one more” biscuit. But what if your snacks could fight back?
In this project, we’ll build a fun (and slightly mean) gadget called the Snack Shame Station. Every time someone opens the snack cabinet, the device will play a random insult or funny meme sound to discourage them. When the cabinet is closed again, the sound will stop.
It’s not exactly a useful device, but it’s guaranteed to get laughs from friends and family, and it also shows the cool ways we can combine an IR sensor with the DFPlayer Mini MP3 module.
How It Works
The idea is simple:
- An IR sensor detects when the cabinet door is opened or closed.
- If the door is opened, the Arduino triggers the DFPlayer Mini to play a random audio file from an SD card (our “insults” or “meme sounds”).
- When the door is closed, the DFPlayer stops playback.
This way, the cabinet literally talks back whenever someone tries to sneak in for snacks.
Components Required
To build the Snack Shame Station, you’ll need:
- Arduino Uno (or any compatible board)
- DFPlayer Mini MP3 Module
- IR Obstacle Avoidance Sensor (or simple IR beam-break sensor)
- Speaker (small 3W or 8Ω speaker works well)
- MicroSD Card (formatted to FAT32, loaded with MP3 sounds)
- Jumper wires, breadboard, and power supply
Optional: A 3D-printed or cardboard mount to fix the sensor near your cabinet door.
Circuit Diagram
- DFPlayer Mini connects to Arduino through SoftwareSerial pins.
- The IR sensor outputs a digital HIGH when the cabinet opens.
- The speaker is connected to DFPlayer Mini’s output pins.
Component | Pin on Arduino Uno | Notes |
---|---|---|
IR Sensor OUT | D2 | Digital signal pin to detect cabinet open/close |
IR Sensor VCC | 5V | Power for the IR sensor |
IR Sensor GND | GND | Ground |
DFPlayer Mini RX | D11 (Arduino TX) | Connected through SoftwareSerial |
DFPlayer Mini TX | D10 (Arduino RX) | Connected through SoftwareSerial |
DFPlayer Mini VCC | 5V | Power for DFPlayer (use stable 5V supply) |
DFPlayer Mini GND | GND | Common ground with Arduino |
Speaker + | SPK_1 | Connect directly to DFPlayer output |
Speaker – | SPK_2 | Connect directly to DFPlayer output |

💡 Note: It’s recommended to power this project with a stable 5V DC adapter or regulated input supply instead of relying only on the Arduino’s USB port. This ensures the DFPlayer Mini and speaker get enough current for reliable playback and optimal performance.
Required Library
To control the DFPlayer Mini, we’ll need the DFRobotDFPlayerMini library. You can install it in two ways:
- From Arduino IDE Library Manager (Recommended):
- Open the Arduino IDE
- Go to Sketch > Include Library > Manage Libraries…
- In the Library Manager, search for DFRobotDFPlayerMini
- Click Install
- From GitHub (Manual Installation):
- 👉 Download the library from GitHub
- Extract the ZIP file and place it inside your Arduino
libraries
folder.
Arduino Code
Here’s the complete sketch for the Snack Shame Station project:
#include <SoftwareSerial.h>
#include <DFRobotDFPlayerMini.h>
SoftwareSerial mySerial(10, 11); // RX, TX for DFPlayer
DFRobotDFPlayerMini dfPlayer;
const int IR_SENSOR_PIN = 2; // IR sensor digital output
bool cabinetOpen = false;
void setup() {
Serial.begin(9600);
mySerial.begin(9600);
pinMode(IR_SENSOR_PIN, INPUT);
if (!dfPlayer.begin(mySerial)) { // Init DFPlayer Mini
Serial.println("DFPlayer Mini not detected!");
while (true);
}
dfPlayer.volume(30); // Set volume (0 to 30)
}
void loop() {
int sensorState = digitalRead(IR_SENSOR_PIN);
if (sensorState == HIGH && !cabinetOpen) {
// Cabinet opened (IR beam is broken)
Serial.println("Cabinet Opened! Playing insult...");
playRandomInsult();
cabinetOpen = true;
}
else if (sensorState == LOW && cabinetOpen) {
// Cabinet closed (IR beam restored)
Serial.println("Cabinet Closed! Stopping sound...");
dfPlayer.stop();
cabinetOpen = false;
}
delay(500); // Small delay to prevent rapid triggering
}
void playRandomInsult() {
int trackNumber = random(1, 9); // Random from 1 to 8
dfPlayer.play(trackNumber);
}
Preparing the Audio Files
- Take an SD card and format it to FAT32.
- Copy your insult/meme MP3 files into the card.
- Make sure they are named as:
0001.mp3
0002.mp3
0003.mp3
… etc.
- Make sure they are named as:
- Insert the SD card into the DFPlayer Mini.
👉 In the code above, random(1, 9)
means we have 8 files (0001.mp3 to 0008.mp3). You can add more or fewer files depending on how many roast lines you want.
Download the MP3 files we used from the link below:
Funny Insults / Meme Ideas
Here are some hilarious sound bites you can add:
- “Step away from the snacks, soldier!”
- “Do you really need more chips?”
- “Error: Self-control not detected.”
- “Bro, it’s midnight. Eat an apple.”
- Meme voice: “EW, brother… ew!”
- Meme voice: “Mission failed, we’ll get ‘em next time.”
- Meme voice: “Bruh…”
- Sarcastic AI: “Snack detected. Shame initiated.”
(You can record your own, use meme clips, or generate AI voices. The sillier, the better!)
Demo Video
We also made a YouTube Short showing this project in action, check it out below:
Possible Improvements
This project is just for fun, but you could extend it further:
- Use a PIR motion sensor to detect sneaky hand movements.
- Add an OLED display with sarcastic text messages.
- Connect it to IoT (ESP32 + Blynk) to log how many times the cabinet was opened.
Conclusion
The Snack Shame Station is a fun little project that turns an ordinary cabinet into a comedy device. With just an IR sensor and the DFPlayer Mini, you can add personality, humor, and maybe even a little guilt to your snacking habits.
If you’re new to working with these components, don’t forget to check our detailed guides on:
And if you build your own Snack Shame Station, share your version, we’d love to see what kind of roasts you added!