Overview

The aliens are coming!! The aliens are coming!! Oh, wow, and they've got a really nifty flying saucer, with lights and otherworldly sounds!

Have you ever wanted to make your own prop UFO model with lights and sounds that react to the tilt of the craft? Me too! Plus, you can hang it from a piece of fishing line and make your own sci fi B-movie special effects!

You can build your own flying saucer using paper plates, or 3D print a model, or even modify a plastic model kit. You'll just need a hole in the bottom for the Circuit Playground Express's NeoPixel LED lights to show, and room for the battery pack inside.

You'll also want to get a small, clear plastic drinking cup to use as a tractor beam and stand to display your UFO, as well as some optional sandpaper to scuff up the interior of the cup.

1 x Circuit Playground Express
Awesome microcontroller board packed with features!
1 x 3x AAA Battery Holder
With on/off switch

Check out this John Park's Workshop LIVE episode for more info and a flying saucer 3D modeling session!

Code the UFO with CircuitPython

The Circuit Playground Express has all the features you'll need to make a great, reactive light and sound effects pack for your flying saucer. And, coding it all in CircuitPython is straightforward and uses high level commands to make things simple.

We'll use the built in accelerometer to measure the orientation of the board, and then use those readings to effect the light colors, the pitch of the sounds, and the speed of the light/sound cycle.

For example, we can have it make faster, higher pitched sounds when tilted, and then slow down and lower the tones when the craft is level. This is usually when the aliens do all of their abductions of cows and otherwise peaceful citizens, BTW.

The Circuit Playground Express can be used with three different programming methods: CircuitPython, Arduino, and Make:Code. For this project we'll use CircuitPython.

Make sure know how to set up your Circuit Playground Express  for use with CircuitPython by following this guide

Once you've installed the latest version of CircuitPython for Circuit Playground Express from here and the library bundle from here, (be sure to unzip it and replace the lib folder on your CIRCUITPY drive with the new one from the bundle) you're ready!

Now, you're can to add a small CircuitPython script to tell the board what to do! Copy the code from the section below, then paste it into a new document in your favorite code/text editor.

With your Circuit Playground Express plugged in, you'll see a drive on your computer called CIRCUITPY. Save the file to this drive as main.py.

#  UFO Flying Saucer with Circuit Playground Express
#  https://learn.adafruit.com/ufo-circuit-playground-express/
#  Plays UFO lights and sounds if the board is upside down only,
#  Tilt to change light color, cycle speed, tone pitch

from adafruit_circuitplayground.express import cpx
import neopixel
import board
import time

#create neopixel object. set brightness lower if needed, say .2
pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=.8)

def simpleCircle(wait, R, G, B):  # timing, color values per channel
    baseFreq = int(20 + (G * 0.3))  # tone value derived from rotation

    for i in range(10):
        pixels[i] = ((0, 0, 0))
        cpx.start_tone(baseFreq + i)  # increasing pitch sweep
        time.sleep(wait)

    for i in range(10):
        pixels[i] = ((R, G, B))
        time.sleep(wait)

# Main loop gets x, y and z axis acceleration, prints the values, and turns on
# lights if the UFO is upside down, plays tones
while True:
    R = 0
    G = 0
    B = 0
    x, y, z = cpx.acceleration  # read the accelerometer values

    R = 10 * (R + abs(int(x)))  # scale up the accel values into color values
    G = 10 * (G + abs(int(y)))
    B = 10 * (B + abs(int(z)))

    # check for upside down state on z axis
    if z < 0:  # any negative number on z axis means it's upside down enough
        speed = (0.01 * (B * 0.025))
        simpleCircle(speed, R, G, B)  # speed based on tilt, .01 is good start

    else:  # right side up means no colors or sound!
        pixels.fill((0, 0, 0))
        cpx.stop_tone()

Now, try tilting your board. You'll see that it doesn't do anything while it is right side up, with the board facing the ceiling. But once you tilt it beyond 90 degrees to point it toward the ground, the lights will start to cycle and the sound effects will begin to play!

Notice how different angles create different colors, sound pitches, and frequency of the effects. 

The "normal" range for play_tone values is usually ~100-2000 -- higher than what we're using here. But these very low values -- in the 20s and 30s -- create a strange glitchy sound that's perfect for a UFO!

Now, it's time to package your lights and sounds inside a UFO!

Build the Flying Saucer

You have a few options for making your flying saucer. Paper plates, pie tins, frisbees, hubcaps, and more can be excellent starting points.

  • Cut a hole for the battery connector in the bottom plate
  • Pass the cable through to connect to the Circuit Playground Express's JST battery jack
  • Tape the Circuit Playground Express to the bottom of your saucer
  • Tape the battery box inside the plate
  • Cut a hole in the center of the top plate, so you can still access the battery box's on/off switch
  • Connect the plate halves together with tape or staples
  • Cover the hole with the "cockpit" of your UFO, such as a disposable coffee cup lid, and tape it in place with a hinge-like strip of tape

Now, you can test out your UFO! As you rotate and tilt it, you'll hear the different pitches, see the varying light colors, and the overall frequency of the cycle with change!

For the tractor beam that's used for farm animal abductions, you can use a clear plastic drinking cup. By scuffing up the inside of the cup with some sandpaper, you can create a nice diffusion that will showcase the great lighting effects!

Land the UFO on your tractor beam to see the great lighting effect!

Or, you can 3D print the model linked below. You'll need some 2.5mm nylon screws and nuts to fasten the model halves together.

  • Depending on your printer, you may be able to print the top and bottom sections intact (as seen in the second image here) or in halves for joining
  • Place the Circuit Playground Express inside the saucer, facing down, and use tape to secure it and the battery pack
  • Assemble the top and bottom, being sure to rotate the upper section before screwing in the screws and nuts to hold it all together if you printed each section in halves
  • There will be a large, obvious seam, but that's part of the fun with this B-grade sci-fi film look!

You can also find some excellent plastic model kits at hobby shops and online. Then, you can use your imagination and creativity to modify the model kit to fit your Circuit Playground Express and battery pack.