# Screaming Cauldron

## Overview

https://youtu.be/h5gGwoD-6RU

Ah, Halloween. A fun time to hand out candy. Also, a _very_ fun time to scare trick-or-treaters!... But how to combine the two? The **Screaming Cauldron** allows you to do both at the same time!

By using an infrared distance sensor to determine hand proximity, the **Trinket M0** microcontroller adjusts the light colors and then lets out a bloodcurdling, amplified scream at just the right moment!

![](https://cdn-learn.adafruit.com/assets/assets/000/047/335/medium800/proximity_PA110120_2k.jpg?1508185512)

Build your own -- or any other proximity-based sound/light effects -- using this simple project! You'll have it wired up in no time, and the **CircuitPython** code is very simple to adjust to suit your needs.

![](https://cdn-learn.adafruit.com/assets/assets/000/047/367/medium800/proximity_PA110034_2k.jpg?1508191577)

## Parts and Materials
You can use any kind of container to house the circuit, I chose an inexpensive plastic cauldron. You&nbsp;may also want some black gaffers tape to hold things down, black tissue paper or fabric to hide the circuit, and some white tissue paper to diffuse the NeoPixels.

Here are the parts for the circuit:

### Part: Adafruit Trinket M0
quantity: 1
Microcontroller running CircuitPython
[Adafruit Trinket M0](https://www.adafruit.com/product/3500)

### Part: IR distance sensor
quantity: 1
Proximity and motion sensing in the 10-80cm range
[IR distance sensor](https://www.adafruit.com/product/164)

### Part: Audio FX Sound Board w 2MB Flash
quantity: 1
Triggered .WAV audio files
[Audio FX Sound Board w 2MB Flash](https://www.adafruit.com/product/2133)

If you have big plans for lots of sound files, check out the [16mb version](https://www.adafruit.com/product/2341).&nbsp;There are also Audio FX Sound Boards with built-in amplifiers in [2mb](https://www.adafruit.com/product/2210)and [16mb variants](https://www.adafruit.com/product/2217), so you have lots of speaker options!

### Part: Perma-Proto Half-sized Breadboard PCB
quantity: 1
PCB for permanent assembly
[Perma-Proto Half-sized Breadboard PCB](https://www.adafruit.com/product/1609)

### Part: NeoPixel RGB LED strip
quantity: 1
Black 30 LED strip
[NeoPixel RGB LED strip](https://www.adafruit.com/product/1460)

### Part: 4 x AA Battery Holder w On/Off Switch
quantity: 1
To power the project using 4 rechargeable AA batterys
[4 x AA Battery Holder w On/Off Switch](https://www.adafruit.com/product/830)

You'll need to supply:

- 4 AA rechargeable batteries for ~5V of power (Alkaline batteries will be a bit too high, around 6V)
- Hookup wire
- soldering iron and solder (if using the perma proto board)

You can use any portable powered speaker you like, or, pick up one of these and a portable USB power supply:

### Part: USB powered speakers
quantity: 1
With 1/8" stereo audio cable
[USB powered speakers](https://www.adafruit.com/product/1363)

### Part: USB Battery Pack 
quantity: 1
2200mAh Capacity Battery, 5V 1A Output
[USB Battery Pack ](https://www.adafruit.com/product/1959)

If you'd like to watch a full build of this project, check out&nbsp;this **John Park's Workshop Live** episode:

https://youtu.be/GE4WT6pplU0

# Screaming Cauldron

## Build the Circuit

![](https://cdn-learn.adafruit.com/assets/assets/000/047/192/medium800/proximity_screamingCircuit05.png?1507834131)

The circuit for the Screaming Cauldron consists of these major components:

- **IR distance sensor&nbsp;** to detect candy grabbing hand proximity
- **AudioFX Sound Board&nbsp;** to play terrifying sound samples through a powered speaker
- **NeoPixel&nbsp;** strip for interactive colored lighting
- **Trinket M0** to act as the brain, telling the NeoPixels to change color and the AudioFX board to play sounds

You'll assemble the circuit as shown in the diagram, either on a breadboard, or soldered to a perma proto board. The breadboard is recommended for making sure everything works properly at first. Then, you can transfer to a perma proto board for a more permanent connection.

## Power
You can start by snipping the JST connector off of the battery pack so you can attach it directly to the board.

![proximity_IMG_0814_2k.jpg](https://cdn-learn.adafruit.com/assets/assets/000/047/336/medium640/proximity_IMG_0814_2k.jpg?1508185787)

![proximity_IMG_0815_2k.jpg](https://cdn-learn.adafruit.com/assets/assets/000/047/337/medium640/proximity_IMG_0815_2k.jpg?1508185794)

![proximity_IMG_0816_2k.jpg](https://cdn-learn.adafruit.com/assets/assets/000/047/338/medium640/proximity_IMG_0816_2k.jpg?1508185809)

## Main Circuit and Sensor
Solder the header pins on both the Trinket M0 and Audio FX Sound Board as shown here and here, then connect them to the board. Run these connections:

- Trinket M0 **GND** to ground rail
- Trinket M0 **BAT** to power rail
- Audio FX **GND** to ground rail (do not use the Audio FX GND at the top right of the board, this is an audio line out ground)
- Audio FX **Vin** to power rail

Attach power to the board's power rails, and run jumpers&nbsp; to connect the positive rails and ground rails to their partners across the board.

Then, connect the IR sensor's power and ground&nbsp;wires to their respective rails, and the white signal wire to pin D1 on the Trinket M0.

We haven't yet written the code or uploaded audio samples to the FX board, but you can turn on the battery power now to test things out and make sure they're getting powered on, lighting their green LEDs.

![proximity_IMG_0817_2k.jpg](https://cdn-learn.adafruit.com/assets/assets/000/047/339/medium640/proximity_IMG_0817_2k.jpg?1508185979)

![proximity_IMG_0818_2k.jpg](https://cdn-learn.adafruit.com/assets/assets/000/047/340/medium640/proximity_IMG_0818_2k.jpg?1508186143)

![proximity_IMG_0819_2k.jpg](https://cdn-learn.adafruit.com/assets/assets/000/047/341/medium640/proximity_IMG_0819_2k.jpg?1508186151)

## NeoPixel Strip
Now you'll prepare the NeoPixel strip for connection to the circuit.

First, cut and strip some ~8" lengths of red, black, and green wire. Tin the ends, and then solder these connections:

- Black to **GND**
- Green to **Din**
- Red to **5V**

You can use some heat shrink tubing to strengthen the connection point, but this is an optional step.

Connect the NeoPixel strip to the board, with these connections:

- Red to power rail
- Black to ground rail,
- Green data input to Trinket M0 pin **D0** (ideally through a 470 Ohm resistor)

You will also connect a 1000uF capacitor to the ground and power rails [as per this guide](../../../../adafruit-neopixel-uberguide/basic-connections), in order to prevent any power issues on the NeoPixel strip.&nbsp;

![proximity_PA110003_2k.jpg](https://cdn-learn.adafruit.com/assets/assets/000/047/346/medium640/proximity_PA110003_2k.jpg?1508186997)

![proximity_PA110004_2k.jpg](https://cdn-learn.adafruit.com/assets/assets/000/047/348/medium640/proximity_PA110004_2k.jpg?1508187015)

![proximity_PA110010_2k.jpg](https://cdn-learn.adafruit.com/assets/assets/000/047/349/medium640/proximity_PA110010_2k.jpg?1508187024)

![proximity_PA110013_2k.jpg](https://cdn-learn.adafruit.com/assets/assets/000/047/350/medium640/proximity_PA110013_2k.jpg?1508187033)

![](https://cdn-learn.adafruit.com/assets/assets/000/047/351/medium800/proximity_PA110025_2k.jpg?1508187087)

As shown here and in the circuit diagram, connect the Trinket M0 **D2** pin to the AudioFX Sound Board's **pin 0**. This is how the Trinket M0 will be able to trigger the sounds.

You can now connect the speaker input to the AudioFX Sound Board and get ready to program things!

# Screaming Cauldron

## Prepare AudioFX Files

[This guide will teach you](../../../../adafruit-audio-fx-sound-board/triggering-audio) everything you need to know about triggering audio on the AudioFX board. Each of the eleven input pins can be used to trigger different sound samples with different buttons and sensors, but we'll only be using one of them.&nbsp;

Since we're triggering over a single pin, we can use Play Next Trigger mode or Play Random Trigger mode for multiple sound files. Everything is based upon a naming convention. Download the files below and unzip them to use the four sounds I selected.&nbsp;

[screamingCauldronWavs.zip](https://cdn-learn.adafruit.com/assets/assets/000/047/354/original/screamingCauldronWavs.zip?1508187745)
This naming convention is the key:

**T00NEXT0.WAV**

**T00NEXT1.WAV**

**T00NEXT2.WAV**

**T00NEXT3.WAV**

This naming means that the sounds are triggered by pin 0, and will play one after another sequentially by number each time the pin 0 is grounded.

Plug in your Audio FX Sound Board, and then drag the .wav files you unzipped onto the ADAFRUITSFX disk drive that shows up!

![](https://cdn-learn.adafruit.com/assets/assets/000/047/359/medium800/proximity_audiofxdrag.png?1508188369)

If you want to use your own sound files, you can! Record, sample, remix, or simply download files from a sound file sight, such as freesample.org. Then, to make sure you have the files converted to the proper specifications,&nbsp;[check out this guide here](../../../../adafruit-wave-shield-audio-shield-for-arduino/convert-files)&nbsp;that'll show you how! Spoiler alert: you'll&nbsp;need to make a small, 22Khz (or lower), 16 bit PCM, mono&nbsp; .wav file!

# Screaming Cauldron

## Program the Trinket M0 w/ CircuitPython

## Trinket M0 Setup for CircuitPython

Now it's time to set up the&nbsp; **Trinket** &nbsp; **M0** &nbsp;for use with&nbsp;[CircuitPython](https://www.adafruit.com/circuitpython)&nbsp;and our&nbsp;Screaming Cauldron&nbsp;code.

If you haven't already, follow&nbsp;[this guide](../../../../adafruit-trinket-m0-circuitpython-arduino/circuitpython)&nbsp;to preparing the&nbsp; **Trinket M0** , including updating it with the latest version of&nbsp; **CircuitPython**.

After prepping the&nbsp; **Trinket** &nbsp; **M0** &nbsp;to run&nbsp; **CircuitPython** &nbsp;we'll also need to add a&nbsp; **NeoPixel** &nbsp;library.&nbsp;[This guide tells you how](https://learn.adafruit.com/welcome-to-circuitpython/circuitpython-libraries),&nbsp;as well as providing a good primer on using&nbsp; **NeoPixels** &nbsp;on the&nbsp; **Trinket M0** &nbsp;with&nbsp; **CircuitPython**.

## Installing NeoPixel Library

Download the latest `adafruit-circuitpython-bundle-xxxx.zip`&nbsp;(or newer) from the[&nbsp;releases directory&nbsp;](https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases/)and then unzip it somewhere easy to find, such as your desktop. Then, copy the&nbsp;`neopixel.mpy`&nbsp;file to your CIRCUITPY's&nbsp;`lib`&nbsp;directory on the&nbsp; **Trinket** &nbsp; **M0**.

Finally, if you had a `neopixel.py`&nbsp;file that was already in that same&nbsp;`lib`&nbsp;directory you can delete it (the mpy is a compressed version)

## Saving CircuitPython Code

Once you've got things working, you can edit the&nbsp;`main.py`&nbsp;file on the&nbsp; **Trinket** &nbsp; **M0** &nbsp;to adjust what it actually does. No need for a software IDE, complaining tools, or flashing the chip -- when you code with&nbsp; **CircuitPython** &nbsp;all you need is a text editor. Edit the code, save it to the&nbsp; **Trinket** &nbsp; **M0** , and it immediately runs!

## Coding the Screaming Cauldron

The Trinket M0 will be responsible for a few things:

- Checking the IR distance sensor to see when a hand is getting close and then breaking a threshold
- Controlling the NeoPixel color as the hand gets closer
- Triggering the AudioFX Sound Board to play sounds when a distance threshold is met

Here's the code written in CircuitPython to do all of those things:

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

Copy that code, and then paste it into a new&nbsp;text document in your favorite text/coding editor. Then,&nbsp;save it to your Trinket M0's CIRCUITPY drive as **main.py**

## Testing
Your circuit is now ready for testing! Make sure the battery pack is turned on, then press the reset button once on the Trinket M0. you should hear the first scream sound trigger upon reboot, and then it will light the NeoPixels green, waiting to detect an unlucky hand!

Move your hand up and down over the IR sensor and watch the color shift from green to red. When you get too close (about 3-4" away) a sound will trigger, in this case the T00NEXT0.WAV sound. Do it again (if you dare!) and you'll trigger T00NEXT1.WAV and so on, until it loops back around to the first sound.

![proximity_PA110026_2k.jpg](https://cdn-learn.adafruit.com/assets/assets/000/047/362/medium640/proximity_PA110026_2k.jpg?1508191492)

![proximity_PA110027_2k.jpg](https://cdn-learn.adafruit.com/assets/assets/000/047/363/medium640/proximity_PA110027_2k.jpg?1508191501)

![proximity_PA110028_2k.jpg](https://cdn-learn.adafruit.com/assets/assets/000/047/364/medium640/proximity_PA110028_2k.jpg?1508191510)

![proximity_PA110030_2k.jpg](https://cdn-learn.adafruit.com/assets/assets/000/047/365/medium640/proximity_PA110030_2k.jpg?1508191518)

Next, we'll hide the circuit inside the cauldron!

![](https://cdn-learn.adafruit.com/assets/assets/000/047/366/medium800/proximity_PA110033_2k.jpg?1508191549)

# Screaming Cauldron

## Assemble and Use the Cauldron

![](https://cdn-learn.adafruit.com/assets/assets/000/047/368/medium800/proximity_PA110035_2k.jpg?1508191614)

Wrap the NeoPixel strip around the inside of the cauldron's rim, and secure it with more tape if needed.&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/047/369/medium800/proximity_PA110040_2k.jpg?1508191627)

You can place all of the parts inside the cauldron, and use gaffers tape or double stick foam tape to secure things. It's also OK to leave things loose in there if you like.

![](https://cdn-learn.adafruit.com/assets/assets/000/047/370/medium800/proximity_PA110050_2k.jpg?1508191673)

Cover the circuit and speakers with some black tissue paper or fabric

Secure the IR sensor to the side of the bowl's rim, pointing in toward the sensor. You can adjust until you feel the placement is best, then tape the sensor to the inside.

![](https://cdn-learn.adafruit.com/assets/assets/000/047/371/medium800/proximity_PA110061_2k.jpg?1508191706)

![](https://cdn-learn.adafruit.com/assets/assets/000/047/372/medium800/proximity_PA110062_2k.jpg?1508191716)

You can also diffuse the lighting a bit with some tissue paper if you like.

![](https://cdn-learn.adafruit.com/assets/assets/000/047/373/medium800/proximity_PA110076_2k.jpg?1508191777)

Time to fill the bowl with candy. You're ready to give out some scary (and delicious) surprises!!

![](https://cdn-learn.adafruit.com/assets/assets/000/047/374/medium800/proximity_PA110098_2k.jpg?1508191796)

![](https://cdn-learn.adafruit.com/assets/assets/000/047/375/medium800thumb/proximity_screamCauld.jpg?1508192705)


## Featured Products

### Adafruit Trinket M0 - for use with CircuitPython & Arduino IDE

[Adafruit Trinket M0 - for use with CircuitPython & Arduino IDE](https://www.adafruit.com/product/3500)
The&nbsp;Adafruit Trinket M0 may be small, but do not be fooled by its size! It's a tiny microcontroller board, built around the Atmel ATSAMD21, a little chip with _a lot_ of power. We wanted to design a microcontroller board that was small enough to fit into any project, and low...

In Stock
[Buy Now](https://www.adafruit.com/product/3500)
[Related Guides to the Product](https://learn.adafruit.com/products/3500/guides)
### IR distance sensor includes cable (10cm-80cm)

[IR distance sensor includes cable (10cm-80cm)](https://www.adafruit.com/product/164)
This SHARP distance sensor bounces IR off objects to determine how far away they are. It returns an analog voltage that can be used to determine how close the nearest object is. Comes with 12" long 3-JST interface wire. These sensors are good for short-range detection. For over 1 m...

In Stock
[Buy Now](https://www.adafruit.com/product/164)
[Related Guides to the Product](https://learn.adafruit.com/products/164/guides)
### Adafruit Audio FX Sound Board - WAV/OGG Trigger with 2MB Flash

[Adafruit Audio FX Sound Board - WAV/OGG Trigger with 2MB Flash](https://www.adafruit.com/product/2133)
Would you like to add audio/sound effects to your next project, without an Arduino+Shield? Or maybe you don't even know how to use microcontrollers, you just want to make a sound play whenever you press a button. What about something that has to be small...

In Stock
[Buy Now](https://www.adafruit.com/product/2133)
[Related Guides to the Product](https://learn.adafruit.com/products/2133/guides)
### Adafruit Audio FX Mini Sound Board - WAV/OGG Trigger 16MB Flash

[Adafruit Audio FX Mini Sound Board - WAV/OGG Trigger 16MB Flash](https://www.adafruit.com/product/2341)
Would you like to add audio/sound effects to your next project, without an Arduino+Shield? Or maybe you don't even know how to use microcontrollers, you just want to make a sound play whenever you press a button. What about something that has to be very small and portable? You are...

In Stock
[Buy Now](https://www.adafruit.com/product/2341)
[Related Guides to the Product](https://learn.adafruit.com/products/2341/guides)
### Adafruit Audio FX Sound Board + 2x2W Amp - WAV/OGG Trigger - 2MB

[Adafruit Audio FX Sound Board + 2x2W Amp - WAV/OGG Trigger - 2MB](https://www.adafruit.com/product/2210)
Would you like to add audio/sound effects to your next project, without an Arduino+Shield? Or maybe you don't even know how to use microcontrollers, you just want to make a sound play whenever you press a button. What about something that has to be small...

In Stock
[Buy Now](https://www.adafruit.com/product/2210)
[Related Guides to the Product](https://learn.adafruit.com/products/2210/guides)
### Adafruit Audio FX Sound Board + 2x2W Amp - WAV/OGG Trigger -16MB

[Adafruit Audio FX Sound Board + 2x2W Amp - WAV/OGG Trigger -16MB](https://www.adafruit.com/product/2217)
Would you like to add audio/sound effects to your next project, without an Arduino+Shield? Or maybe you don't even know how to use microcontrollers, you just want to make a sound play whenever you press a button. What about something that has to be small...

In Stock
[Buy Now](https://www.adafruit.com/product/2217)
[Related Guides to the Product](https://learn.adafruit.com/products/2217/guides)
### Adafruit NeoPixel Digital RGB LED Strip - Black 30 LED 5m

[Adafruit NeoPixel Digital RGB LED Strip - Black 30 LED 5m](https://www.adafruit.com/product/1460)
You thought it couldn't get better than [our world-famous 32-LED-per-meter Digital LED strip](http://adafruit.com/products/306) but we will prove you wrong! These NeoPixel strips have 30 digitally-addressable pixel LEDs per meter and are very affordable and are only 12.5 mm...

In Stock
[Buy Now](https://www.adafruit.com/product/1460)
[Related Guides to the Product](https://learn.adafruit.com/products/1460/guides)
### 4 x AA Battery Holder with On/Off Switch

[4 x AA Battery Holder with On/Off Switch](https://www.adafruit.com/product/830)
Make a nice portable power pack with this 4 x AA battery holder. It fits any alkaline or rechargeable AA batteries in series. There's a snap on cover and an on/off switch which can be handy when wiring to something without a switch.

**New**! We now have 0.1" headers...

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

## Related Guides

- [Adafruit Trinket M0](https://learn.adafruit.com/adafruit-trinket-m0-circuitpython-arduino.md)
- [Chilled Drinkibot](https://learn.adafruit.com/chilled-drinkibot.md)
- [Overwatch Prop Gun: Lucio's Blaster Pt. 3](https://learn.adafruit.com/overwatch-prop-gun-lucios-blaster-pt-3.md)
- [Using NeoPixels with Netduino Plus 2](https://learn.adafruit.com/using-neopixels-with-netduino.md)
- [How to Choose a Microcontroller](https://learn.adafruit.com/how-to-choose-a-microcontroller.md)
- [World's Smallest MAME Arcade Cabinet](https://learn.adafruit.com/worlds-smallest-mame-arcade-cabinet.md)
- [Trellis Feather DSP-G1 Synthesizer](https://learn.adafruit.com/feather-trellis-dsp-g1-synthesizer.md)
- [Glowy Message Crown](https://learn.adafruit.com/glowy-message-crown.md)
- [Esenciales para CircuitPython](https://learn.adafruit.com/esenciales-para-circuitpython.md)
- [USB Foot Switch Controller in CircuitPython](https://learn.adafruit.com/usb-foot-switch-circuit-python.md)
- [Audio FX Remote Control](https://learn.adafruit.com/audio-fx-remote-control.md)
- [Phone-Activated Talking Dog Collar](https://learn.adafruit.com/phone-activated-talking-dog-collar.md)
- [Happy Chewbacca Mask](https://learn.adafruit.com/happy-chewbacca-mask.md)
- [Cup o' Sound](https://learn.adafruit.com/cup-o-sound.md)
- [CircuitPython Media Dial](https://learn.adafruit.com/media-dial.md)
- [Four Channel Audio Passive Stereo Mixer](https://learn.adafruit.com/four-channel-audio-passive-stereo-mixer.md)
