element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Blog Halloween bathroom prank
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: natat_t
  • Date Created: 29 Oct 2019 4:23 PM Date Created
  • Views 1675 views
  • Likes 11 likes
  • Comments 5 comments
  • halloween 2019
  • circuitpython
  • sharethescare
  • arduino halloween project
  • arduino
  • halloween_project
Related
Recommended

Halloween bathroom prank

natat_t
natat_t
29 Oct 2019

I hosted a Halloween party last Saturday and I placed this simple prank in the bathroom. I used stuff I had at home, I mean at home we have boards, wires, tools, it is more like a small maker space.

I wanted the prank to involve sound and lights but I wasn't sure what would be a good trigger, I thought a PIR sensor would work but I didn't want it to be activated that often, so Abraham had one of those magnetic sensors used for alarms and then I thought the bathroom door would be a good placement for the prank. Whenever the door is opened some seconds after you would hear the psycho theme and some more seconds later another creepy wav file and the lights go ON/OFF.

image

Scary lightsimage

Things I used:

ItemQty

Circuit Playground Express

1

Digispark

1

Relay Module

1

Magnetic door sensor

1

Audio Jack 3.5mm cable

1

uUSB cable

1

Speaker with amp

1

Power bank with 2 ports

1

Audio sensor

1
Mini breadboard

1

Crocodile clips1 bunch
Dupont cables1 bunch

 

I used Circuit Playground Express to play some wav files. These are the tutorials I followed:

  • How to run circuitpython on CPX
  • Installing MU Editor
  • How to play wav files on CPX

 

  • How to process your audio files with Audacity

 

I first used Abraham's speaker with a differential amplifier but I thought it was not loud enough.

 

image

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

 

 

I remembered I had a small speaker with rechargeable battery so I decided to use it and a 3.5mm jack with the Circuit Playground Express.

image

Red cable to A0 pin con CPX and Black cable to GND

 

Since I had so little time, I decided to use a Digispark board and a generic audio sensor. A certain amount of noise would switch on/off the light bulb using a relay.

I used crocodile clips and Dupont cables so I didn't have to solder anything. The small breadboard was used to connect power and ground signals.

I put everything in a box and drilled holes for the speaker (a lot). The microphone had to be placed really close to the speaker.

Circuit playground Express and Digispark boards are powered with a 10,000mAh power bank with 2 ports, except for the speaker which had full charge.

Box with circuits

Put everything in a box

 

And the final setup:

 

image

Everything placed

 

The basic wiring:

 

image

Diagram draft using fritzing and MS paint

 

The switch is placed on the door frame and the magnet on the door, so when the door is closed the switch is also closed. In the previous image one of the switch pins is connected to ground, so the Circuit Playground Express will see a 0 on pin A1 when the door is closed.

image

Magnetic switch placement

 

When you open the door, the switch will open because it is not near the magnet and since pin A1 is declared with internal pull up, the Circuit Playground Express will see a 1.This is the Circuit Playground Express code:

import time
import board
import digitalio

from adafruit_circuitplayground.express import cpx
switchPin = digitalio.DigitalInOut(board.A1)
switchPin.pull = digitalio.Pull.UP

while True:
  if switchPin.value:
  time.sleep(8)
  #cpx.pixels.fill((255, 0, 0))
  cpx.play_file("psycho.wav")
  #cpx.pixels.fill((0, 0, 0))
  time.sleep(8)
  cpx.play_file("kidsLaugh.wav")
  time.sleep(0.1)

 

The Arduino code is fair simple whenever a level sound is detected it will toggle the light ON/OFF for a predefined period of time.

 

int ledPin=1;
int sensorPin=0;
boolean val =0;
unsigned long duration[10] = {400, 900, 500, 300, 200, 150, 800, 600, 100, 250};
int dur = 0;
void setup(){
  pinMode(ledPin, OUTPUT);
  pinMode(sensorPin, INPUT);
}

void loop (){
  val =digitalRead(sensorPin);
  if (val==HIGH) {
    dur = random(0,10);
    digitalWrite(ledPin, LOW);
    delay(duration[dur]);
    digitalWrite(ledPin, HIGH);
    dur = random(0,10);
    delay(duration[dur]);
  }
  else {
    digitalWrite(ledPin, LOW);  
  }
}

And a video.

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

I would recommend using SCR instead of the relay module to avoid the "clicking" sound. I only had the relay module at that moment image

And of course, optimize the wiring if you want a more permanent solution image

 

 

 

  • Sign in to reply

Top Comments

  • jw0752
    jw0752 over 5 years ago +3
    This is a good one. Thanks for sharing your innovative build. John
  • three-phase
    three-phase over 5 years ago +2
    Well done, a very creative little project for halloween. Kind regards.
  • clem57
    clem57 over 5 years ago +1
    A haunted bathroom in your home! natat_t I will never go there again.
  • e14phil
    e14phil over 5 years ago

    I was just going through my solid favorites from this halloween and this really is simple but so so effective!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • luislabmo
    luislabmo over 5 years ago

    Nice project, it is simple and effective, I can see it being used at haunted houses.

     

    Luis

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • clem57
    clem57 over 5 years ago

    A haunted bathroom in your home! natat_t  I will never go there again.image

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • three-phase
    three-phase over 5 years ago

    Well done, a very creative little project for halloween.

     

    Kind regards.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • jw0752
    jw0752 over 5 years ago

    This is a good one. Thanks for sharing your innovative build.

     

    John

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube