HalloWing Jump Scare Trap

Similar documents
Milk Jug Glow Skull. Created by John Park. Last updated on :28:36 PM UTC

The Scream: Interactive Screaming Painting

Trash Panda. Created by Dano Wall. Last updated on :30:46 AM UTC

Slider Crank Mechanism -- from Cardboard and Craft Sticks

Crickit Dancing Marionette Kit Created by Dano Wall. Last updated on :03:11 PM UTC

Crickit Carnival Bumper Bot

Pushrod Garage. Created by John Park. Last updated on :07:30 PM UTC

Stumble-Bot. Created by Dano Wall. Last updated on :04:06 AM UTC

Snake Charmer Box. Created by Dano Wall. Last updated on :07:25 PM UTC

Ping Pong Ball Launcher

Adabot Operation Game

Crawling Animatronic Hand

Reindeer Mask with Animated Eyes

BLE Light Switch with Feather nrf52840 and Crickit

Paper Airplane Launcher

Crawling Baby Sea Turtle Robot

PyPortal NeoPixel Color Picker Created by Kattni Rembor. Last updated on :42:41 PM UTC

Android GBoard Morse Code Control with Circuit Playground Express

Crickit Powered Mini Chair Swing Ride!

Spinning Disc Step Sequencer

Clockwork Goggles. Created by John Park. Last updated on :03:10 PM UTC

Interior Purse Light. Created by Becky Stern. Last updated on :41:08 PM UTC

Wind Blowing Emoji Prop

Circuit Playground Express Laser Tag

Neon LED Signs. Created by John Park. Last updated on :11:09 PM UTC

Hammer Time Mini Golf Hazard with Crickit

Adafruit LED Sequins. Created by Becky Stern. Last updated on :02:00 AM UTC

Bunny Ears with MakeCode

Adafruit AMG8833 8x8 Thermal Camera Sensor

Circuit Playground Express Head-Tilt Ears

PyPortal View Master Created by Ruiz Brothers. Last updated on :51:28 AM UTC

Adafruit Capacitive Touch Sensor Breakouts

Infinity Mirror Valentine's Candy Box

Crickit Powered Holiday Diorama

i2c/spi LCD Backpack Created by lady ada Last updated on :11:04 PM UTC

Adafruit MCP9808 Precision I2C Temperature Sensor Guide

Adafruit Mini TFT " 160x80

Solar Boost Bag. Created by Becky Stern. Last updated on :44:55 PM UTC

Adafruit DRV2605 Haptic Controller Breakout

Magical Mistletoe. Created by Leslie Birch. Last updated on :45:29 PM UTC

Con Badge with Circuit Playground Express

Adafruit VL53L0X Time of Flight Micro-LIDAR Distance Sensor Breakout

Adafruit AM2320 Sensor

Naughty or Nice Machine

UFO Flying Saucer with Circuit Playground Express

Mini Golf Course with Circuit Playground and Crickit

Easy Sparkle Pocket T-Shirt

CircuitPlayground Minecraft Gesture Controller

Adafruit APDS9960 breakout

Adafruit AS channel Visible Light Sensor

Adafruit GPIO Expander Bonnet for Raspberry Pi Created by Kattni Rembor. Last updated on :12:47 PM UTC

NeoPixel Bike Light. Created by Ruiz Brothers. Last updated on :43:46 PM UTC

Data Logging with Feather and CircuitPython

Joy Featherwing. Created by Dean Miller. Last updated on :03:07 PM UTC

Adafruit Si7021 Temperature + Humidity Sensor

CircuitPython Snow Globe

NeoPixel Ring Bangle Bracelet

Monochrome OLED Breakouts

MCP Bit DAC Tutorial

3D Printed 20w Amplifier Box

Adafruit CCS811 Air Quality Sensor

Mad Science Test Tube Rack

TSL2561 Luminosity Sensor

Prophet 600 GliGli mod

Jewel Hair Stick. Created by Leslie Birch. Last updated on :47:17 PM UTC

Light-Up Angler Fish Embroidery

NeoPixel Basketball Hoop

Steven Universe Cosplay Shirt & Gem Created by Erin St Blaine. Last updated on :54:25 PM UTC

Adafruit PowerBoost 500 Shield

Mystical LED Halloween Hood

Trinket-Powered Conference Room Occupancy Display

NeoMatrix 8x8 Word Clock

IS31FL x9 Charlieplexed PWM LED Driver

LED Eyes. Created by Ruiz Brothers. Last updated on :50:55 AM UTC

CircuitPython Media Dial

Adafruit MMA8451 Accelerometer Breakout

NeoPixie Dust Bag with Circuit Playground Express

Introducing Circuit Playground

Audio Prank Gift Box. Created by Becky Stern. Last updated on :46:15 PM UTC

Sword & Wand Prop Effects with Circuit Playground

3D Printed Camera LED Ring

Adafruit Mini TFT with Joystick Featherwing

Tent Lantern. Created by Timothy Reese. Last updated on :17:25 AM UTC

