Overview
Make your holiday display dance this year with Circuit Playground and a relay-controlled power supply. Plug your 120v (or lower) inflatable tentacles, skeletons, reindeer, or monsters into the outlets on a relay controller, connect your Circuit Playground Express, and use Microsoft MakeCode to create a custom timer that turns the outlets on and off at your bidding. Tweak the timing to get them dancing, or create a random timer for organic-looking motion.
This relay controller has one plug that's always on (for powering your Circuit Playground Express via a 5V supply).
The other plugs are where it gets interesting. There are two plugs that are normally OFF and one that is normally ON. Activating the relay with the Circuit Playground turns the "on" plug to OFF, and the two "off" plugs to ON. Simple and elegant, yes?
There is only one relay in this power supply, so even though we have 3 plugs, we only have two states: the two plugs on the left will be on while the top plug on the right will be off, or vice versa.
You'll Also Need
- A small flat-head screwdriver
- A small Phillips-head screwdriver OR soldering iron (if you're not using the bolt-on kit)
- Decor: Inflatables, lights, or anything else you'd like to toggle on and off
Adafruit has a precision screwdriver kit that will work great for all your tiny screw needs.
A Note about On/Off Switched Devices
This power relay turns its outlets on and off -- that's all it does. We were trying this with various things around the house, and discovered that a lot of modern electronic devices don't come on automatically when their power plug is activated. If it's got an on/off switch, it often requires a button press to come to life, and this relay won't press the "on" button for you, it'll simply feed power. So keep that in mind when you're planning your project.
Power Switch Relay Features:
- A single input signal to switch four outlets: 1 always on + 1 normally on + 2 normally off.
- Universal control voltage 3-60VDC or 12-120VAC, or connect directly to a 12V, 48VDC, or even 120VAC circuit.
- Optical isolation, relay, hysteresis and de-bounce protection for added safety.
- A large MOV used to clamp surges for clean 90-140 AVC power.
- Durable SPDT control relay rated at 30/40A. More than 400k operations at 12A or 2million+ at 5A.
- A 12A thermal safety circuit breaker switch prevents overloads.
- Standard 19" C13 detachable cord included.
- Mounting tabs
- This power relay is professionally built and tested.
Page last edited October 28, 2025
Text editor powered by tinymce.
Assembly
You'll need a small flat-head screwdriver, and a small phillips head screwdriver (if you're using the bolt-on kit) or a soldering iron (if you're not).
On the side of the power strip is a small green wire connector. Pull that little guy out. Pliers can be your friend if it doesn't slide out easily.
Notice the markings on the box, above the connector. This little diagram tells you which wire is which.
Cut a white and a black wire to length. The length depends on your project -- if you're planning to mount the Circuit Playground someplace far away from the power switch, or use the motion triggers, you'll want to use pretty long wires. If you are planning to use a sound trigger, you can use shorter wires. I made mine the same length as my power cord (about a meter) so I'd have options.
Unscrew both of the little screws all the way. Stick the white wire into the + side and the black wire into the - side. (Labels are printed on the relay box, don't get them mixed up!). Tighten the screws down so the wires stay put.
Stick the connector back in, and double check you've got white on the left, and black on the right. Give the wires a tug so you're sure they're secure.
Strip a bit of shielding from the other end of the wires. Attach the white wire to pin A1 and the black wire to GND on the Circuit Playground. Secure the wires with the bolt-on kit, or solder them in place.
If you're using the bolt-on kit, it's best to thread the wire through the hole first and then insert the screw, rather than winding the wires around the screw head. The wires will stay attached better if you do it this way, rather than the "traditional" around-the-head method.
Note: Do not use pin A0. It is connected to the onboard speaker so it's not so good for switching things. The rest of the analog pins, including A1, work very well.
Page last edited October 28, 2025
Text editor powered by tinymce.
Code with MakeCode
Microsoft MakeCode for Adafruit is a web-based code editor for physical computing. It provides a block editor, similar to Scratch or Code.org, and also a JavaScript editor for more advanced users.
This means you can drag and drop functionality that triggers the Circuit Playground Express' onboard inputs without ever writing a single line of code.
Planning
First let's decide what we want the code to do, exactly.
My plan is to have the inflatables blow up fully when I first power them up. I timed this and they take around 10-15 seconds (if the fan is unblocked by fabric and everything goes well). In practice, they need about 20 seconds so I have time to get everything arranged.
Then, I want the inflatable fans to turn off for a moment, then turn back on for a moment -- keeping the inflatables as full as possible but letting them "sag" for a couple seconds with no air flow coming in. This will create the wiggling tentacle motion I'm looking for.
These outlets aren't individually controllable. The whole power supply switches state every time we set the pin to "low" or "high." For now, let's keep it simple and just have the outlets turn on and off every 2 seconds. It can be tweaked and dialed in a little later.
Open a web browser and head to Makecode.Adafruit.com. Select New Project to get to the editor window.
The colored tabs contain the different blocks of code we'll be using.
Find the green "on start" block inside the LOOPS tab and drag it into the workspace. Anything we put in this block will run when the Circuit Playground first boots up.
Find the red "digital write Pin A0 to high/low" blocks under ADVANCED > PINS. Drag it into the on "start loop" and the "forever" loop as shown. I connected to pin A1, so that's the pin we'll set high/low. Select it in the dropdown.
Find the green "pause" blocks under LOOPS. I want my inflatables to be on for 20 seconds at boot-up so they fully inflate, so I set the pause block in the "on start" loop to 20000 ms. Then when they start to wiggle, I want them to alternate 2 seconds on and 2 seconds off, so I set the "pause" blocks in the FOREVER loop to 2000 ms.
Plug the Circuit Playground into your computer and click the reset button. Your Circuit Playground's lights should all turn green and a drive will appear on your computer called CPLAYBOOT. Simply drag the code you create in the next step to this drive to program the Circuit Playground.
Give your project a name and save it, then click the pink DOWNLOAD button. A .uf2 file will be saved to your downolads folder.
Drag this file onto your CPLAYBOOT drive to program the Circuit Playground.
Test your code by plugging your Circuit Playground into the "always on" outlet using a USB cable, and then plugging a test device (a lightbulb or your phone charger work great) into the "normally on" and "normally off" outlets. The device plugged into "normally off" should come on for 20 seconds, then start switching on and off every two seconds.
You can easily add random timing to your project if you're really looking for that "organic" motion feel. Find "pick random" under the MATH tab and drag it into the "pause" block to set a random amount of time within a certain window.
Go easy with this idea though -- if it "randomly" chooses deflation times that are a lot longer than inflation times, your inflatable may gradually collapse.
Page last edited October 28, 2025
Text editor powered by tinymce.
Connect Inflatables
Plug your Circuit Playground Express into the outlet marked "always on" so it stays on to run your code.
When you first start up your program, plug both fans into the outlets marked "normally off". The code will pull pin A1 high, which will turn these outlets on for 20 seconds.
If you're happy with everything coming on and off at once, you're done! But if you want one "on" while the other is "off", here's how to make that happen.
Once your 20 seconds are up and the inflatables are fully inflated, switch one of the plugs to the outlet marked "normally on". This one toggles opposite the "normally off" plugs.
With this configuration, my inflatable tentacles seem to wiggle back and forth in sequence. Creepy!
You can use a splitter plugged into these outlets to control more than two inflatables, but watch your maximum current draw. My fans are drawing 3A at 120v, which is well within the range of this outlet, but if you daisy-chain too many devices you may run into problems.
Test it out by flipping the power toggle to "reset". It's easy to head back to MakeCode and adjust the timings in the "pause" loops to make your display move the way you want.
Final Notes
This setup is not weather-proof! Place the microcontroller and relay in a safe, dry location. Putting the whole thing inside a big ziploc bag is a quick and easy solution to keep the rain or sprinklers away, for a temporary holiday installation.
My whole setup became a bit complicated with power strips, splitters and extension cords. My tentacles also have lights inside, and I wanted the lights to stay ON the entire time instead of flashing on and off with the motion, so I needed to use separate extension cords for the light strips. Be sure to have a LOT of extension cords and splitters on hand.
You will also want to secure your inflatables to your house or to something solid like a lamp post. Inflatables that were not designed to dance have a tendency to want to dance away from their power source, and you could damage your setup or your inflatable if it pulls too hard.
Page last edited October 28, 2025
Text editor powered by tinymce.