Candy Bucket GIF Player Eyes
2019-10-29 | By Adafruit Industries
License: See Original Project
Courtesy of Adafruit
Guide by John Park
Overview
Create not-so-subtle candy preference GIF eyes for your trick-or-treat bucket! This is a public service that will assist others in providing you with only the good candy, and none of the bad candy this Halloween!
The MONSTER M4SK can play back your animated GIFs, stored right on the board's QSPI -- use the built-in buttons to switch between them, or let them automatically cycle.
Parts
- Adafruit MONSTER M4SK - DIY Electronic Eyes Mask
- Lithium Ion Polymer Battery with Short Cable - 3.7V 420mAh
- Fully Reversible Pink/Purple USB A to micro B Cable - 1m long
- Black Nylon Screw and Stand-off Set – M2.5 Thread
In addition to these parts, you'll also need:
- a classic, plastic candy bucket
- marker
- awl or thin screwdriver
- hobby knife
- double-stick foam tape or Velcro for battery attachment
Add GIFs to your MONSTER M4SK
Board Prep and Overview
This project uses the typical procedure for prepping the MONSTER M4SK, plus, it follows the basic process for playing animated GIFs on a SAMD51 board with Arcada display.
Our MONSTER M4SK guide walks through the process of setting up the board for the first time. And, our Arcada Animated GIF Display guide goes over the specifics of GIF playback. There are a few steps to these processes:
- Get the onboard flash filesystem working. If your MONSTER M4SK board already shows up as a flash drive called “CIRCUITPY,” you can skip these next steps and go straight to converting your GIFs!
- Create a directory on the CIRCUITPY drive called /gifs
- Add animated .gif files to the /gifs directory you just made
- Bootload the M4SK with the animated GIF code .uf2
Convert your GIF
The good news is that you do not have to do any particularly hairy transformations with your GIFs to get them to display - you don't have to make them into header files or anything. However, we do have to perform some steps to make them appear nicely on the TFT you're using:
- Reduce size to no larger than 240 wide x 240 tall
- Remove transparent pixels (sometimes called de-optimization) because it slows down our decoding
- Reduce colors so we don't have to work as hard to decode
- Reduce frames if it makes sense to
This GIF viewer isn't good for detailed, high-frame-rate GIFs. Keep it simple and you'll be happy with the results!
This page from the Arcada GIF Display guide walks you through the entire process!
Here's an example GIF file you can check out if you like. Download and uncompress the .zip file below.
Good and Bad Candy GIFs
With the exception of everyone knowing that candy corn is the best Halloween candy in the whole entire world, there may be some allowances for personal preference.
So, you may want to customize your Good and Bad Candy GIFs. But if you want to get started with my picks, here are the GIFs! Download and uncompress the .zip file below.
UF2 File
Once you've got a GIF (or a few GIFs) ready, it's time to add the code that will play them for you, and then put the GIFs on the board. Get back to bootloader mode on your board by double clicking the reset button. You'll see the MASKM4BOOT drive appear.
Then, download the UF2 file linked here and drag onto the board.
GIF Drag
Once the file finishes copying, the board will automatically reboot, now running the GIF player code! Plus, it will show up as a CIRCUITPY drive.
Create a directory on the CIRCUITPY drive called /gifs.
Then, simply drag the GIF files into the /gifs directory you made on the M4SK's CIRCUITPY drive.
Config File
The last step is to save this configuration file to the root directory of CIRCUITPY drive. It is the arcada_config.json file. You can make adjustments here to settings such as brightness and GIF playback time.
Download: file
{"volume":255,"brightness":255,"seconds_per_gif":5}
See this page for more details on the configuration file.
You can press the A button (S10 on the PCB) on the MONSTER M4SK and it will start playing your animated GIFs! Press the Up button (S11 on the PCB) to advance to the next GIF, or Down button (S9 on the PCB) to go back to the previous one.
If you want to get even fancier, you can build the code in Arduino using the Arcada libraries. Have a look at this guide for details.
Next, we'll mount the MONSTER M4SK to the candy bucket.
Mount the M4SK on the Bucket
We'll use nylon M2.5 screws and standoffs to mount the M4SK to the bucket -- this is a very nice, sturdy way to mount it, but you can also go quick and easy with double stick foam tape or Velcro if you're in a hurry!
Mounting Holes
Position the M4SK where you want it and then mark four-hole positions using a marker, as shown.
Carefully poke holes through the four positions using an awl or thin screwdriver.
Mounting Hardware
Using eight short screws (M2.5 x 4mm), two short standoffs (M2.5 x 6mm), and two medium standoffs (M2.5 x 10mm), fasten the hardware to the mask and the bucket as shown.
Battery Power
Plug a small LiPoly battery into the MONSTER M4SK battery port and then tuck the battery in the space behind the mask.
You can use some double-stick foam tape to secure the battery in place.
USB Port Access
You will want to plug in a USB cable to charge the M4SK battery or upload different GIF animations. If your bucket shape doesn't allow easy access, use a hobby knife to cut a slit into the bucket as shown here.
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.
Visit TechForum