Guardian Shield+ Zelda Breath of the Wild

Toy Car Speed Timer. Created by Kirby Griese. Last updated on :13:49 PM UTC

Feather Weather Lamp. Created by Ruiz Brothers. Last updated on :54:26 PM UTC

Interactive Gift Box. Created by codingpro. Last updated on :47:40 AM UTC

7 Portable Multitouch Raspberry Pi Tablet

MCP Bit DAC Tutorial

Portable Apple Watch Charger

7" Portable HDMI Monitor

Adafruit MMA8451 Accelerometer Breakout

3D Printed Case for Adafruit Feather

3D Printed 20w Amplifier Box

Arduino Lesson 6. Digital Inputs

GPS Logging Dog Harness

CPX Mystery Dreidel. Created by Kathy Ceceri. Last updated on :51:40 PM UTC

Trinket NeoPixel LED Longboard

Alarm.com Wi-Fi Doorbell Camera and Slim Line - Installation Guide

Clare Video Doorbell Version 2 User Manual

Transcription:

HalloWing Jump Scare Trap Created by John Park Last updated on 2018-10-16 04:38:42 PM UTC

Guide Contents Guide Contents Overview Parts Materials Build the Jump Scare Trap Circuit Mounting Sensor Lens Blocker HalloWing & Speaker Mount Servo Mount Code with CircuitPython CircuitPython Setup Libraries Code Outline User Feedback Audio Playback Code Deploy the Jump Scare Trap Please Standby Trap Set Trap Sprung! Reset Trap Deploy! 2 3 3 4 5 7 8 9 9 11 11 11 11 11 12 12 16 16 17 17 19 20 Adafruit Industries https://learn.adafruit.com/hallowing-jump-scare-trap Page 2 of 21

Overview 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 1 x Adafruit HalloWing M0 Express Skull-shaped ATSAMD21 board w 1.44" 128x128 TFT display OUT OF STOCK 1 x PIR (motion) sensor Passive Infrared detector ADD TO CART 1 x Micro Servo Tiny 180 degree rotation servo ADD TO CART 1 x JST PH 3-Pin to Female Socket Cable 200mm ADD TO CART 1 x JST PH 3-Pin to Male Socket Cable 200mm OUT OF STOCK Adafruit Industries https://learn.adafruit.com/hallowing-jump-scare-trap Page 3 of 21

1 x 5V 2.5A Switching power supply with 20AWG MicroUSB Cable ADD TO CART 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 Adafruit Industries https://learn.adafruit.com/hallowing-jump-scare-trap Page 4 of 21

Build the Jump Scare Trap Circuit 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! 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 Adafruit Industries https://learn.adafruit.com/hallowing-jump-scare-trap Page 5 of 21

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 Adafruit Industries https://learn.adafruit.com/hallowing-jump-scare-trap Page 6 of 21

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! Please be careful of any tool or scissors you might use to cut the holes for this project. Push the PIR sensor into place in the cutout. Adafruit Industries https://learn.adafruit.com/hallowing-jump-scare-trap Page 7 of 21

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. Adafruit Industries https://learn.adafruit.com/hallowing-jump-scare-trap Page 8 of 21

HalloWing & Speaker Mount Use double stick foam tape to mount the HalloWing to the board as shown here, followed by the speaker. 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! Adafruit Industries https://learn.adafruit.com/hallowing-jump-scare-trap Page 9 of 21

Next, we'll program the Jump Scare Trap using CircuitPython. Adafruit Industries https://learn.adafruit.com/hallowing-jump-scare-trap Page 10 of 21

