Maker.io main logo

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!

 

bucket_1

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

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:

  1. 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!
  2. Create a directory on the CIRCUITPY drive called /gifs
  3. Add animated .gif files to the /gifs directory you just made
  4. Bootload the M4SK with the animated GIF code .uf2

pumpkineyes_2

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.

pumpkineyes_gif.zip

fire_3

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.

good_bad_gifs.zip

pez_4

pez2_5

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.

M4SK_GIF_player.UF2

player_6

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.

Dropbox_7

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

Copy Code
    {"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.

mask_fire_8

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

bucket_10

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.

projects_bucket_11

projects_bucket_12

projects_bucket_13

projects_bucket_14

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.

mounting_hardware_15

mounting_hardware_16

mounting_hardware_17

mounting_hardware_18

mounting_hardware_1

9mounting_hardware_20

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.

Battery_21

Battery_22

Battery_23

Battery_24

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.

USB_25

USB_26

USB_27

bucket_complete_28

制造商零件编号 4343
MONSTER M4SK - TWO EYES ARE BETT
Adafruit Industries LLC
¥378.74
Details
制造商零件编号 4111
CABLE A PLUG TO MCR B PLUG 3.28'
Adafruit Industries LLC
¥32.15
Details
制造商零件编号 3299
BLACK NYLON SCREW AND STAND-OFF
Adafruit Industries LLC
¥145.84
Details
Add all DigiKey Parts to Cart
TechForum

Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.

Visit TechForum