Contributors

Overview

Making difficult decisions can be tricky and stressful. This project will help you take off some of the pressure, instead letting your HalloWing-based Magic 9 Ball do the heavy lifting of your decision making!

By harnessing the HalloWing's accelerometer to detect when the ball is turned upside down and right side up (or shaken), we'll then run a highly mysterious algorithm (OK, it's just a random number generator, sorry) to choose an image file to show on the TFT display.

A stylish housing filled with swirly mystery fluid completes the effect. Will you love building this project?

Optional: 3D printed cap, mounting plate, and HalloWing case (if you don't have a 3D printer, you can send the files to be printed, or simply double-stick tape your HalloWing to the regular snow globe cap)

Build the Magic 9 Ball

Mix the Mystery Fluid

The Magic 9 Ball derives much of its power from the mysterious roiling fluid contained within the orb. Here, for the very first time, we shall reveal the secrets of the unfathomable fluid!

Get ready for the secrets to be revealed! -- We'll mix water with super pearl dust (also called shimmer dust), food coloring, and optional glycerin. The dye gives the mix its color, while the pearl dust provides the moving, glittering view into the complex fluid dynamics going on in there while it is thinking.

Add a very small amount of the pearl dust to the empty globe.

Fill halfway with water, then add dye and swirl it around. I used five drops of yellow to two drops of red here.

Fill the rest of the way with water, up to the level of the stopper cap.

Press the stopper cap into place. You can glue this in with silicone sealant or E6000 glue if you like, for extra safety.

This is a fun time to test it out -- screw on the original cap and swirl the orb to see the intricate fluid motion!

HalloWing Prep

The HalloWing will be the brains and display of our Magic 9 Ball.

Ready the Battery

Plug your Lipoly battery's JST plug into the battery port on the HalloWing.

Use double-stick foam tape to affix the battery to the board as shown.

Code with CircuitPython

Image Player Firmware

You can download the firmware file below that is a specific Alpha cut of CircuitPython that can display graphics on the TFT display easily.

To use it, 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.

File Format

To prepare your graphics for the HalloWing, you'll need to size them to 128 x 128 pixels. You can do this in nearly any graphics program, such as Photoshop, GIMP, Preview on osx, ImageMagik, MS Paint, you name it!

Save your file as a 24-bit .bmp file. Here you can see some example graphics.

Here is the full set of answers for your Magic 9 Ball. Download the file and then unzip it.

Tip: Images inside of a folder on your HalloWing won't be seen by this image player code below, only files at the root level of the HalloWing are seen. So, you can swap files in and out of folders to quickly change your image set!

Magic 9 Ball Code

This program is pretty simple in what it does -- it loads a random image onto the screen while fading the backlight up, then, whenever the HalloWing's accelerometer detects the board has been turned upside down or shaken, it dims the backlight, selects and displays a new image, and brings the backlight up again.

Copy the code and then paste it into Mu. Save the file to your CIRCUITPY board as code.py.

The board will restart and then play an image. Try turning the Magic 9 Ball upside down and then back up -- you'll see a new image appear!

Answer Any Question

You can now unplug the USB cable (plug it back in any time to charge the battery) and use the Magic 9 Ball!

Ask it a yes or no question, such as "Have we reached the mother ship yet?", then turn the ball over (or give it a shake), then turn it right side up and the answer will present itself in all of its wisdom!

Microcontroller Selection Oracle

Here's another interesting use of the Magic 9 Ball code -- you can create a random microcontroller selector for all those times you just aren't sure which amazing CircuitPython-capable Adafruit board to get from Digi-Key, who are going all-in on CircuitPython!

This will display a randomly selected board and show the product name, image, and Digi-Key product number!

Simply load these images linked below onto the board (you can place the Magic 9 Ball images into a folder you make on the HalloWing and they won't be selected for viewing).

This is just an example we created for our friends at Digi-Key, but we hope it also serves as a leaping off point for you to come up with your own creative uses for the image randomization of the Magic 9 Ball!

This guide was first published on Sep 22, 2018. It was last
updated on Sep 22, 2018.

OUT OF STOCK NOTIFICATION

YOUR NAME

YOUR EMAIL

You have been successfully subscribed to the Notification List for this product and will therefore receive an e-mail from us when it is back in stock!

For security reasons, an e-mail has been sent to you acknowledging your subscription. Please remember that this subscription will not result in you receiving any e-mail from us about anything other than the restocking of this item.

If, for any reason, you would like to unsubscribe from the Notification List for this product you will find details of how to do so in the e-mail that has just been sent to you!