Code with CircuitPython CircuitPython Setup For this project you need a special version of CircuitPython. Download the file at the green link below that is an early 4.0 version of CircuitPython, written for the HalloWing specifically for displaying graphics files easily. 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 called HALLOWBOOT. Drag the.uf2 file you downloaded onto the HALLOWBOOT drive. Once it copies over, it will automatically restart, ready for you to load on a CircuitPython program that can take advantage of the display capabilities. Adafruit really likes using the Mu editor to edit the CircuitPython code. See this guide on loading and using Mu (https://adafru.it/ano). https://adafru.it/cew https://adafru.it/cew Libraries You'll also need to add a code library for this project. Follow this guide (https://adafru.it/cqa) 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: Adafruit Industries https://learn.adafruit.com/hallowing-jump-scare-trap Page 11 of 21

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. https://adafru.it/cde https://adafru.it/cde Audio Playback We'll use two methods of audio playback with the audio.play() -- for beeping we'll use the tone playback of a sine wave sample, and for hissing we'll use the audioio.wavefile() playback method. Download this wave file and drag it onto your HalloWing's CIRCUITPY drive at the root level. https://adafru.it/cdf https://adafru.it/cdf Code Here is the code we'll use. Copy it and then paste in Mu. Save it to your HalloWing as code.py # HalloWing Jump Scare Trap # use PIR sensor, speaker, and servo import time import array import math import board import displayio import pulseio from adafruit_motor import servo import digitalio import touchio import audioio # Setup LED and PIR pins LED_PIN = board.d13 # Pin number for the board's built in LED. PIR_PIN = board.sense # Pin port connected to PIR sensor output wire. # Setup digital input for PIR sensor: pir = digitalio.digitalinout(pir_pin) pir.direction = digitalio.direction.input # Setup digital output for LED: led = digitalio.digitalinout(led_pin) led.direction = digitalio.direction.output # Setup servo # servo = pulseio.pwmout(board.d4, frequency=50) pwm = pulseio.pwmout(board.d4) servo = servo.servo(pwm) Adafruit Industries https://learn.adafruit.com/hallowing-jump-scare-trap Page 12 of 21

servo = servo.servo(pwm) # Setup cap touch button ready_button = touchio.touchin(board.touch1) def servo_ready(): servo.angle = 0 def servo_release(): servo.angle = 90 # Set servo to ready position servo_ready() # Function for playing wav file, releasing servo def play_wave(): wave_file = open("hiss01.wav", "rb") # open a wav file wave = audioio.wavefile(wave_file) audio.play(wave) # play the wave file led.value = True servo_release() print('motion detected!') while audio.playing: # turn on LED, turn servo pass wave_file.close() # close the wav file # Setup audio out pin audio = audioio.audioout(board.a0) # tone player setup for status beeps tone_volume = 0.1 # Increase this to increase the volume of the tone. frequency_hz = 880 # Set this to the Hz of the tone you want to generate. length = 8000 // frequency_hz sine_wave = array.array("h", [0] * length) for i in range(length): sine_wave[i] = int((1 + math.sin(math.pi * 2 * i / length)) * tone_volume * (2 ** 15-1)) sine_wave_sample = audioio.rawsample(sine_wave) # Function for beeping, usage: 'beep(3)' will beep 3x def beep(count): for _ in range(count): audio.play(sine_wave_sample, loop=true) time.sleep(0.1) audio.stop() time.sleep(0.05) # Function for counting down, usage: 'countdown(5)' def countdown(count): for k in range(count): print(count - k) led.value = True time.sleep(0.1) led.value = False time.sleep(1) # function for blinking, usage: 'blink(5, 0.2)' def blink(count, speed): for _ in range(count): led.value = True time.sleep(speed) led.value = False time.sleep(speed) Adafruit Industries https://learn.adafruit.com/hallowing-jump-scare-trap Page 13 of 21

# display setup backlight = pulseio.pwmout(board.tft_backlight) splash = displayio.group() board.display.show(splash) max_brightness = 2 ** 15 backlight.duty_cycle = 0 # Image list images = ["trap_sprung.bmp", "reset_trap.bmp", "please_standby.bmp", "trap_set.bmp"] # Function for displaying images on HalloWing TFT screen def show_image(filename): image_file = open(filename, "rb") odb = displayio.ondiskbitmap(image_file) face = displayio.sprite(odb, pixel_shader=displayio.colorconverter(), position=(0, 0)) backlight.duty_cycle = 0 splash.append(face) # Wait for the image to load. board.display.wait_for_frame() backlight.duty_cycle = max_brightness beep(1) # startup beep show_image(images[2]) # waiting display print('stabilizing') countdown(3) print('ready') blink(3, 0.2) beep(3) # ready beeps triggered = False ready = True show_image(images[3]) # ready display while True: # Check PIR sensor pir_value = pir.value # Check touch button ready = ready_button.value if pir_value and triggered is not True: # PIR is detecting movement! play_wave() splash.pop() show_image(images[0]) print('triggered') countdown(8) blink(3, 0.2) beep(1) print('please reset') led.value = False triggered = True servo_ready() splash.pop() show_image(images[1]) if ready: # touch sensor has been pressed beep(1) splash.pop() show_image(images[2]) countdown(8) print('ready.') Adafruit Industries https://learn.adafruit.com/hallowing-jump-scare-trap Page 14 of 21

print('ready.') blink(3, 0.2) beep(3) splash.pop() show_image(images[3]) triggered = False Next we'll test out the code and deploy the trap! Adafruit Industries https://learn.adafruit.com/hallowing-jump-scare-trap Page 15 of 21

Deploy the Jump Scare Trap 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. Adafruit Industries https://learn.adafruit.com/hallowing-jump-scare-trap Page 16 of 21

Trap Set After it settles, you'll see the "Trap Set" screen. 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! Adafruit Industries https://learn.adafruit.com/hallowing-jump-scare-trap Page 17 of 21

Adafruit Industries https://learn.adafruit.com/hallowing-jump-scare-trap Page 18 of 21

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! Adafruit Industries https://learn.adafruit.com/hallowing-jump-scare-trap Page 19 of 21

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. Adafruit Industries https://learn.adafruit.com/hallowing-jump-scare-trap Page 20 of 21

Adafruit Industries Last Updated: 2018-10-16 04:38:41 PM UTC Page 21 of 21