The Treat Trough of TERROR!
by hausofpayne17 in Circuits > Arduino
723 Views, 1 Favorites, 0 Comments
The Treat Trough of TERROR!
In October 2020, a plumber in Toronto was going around and installing pieces of plastic pipe on people's front steps so that they could slide treats down the pipe to awaiting trick-or-treaters while maintaining physical distancing during COVID.
This is my Arduino-hacked version. When the circuit detects a pack of treats at the top of the trough, it displays a cycle of orange-coloured LEDs running down the trough and plays some spooky .MP3 sounds over a set of powered computer speakers (or a HiFi) while the treats slide down to the awaiting treater.
Let's have some fun with the build!
Supplies
1 - Arduino microcontroller - A Nano is used here but any controller is fine.
1 - MP3-TF-16P Decoder Module and a MicroSD card - to store the spooky sound samples
1 - String of WS2812B Addressable LEDs. I'm using a 4 metre long strip with 240 LEDs. It is a 5Volt LED strip. The details are usually on the package.
1 - SR-04 Ultrasonic Distance Detector
1 - Breadboard and connecting wires.
1 - 5V, 5Amp DC power supply and a female barrel connector that matches the plug on the supply. We need AT LEAST 2Amps. More Amps is better!
1 - Piece of plastic trough. Vinyl eavestrough, PVC pipe or other options are great.
Zip ties and hot glue to fasten the LED strip to the trough.
Some plywood to support the top of the trough. Build as you see fit for your needs.
An inexpensive jack-o-lantern ornament. Optional for the mouth.
Saw horse, chair or other supports for mounting the trough.
Powered computer speakers to amplify the playing .MP3 files.
The WS2812B LED Strip
The WS2812B addressable LED strips are great to work with. They come in varying lengths and density of LEDs per unit of length.
Spend some time with this great tutorial to learn how we control these LEDs with the Arduino:
https://randomnerdtutorials.com/guide-for-ws2812b...
Solder some leads onto a female barrel connector so you can connect the power supply to your LED strip.
Download and install the FastLED.h library in your Documents/Arduino/Libraries folder. The link is in the article above.
Load the sample Arduino sketch into your Arduino and make sure you specify the Number of LEDs in your strip and the pin you're using for the signal.
Wire up the circuit as shown in the diagram on the website.
Double check your wiring and then plug in the power supply.
Watch the LEDs do their magic!
With LED strip working, we're ready to continue with the project.
Build the Circuit
Follow the diagram to wire up the circuit. Since 240 LEDs were used, a lot of current is required. A 5Volt, 5Amp DC power supply was used and it's enough to power the Arduino and MP3 player as well. Each LED consumes approximately 50mA.
Double check your wiring before connecting the power supply. That's a LOT of current for a small device!
If you will be using this often, you may wish to make a more permanent soldered circuit that is more robust than the breadboard. The last image shows a permanent soldered version. The power supply feeds the 5V pin and GND pin on the Arduino directly and all the other devices receive power from these pins.
If you choose power the LEDs AND Arduino from the same power supply, DO NOT attempt to connect the circuit to your computer with both the USB cable AND power supply connected. Disconnect the power supply before connecting to USB or you risk damaging the circuit and your computer.
Build the Trough
This trough is about 8 feet long so a 4 metre length of LEDs nicely covers most of the trough if you run it down one side and up the other as a single length.
Take your string of LEDs and use hot glue or foam tape to temporarily attach it to the trough. It usually has an adhesive backing but it's more of an annoyance than it's worth. I actually removed the adhesive backing for this project.
Drill small holes through the lip of the conduit/trough along the length and then secure the LED strip to the conduit with zip ties along the length of both sides of the trough.
You'll see that there is a plywood support for the top end of the trough. It's just a piece of 5/8" ply cut with a semi-circle to match the profile of the trough on the top, secured with 3 wood screws.
Cut a notch out of the top of the trough for the SR-04 ultrasonic sensor. Mount it with hot glue or just a wide strip of masking tape.
Make a 4 conductor patch cord to run from the SR-04 sensor to the circuit.
Make a small 3 conductor patch cord that can run from the end of one side of the strip to the connection on the circuit for the LEDs. In my strip, 5V is red, GND is white and the signal wire is green. Pay attention to the wiring on your strip when connecting it to the Arduino circuit.
The MP3 module is connected to the computer speakers with a 3-wire-to-miniature-stereo female jack. You can wire it up as you wish.
You'll see a jack-o-lantern ornament mounted to the wooden support at the top of the trough. Decorate your slide as you like. The ornament had a hole cut in the mouth to slide up the trough and mount to the support with a couple of zip ties.
Load the Sketch.
You'll want MP3 samples for your project. I found several public domain sounds by searching 'Halloween MP3 sounds' online. I used the Audacity app to trim the length of the sounds down to about 3 seconds each, the typical sliding time of a treat down the slide.
Get the library for the MP3 module. It's "DFRobotDFPlayerMini.h".
The MP3s are indexed according to the order you dragged them onto your MicroSD card.
Open the sketch and adjust it to suit your needs as detailed below.
You'll need to tailor it to the number of LEDs in your strip and the pin the LEDs are connected to.
Just follow the comments and you will learn how it works and how to customize it.
I have 8 sounds on my circuit. You can add more or less as you like. Just adjust the line,// generate random value 1 to 8 inclusive
int ndx = int(random(1, 9)); to match the number of files on your MicroSD card. If you have 8 sounds, the last parameter is 9. 10 sounds, the last parameter is 11 etc.
This sketch is based on parts of
1. the ColorPalettes sketch that comes in the FastLED library.
2. Basic SR-O4 sketch from the Arduino site.
3. Standard code to play a sound on the MP3 player.
When the sensor detects an object(ie. your hand) within 8cm of it, it generates a random integer for one of the 8 MP3 sounds on the onboard MicroSD card of the player modules and then cycles the LEDs.
If you want to vary the duration of the light show, you can adjust the condition, i< NUM_LEDS / 2 in the loop() block.
When you're ready, upload the sketch to your circuit.
Downloads
Try It Out!
With the circuit wired, and the sketch loaded, connect the power supply to your LED strip.
Pass your hand near the sensor. The light show should start and a randomly selected scary sound will play.
Have a GREAT Halloween and watch the smiles on the treaters faces!
November 1 Update!
So after Hallowe'en, I am pleased to say it was a great success! The kids loved it!
Toddlers just stared at it with their mouths open in amazement. They just wanted to stand there watching the lights.
One 6 year old yelled out, "Thanks for building the slider thing! I really like it!" as he ran off.
Teenagers had exclamations like "Sick..." and "That's really creative!" High praise from teenagers!
So it was a big hit in the neighbourhood. Ready for next year!