Punch Through
Published © MIT

Play audio from SD card/Elevator fart prank

Want to prank all those business people on the elevator ? Follow this DIY prank-friendly tutorial!

AdvancedFull instructions provided1,935
Play audio from SD card/Elevator fart prank

Things used in this project

Hardware components

LightBlue Bean
Punch Through LightBlue Bean
×1
microSD card with microSD to SD adapter
×1
Adafruit Amplifier
×1
4 ohm 3W speaker
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Male header pins
×1
Female header pins
×1
Breadboard (generic)
Breadboard (generic)
×1
2xAA battery holder
With batteries
×2

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
An elevator!

Story

Read more

Schematics

Schematics

Code

SD Audino Example

C#
/* 
  This sketch uses a LightBlue Bean to play an audio file from an SD card. 
  
  In the example, a LightBlue Bean is put in an elevator and plays an fart
  sound as soon as the elevator moves. Make sure that the Bean's front is facing 
  up when running the sketch.
    
  This example code is in the public domain.
*/

#include <SD.h>
#define SD_ChipSelectPin 2
#include <TMRpcm.h>

TMRpcm tmrpcm;

int upperThreshold = 290;
int lowerThreshold = 220;

void setup() {
  tmrpcm.speakerPin = 1;
  Serial.begin();

  if (!SD.begin(SD_ChipSelectPin)) {
    Serial.println("SD fail");
    return;
  }
}

void loop() {
  int acceleration = Bean.getAccelerationZ();
  if (acceleration > upperThreshold || acceleration < lowerThreshold) {
    delay(3000);
    tmrpcm.play("fart.wav");
    delay(15000);
  }

  Bean.sleep(100);
}

Github

https://github.com/tfg13/TMRpcm

Github

https://github.com/PunchThrough/Play-Audio-From-SD-Card

Credits

Punch Through

Punch Through

16 projects • 41 followers
We’ve been building connected products since 2009. Our diverse team has expertise in every layer from hardware to software to web.

Comments