# HalloWing Jump Scare Trap

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/062/675/medium800/proximity_IMG_1383_2k.jpg?1538155456)

https://youtu.be/ycleY8qi1yI

Jump scares are fun, but how about a jump scare that is fully automated? Even better! This one uses the HalloWing with a PIR motion sensor, servo motor, and speaker to detect victims and drop a creepy rubber bug right in front of them as it hisses terrifyingly!

You can plug these parts right into your HalloWing, code it in CircuitPython, and get to scaring people in no time.

## Parts
### Adafruit HalloWing M0 Express

[Adafruit HalloWing M0 Express](https://www.adafruit.com/product/3900)
[This is Hallowing..this is Hallowing... Hallowing! Hallowing!&nbsp;](https://www.youtube.com/watch?v=kGiYxCUAhks&t=39s)

Are you the kind of person who doesn't like taking down the skeletons and spiders until after January? Well, we've got the development board for...

In Stock
[Buy Now](https://www.adafruit.com/product/3900)
[Related Guides to the Product](https://learn.adafruit.com/products/3900/guides)
![Video of a blinking eye on a Adafruit HalloWing M0 Express.](https://cdn-shop.adafruit.com/product-videos/640x480/3900-07.jpg)

### PIR (motion) sensor

[PIR (motion) sensor](https://www.adafruit.com/product/189)
PIR sensors are used to detect motion from pets/humanoids from about 20 feet away (possibly works on zombies, not guaranteed). This one has an adjustable delay before firing (approx 2-4 seconds), adjustable sensitivity **and** we include a 1 foot (30 cm) cable with a socket so you...

Out of Stock
[Buy Now](https://www.adafruit.com/product/189)
[Related Guides to the Product](https://learn.adafruit.com/products/189/guides)
![Angled Shot of the PIR (motion) sensor.](https://cdn-shop.adafruit.com/640x480/189-04.jpg)

### Micro servo

[Micro servo](https://www.adafruit.com/product/169)
Tiny little servo can rotate approximately 180 degrees (90 in each direction) and works just like the standard kinds you're used to but _smaller_. You can use any servo code, hardware, or library to control these servos. Good for beginners who want to make stuff move without...

In Stock
[Buy Now](https://www.adafruit.com/product/169)
[Related Guides to the Product](https://learn.adafruit.com/products/169/guides)
![Micro servo with three pin cable](https://cdn-shop.adafruit.com/640x480/169-06.jpg)

### STEMMA JST PH 2mm 3-Pin to Female Socket Cable - 200mm

[STEMMA JST PH 2mm 3-Pin to Female Socket Cable - 200mm](https://www.adafruit.com/product/3894)
This cable will let you turn a JST PH 3-pin cable port into 3 individual wires with high-quality 0.1" female header sockets on the end. We're carrying these to match up with our Hallowing, for extending and connecting sensors or LEDs - and the wires are even color coded!

<a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/3894)
[Related Guides to the Product](https://learn.adafruit.com/products/3894/guides)
![Angled shot of STEMMA JST PH 3-Pin to Female Header Cable - 200mm.](https://cdn-shop.adafruit.com/640x480/3894-03.jpg)

### STEMMA JST PH 2mm 3-Pin to Male Header Cable - 200mm

[STEMMA JST PH 2mm 3-Pin to Male Header Cable - 200mm](https://www.adafruit.com/product/3893)
This cable will let you turn a JST PH 3-pin cable port into 3 individual wires with high-quality 0.1" male header plugs on the end. We're carrying these to match up with our Hallowing, for extending and connecting sensors or LEDs - and the wires are even color coded!

<a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/3893)
[Related Guides to the Product](https://learn.adafruit.com/products/3893/guides)
![Angled shot of STEMMA JST PH 3-Pin to Male Header Cable - 200mm.](https://cdn-shop.adafruit.com/640x480/3893-03.jpg)

### 5V 2.5A Switching Power Supply with 20AWG MicroUSB Cable

[5V 2.5A Switching Power Supply with 20AWG MicroUSB Cable](https://www.adafruit.com/product/1995)
Our all-in-one 5V 2.5 Amp + MicroUSB cable power adapter is the perfect choice for powering single-board computers like Raspberry Pi, BeagleBone, or anything else that's power-hungry!

This adapter was specifically designed to provide 5.25V, not 5V, but we still call it a 5V USB...

In Stock
[Buy Now](https://www.adafruit.com/product/1995)
[Related Guides to the Product](https://learn.adafruit.com/products/1995/guides)
![MicroUSB power supply with bundled cable and U.S. plugs.](https://cdn-shop.adafruit.com/640x480/1995-02.jpg)

## Materials

In addition to the above parts, you'll need the following:

- Thin thread or mono-filament fishing line
- Creepy rubber bug
- Double stick foam tape
- Cardstock
- Cardboard or corrugated plastic for mounting
- Gaffer's tape

# HalloWing Jump Scare Trap

## Build the Jump Scare Trap Circuit

![](https://cdn-learn.adafruit.com/assets/assets/000/062/560/medium800/proximity_roach_fritz.png?1537972451)

Building the circuit for your Jump Scare Trap is quick and easy -- you'll just need to plug a few things into some cables and ports on the HalloWing!

![](https://cdn-learn.adafruit.com/assets/assets/000/062/639/medium800/proximity_IMG_1409_2k.jpg?1538146709)

These are the connections to make:

- Speaker plugs into HalloWing **SPEAKER A0** port
- Servo plugs into JST PH 3-pin to Male Socket cable:
  - Brown servo GND to cable Black
  - Orange servo Power to cable Red
  - Yellow Data line to cable White

- This servo cable plugs into HalloWing **NEOPIX 4** port
- PIR sensor plug into the JST PH 3-pin to Female Socket cable:
  - PIR GND to Black
  - PIR Data to White
  - PIR +5V to Red

- Then, plug this cable into the **SENSE** port on the HalloWing

![](https://cdn-learn.adafruit.com/assets/assets/000/062/641/medium800/proximity_IMG_1415.jpg?1538147490)

![](https://cdn-learn.adafruit.com/assets/assets/000/062/640/medium800/proximity_IMG_1361_2k.jpg?1538147472)

## Mounting

You'll need to mount the circuit on a piece of corrugated plastic or cardboard so it's easier to deploy on your port or door frame.

First, cut a small piece of board roughly 10" x 4", then use a hobby knife to cut a ~2-1/2" square from the board as shown to fit the PIR sensor's lens base (the white square under the dome). This is where the sensor will peek out at your oncoming victims!

![](https://cdn-learn.adafruit.com/assets/assets/000/062/642/medium800/proximity_IMG_1355_2k.jpg?1538147692)

Danger: 

Push the PIR sensor into place in the cutout.

![](https://cdn-learn.adafruit.com/assets/assets/000/062/643/medium800/proximity_IMG_1356_2k.jpg?1538147701)

![](https://cdn-learn.adafruit.com/assets/assets/000/062/644/medium800/proximity_IMG_1357_2k.jpg?1538147711)

## Sensor Lens Blocker

By default, the lens has a very wide field of view. This will cause the sensor to trip the alarm when people are approaching from the side. We want to maximize the frights by having them positioned under the trap when it drops its creepy payload in front of them!

Shape the sensor by folding a small piece of black cardstock like a hood and fitting it over the lens, pushing it into the hole you made in the board.

## HalloWing & Speaker Mount

Use double stick foam tape to mount the HalloWing to the board as shown here, followed by the speaker.

![](https://cdn-learn.adafruit.com/assets/assets/000/062/649/medium800/proximity_IMG_1364_2k.jpg?1538148003)

## Servo Mount

Use tape again to mount the micro servo on the board. It is from this spot that is the creepy bug will be staged and then dropped from a length of thread or fishing line!

![](https://cdn-learn.adafruit.com/assets/assets/000/062/653/medium800/proximity_IMG_1366_2k.jpg?1538148097)

Next, we'll program the Jump Scare Trap using CircuitPython.

# HalloWing Jump Scare Trap

## Code with CircuitPython

## CircuitPython Setup

For this project you need to ensure your version of CircuitPython is at least 3.0. Adafruit recommends the latest version available by clicking the green button below. Download the file to your Downloads folder, Desktop, etc. (a place you'll remember for the next step).

To load the downloaded file, plug in the HalloWing over USB to your computer and then double-click the reset button on the HalloWing. This will put it into bootloader mode, allowing you to change the firmware. You'll see a USB drive appear on your computer called&nbsp; **HALLOWBOOT.**

Drag the .uf2 file you downloaded onto the&nbsp; **HALLOWBOOT&nbsp;** drive. Once it copies over, it will automatically restart, show up as a drive named **CIRCUITPY** and you will be ready to load a CircuitPython program.

Adafruit really likes using the Mu editor to edit the CircuitPython code.&nbsp;[See this guide on loading and using Mu](https://learn.adafruit.com/welcome-to-circuitpython/installing-mu-editor).

[Download the latest version of CircuitPython for this board via CircuitPython.org](https://circuitpython.org/board/hallowing_m0_express/)
## Libraries

You'll also need to add a code library for this project. [Follow this guide](https://learn.adafruit.com/adafruit-hallowing/circuitpython-libraries) on adding libraries. The only one you'll need is the **adafruit\_motor** folder from the Circuit Python bundle in the **lib** folder, so just drag it from your downloaded, unzipped **lib** folder onto the HalloWing's **lib** folder.

## Code Outline

Here's the basic flow of our trap:

- Startup
- Rotate the servo arm to the **set** position
- Watch for the PIR sensor to be triggered
- Play hissing sound over the speaker
- Rotate the servo to drop the creepy bug
- Wait for the screaming to subside
- Rotate the servo back to the **set** position
- Wait for the user to press the reset cap touch tooth button
- Begin waiting for the PIR sensor to be tripped again

## User Feedback

In order to help you (or your lab assistant Igor) in setting the trap, we'll use the LCD TFT screen on the HalloWing to provide status messages and prompts.

Here are the screens we'll use:

The simplest way to us the HalloWing screen currently is as an image player to show pre-generated bitmap graphics. Download this .zip file and then uncompress it. Plug in you HalloWing and then drag the four .bmp files onto the root level of your HalloWing's **CIRCUITPY** USB drive.

[jump_scare_trap_bmps.zip](https://cdn-learn.adafruit.com/assets/assets/000/062/660/original/jump_scare_trap_bmps.zip?1538149244)
## Audio Playback

We'll use two methods of audio playback with the&nbsp;`audio.play()` -- for beeping we'll use the tone playback of a sine wave sample, and for hissing we'll use the `audiocore.WaveFile()` playback method.

Download this wave file and drag it onto your HalloWing's **CIRCUITPY** drive at the root level.

[hiss01.wav](https://cdn-learn.adafruit.com/assets/assets/000/062/672/original/hiss01.wav?1538154316)
## Code

Here is the code we'll use. Copy it and then paste in Mu. Save it to your HalloWing as **code.py**

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/HalloWing_Jump_Scare_Trap/code.py

Next we'll test out the code and deploy the trap!

# HalloWing Jump Scare Trap

## Deploy the Jump Scare Trap

![](https://cdn-learn.adafruit.com/assets/assets/000/062/662/medium800/proximity_IMG_1324_2k_b.jpg?1538153212)

Your creepy prop insect or spider is going to be bungee jumping! Loop a length of fishing line or thread around your rubber bug, leaving a bit of slack that can slip over the servo arm. Secure the other end to the board or the servo body so it will be suspended when the bug drops.

You can add a bit of hot glue as seen above to keep the bug positioned properly in the loop.

## Please Standby

When you power on the Jump Scare Trap the screen will ask you to "Please Standby" while it resets the servo and allows the PIR sensor to settle. This is when you can hook your bug's release loop around the servo arm.

![](https://cdn-learn.adafruit.com/assets/assets/000/062/663/medium800/proximity_IMG_1401_2k.jpg?1538153286)

## Trap Set

After it settles, you'll see the "Trap Set" screen.

![](https://cdn-learn.adafruit.com/assets/assets/000/062/664/medium800/proximity_IMG_1402_2k.jpg?1538153350)

## Trap Sprung!

Now, wave your hand in front of the PIR sensor -- the trap will spring, the hissing sound will play, and the servo arm will rotate to drop the bug payload!

![](https://cdn-learn.adafruit.com/assets/assets/000/062/665/medium800/proximity_IMG_1404_2k.jpg?1538153582)

![](https://cdn-learn.adafruit.com/assets/assets/000/062/666/medium800/proximity_IMG_1405_2k.jpg?1538153595)

![](https://cdn-learn.adafruit.com/assets/assets/000/062/667/medium800/proximity_IMG_1408_2k.jpg?1538153612)

## Reset Trap

Now you'll be asked to reset the trap. Loop the bug back over the servo arm and press the left tooth cap touch pad. The screen will then ask you to standby, and then the trap will be once again set and ready to scare the next visitor!

![](https://cdn-learn.adafruit.com/assets/assets/000/062/668/medium800/proximity_IMG_1411_2k.jpg?1538153852)

![](https://cdn-learn.adafruit.com/assets/assets/000/062/669/medium800/proximity_IMG_1413_2k.jpg?1538153868)

![](https://cdn-learn.adafruit.com/assets/assets/000/062/670/medium800/proximity_IMG_1402_2k_b.jpg?1538153904)

https://youtu.be/ucmHonH0dGo

## Deploy!

You are ready to deploy the trap! You can use gaffer's tape to attach the board to a porch beam or door frame, with the PIR sensor pointed at the path your visitors will take.

I also ran a USB power cable along the top of the beam to keep the trap running all night long.

![](https://cdn-learn.adafruit.com/assets/assets/000/062/673/medium800/proximity_IMG_1377_2k.jpg?1538154896)

![](https://cdn-learn.adafruit.com/assets/assets/000/062/674/medium800/proximity_IMG_1382_2k.jpg?1538154908)

https://youtu.be/ycleY8qi1yI


## Guide Products

### Adafruit HalloWing M0 Express

[Adafruit HalloWing M0 Express](https://www.adafruit.com/product/3900)
[This is Hallowing..this is Hallowing... Hallowing! Hallowing!&nbsp;](https://www.youtube.com/watch?v=kGiYxCUAhks&t=39s)

Are you the kind of person who doesn't like taking down the skeletons and spiders until after January? Well, we've got the development board for...

In Stock
[Buy Now](https://www.adafruit.com/product/3900)
[Related Guides to the Product](https://learn.adafruit.com/products/3900/guides)
### PIR (motion) sensor

[PIR (motion) sensor](https://www.adafruit.com/product/189)
PIR sensors are used to detect motion from pets/humanoids from about 20 feet away (possibly works on zombies, not guaranteed). This one has an adjustable delay before firing (approx 2-4 seconds), adjustable sensitivity **and** we include a 1 foot (30 cm) cable with a socket so you...

Out of Stock
[Buy Now](https://www.adafruit.com/product/189)
[Related Guides to the Product](https://learn.adafruit.com/products/189/guides)
### Micro servo

[Micro servo](https://www.adafruit.com/product/169)
Tiny little servo can rotate approximately 180 degrees (90 in each direction) and works just like the standard kinds you're used to but _smaller_. You can use any servo code, hardware, or library to control these servos. Good for beginners who want to make stuff move without...

In Stock
[Buy Now](https://www.adafruit.com/product/169)
[Related Guides to the Product](https://learn.adafruit.com/products/169/guides)
### STEMMA JST PH 2mm 3-Pin to Female Socket Cable - 200mm

[STEMMA JST PH 2mm 3-Pin to Female Socket Cable - 200mm](https://www.adafruit.com/product/3894)
This cable will let you turn a JST PH 3-pin cable port into 3 individual wires with high-quality 0.1" female header sockets on the end. We're carrying these to match up with our Hallowing, for extending and connecting sensors or LEDs - and the wires are even color coded!

<a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/3894)
[Related Guides to the Product](https://learn.adafruit.com/products/3894/guides)
### STEMMA JST PH 2mm 3-Pin to Male Header Cable - 200mm

[STEMMA JST PH 2mm 3-Pin to Male Header Cable - 200mm](https://www.adafruit.com/product/3893)
This cable will let you turn a JST PH 3-pin cable port into 3 individual wires with high-quality 0.1" male header plugs on the end. We're carrying these to match up with our Hallowing, for extending and connecting sensors or LEDs - and the wires are even color coded!

<a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/3893)
[Related Guides to the Product](https://learn.adafruit.com/products/3893/guides)
### 5V 2.5A Switching Power Supply with 20AWG MicroUSB Cable

[5V 2.5A Switching Power Supply with 20AWG MicroUSB Cable](https://www.adafruit.com/product/1995)
Our all-in-one 5V 2.5 Amp + MicroUSB cable power adapter is the perfect choice for powering single-board computers like Raspberry Pi, BeagleBone, or anything else that's power-hungry!

This adapter was specifically designed to provide 5.25V, not 5V, but we still call it a 5V USB...

In Stock
[Buy Now](https://www.adafruit.com/product/1995)
[Related Guides to the Product](https://learn.adafruit.com/products/1995/guides)

## Related Guides

- [PIR Motion Sensor](https://learn.adafruit.com/pir-passive-infrared-proximity-motion-sensor.md)
- [Adafruit Hallowing M0](https://learn.adafruit.com/adafruit-hallowing.md)
- [No-Code WipperSnapper Water Detection](https://learn.adafruit.com/water-detection-with-wippersnapper.md)
- [Set up Home Assistant with a Raspberry Pi](https://learn.adafruit.com/set-up-home-assistant-with-a-raspberry-pi.md)
- [NeoTrellis Tabletop RPG Soundboard](https://learn.adafruit.com/neotrellis-dungeon-crawl-soundboard.md)
- [Buttermilk Boat with Circuit Playground Express](https://learn.adafruit.com/boat-with-circuit-playground-express.md)
- [Adafruit Feather RP2350 with HSTX](https://learn.adafruit.com/adafruit-feather-rp2350.md)
- [PyPortal Case](https://learn.adafruit.com/pyportal-case.md)
- [Adafruit IO Home: Security ](https://learn.adafruit.com/adafruit-io-home-security.md)
- [Tree with Animated Eyes and Motion Sensor](https://learn.adafruit.com/tree-ent-sculpture-with-animated-eyes.md)
- [PyPortal MQTT Sensor Node/Control Pad for Home Assistant](https://learn.adafruit.com/pyportal-mqtt-sensor-node-control-pad-home-assistant.md)
- [Using micro:bit and CRICKIT with MicroPython](https://learn.adafruit.com/using-micro-bit-and-crickit-with-micropython.md)
- [Trash Panda](https://learn.adafruit.com/trash-panda-circuit-python-crickit.md)
- [Zelda Master Sword](https://learn.adafruit.com/zelda-master-sword.md)
- [How to Convert a JVC Videosphere into a Monitor for Raspberry Pi and Desktop Computers](https://learn.adafruit.com/using-a-videosphere-as-a-digital-monitor.md)
- [Using ItsaSNAP for HomeKit PIR Motion Detection](https://learn.adafruit.com/itsasnap-homekit-pir-motion-detection.md)
- [Lucky Cat with Circuit Playground Express](https://learn.adafruit.com/lucky-cat-with-circuit-playground-express.md)
