# Dancing Inflatables: Make your Holiday Display Move

## Overview

https://youtu.be/2FLR7qpN-5A

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.

Info: 

![](https://cdn-learn.adafruit.com/assets/assets/000/140/792/medium800/adafruit_products_Tentacles%281%29.jpg?1761595447)

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.&nbsp;

![sensors_2935-17.jpg](https://cdn-learn.adafruit.com/assets/assets/000/090/397/medium640/sensors_2935-17.jpg?1586978141)

![](https://cdn-learn.adafruit.com/assets/assets/000/090/262/medium800/makecode_powerswitch.jpg?1586559551)

## Parts
Featured
### Circuit Playground Express

[Circuit Playground Express](https://www.adafruit.com/product/3333)
 **Circuit Playground Express** is the next step towards a perfect introduction to electronics and programming. We've taken the original Circuit Playground Classic and made it even better! Not only did we pack even more sensors in, we also made it even easier to...

Out of Stock
[Buy Now](https://www.adafruit.com/product/3333)
[Related Guides to the Product](https://learn.adafruit.com/products/3333/guides)
![A Black woman's manicured hand holds a round microcontroller with lit up LEDs.](https://cdn-shop.adafruit.com/640x480/3333-05.jpg)

Featured
### Controllable Four Outlet Power Relay Module version 2

[Controllable Four Outlet Power Relay Module version 2](https://www.adafruit.com/product/2935)
Say goodbye to hazardous high voltage wiring and create the [Internet of Things](https://www.adafruit.com/categories/342) with safe, reliable power control. The **IoT Power Relay** &nbsp;from&nbsp;[Digital...](http://www.digital-loggers.com/iot.html)

In Stock
[Buy Now](https://www.adafruit.com/product/2935)
[Related Guides to the Product](https://learn.adafruit.com/products/2935/guides)
![Controllable Four Outlet Power Relay Module](https://cdn-shop.adafruit.com/640x480/2935-13.jpg)

Featured
### 5V 2.5A Switching Power Supply with 20AWG MicroUSB Cable

[5V 2.5A Switching Power Supply with 20AWG MicroUSB Cable](https://www.adafruit.com/product/1995)
Our all-in-one 5V 2.5 Amp + MicroUSB cable power adapter is the perfect choice for powering single-board computers like Raspberry Pi, BeagleBone, or anything else that's power-hungry!

This adapter was specifically designed to provide 5.25V, not 5V, but we still call it a 5V USB...

In Stock
[Buy Now](https://www.adafruit.com/product/1995)
[Related Guides to the Product](https://learn.adafruit.com/products/1995/guides)
![MicroUSB power supply with bundled cable and U.S. plugs.](https://cdn-shop.adafruit.com/640x480/1995-02.jpg)

Featured
### Bolt-On Kit for Circuit Playground, micro:bit, Flora or Gemma

[Bolt-On Kit for Circuit Playground, micro:bit, Flora or Gemma](https://www.adafruit.com/product/4103)
You have a [Circuit Playground Express](https://www.adafruit.com/product/3333), and want to connect some wires to it for adding LEDs or sensors or speakers? You can use our nice alligator clips, but they are a little bulky. If you aren't quite ready to solder to your Playground,...

In Stock
[Buy Now](https://www.adafruit.com/product/4103)
[Related Guides to the Product](https://learn.adafruit.com/products/4103/guides)
![Close up angled shot of a LED strip attached and powered by a circuit playground. ](https://cdn-shop.adafruit.com/640x480/4103-06.jpg)

### 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&nbsp;

Adafruit has a [precision screwdriver kit](https://www.adafruit.com/product/424) 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:&nbsp; **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.

# Dancing Inflatables: Make your Holiday Display Move

## 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.

![makecode_00_powerswitch.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/090/229/medium640/makecode_00_powerswitch.jpeg?1586479599)

![makecode_01_removeplug.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/090/231/medium640/makecode_01_removeplug.jpeg?1586479971)

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.

![makecode_02_wireplug.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/090/230/medium640/makecode_02_wireplug.jpeg?1586479658)

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.

![makecode_03_plugin.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/090/232/medium640/makecode_03_plugin.jpeg?1586480030)

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.

![makecode_04_wireCPX.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/090/233/medium640/makecode_04_wireCPX.jpeg?1586480104)

Finally, connect your USB power cord to the Circuit Playground's USB port and plug it into the unmarked outlet -- this one is always on so works great for powering your Circuit Playground.

![makecode_06_pluginCPX.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/090/234/medium640/makecode_06_pluginCPX.jpeg?1586480185)

# Dancing Inflatables: Make your Holiday Display Move

## Code with MakeCode

**[Microsoft MakeCode for Adafruit](http://adafruit.makecode.com)&nbsp;**is a web-based code editor&nbsp;for physical computing. It provides a block editor, similar to Scratch or Code.org, and also a JavaScript editor for more advanced users.&nbsp;

This means you can drag and drop functionality that triggers the Circuit Playground Express' onboard inputs without ever writing a single line of code.&nbsp;

[Go Deeper: Check out our MakeCode intro guide here.](https://learn.adafruit.com/makecode/what-is-makecode)
## 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](https://makecode.adafruit.com/). Select New Project to get to the editor window.

![](https://cdn-learn.adafruit.com/assets/assets/000/140/782/medium640/adafruit_products_newprojecct.jpg?1761589595)

The colored tabs contain the different blocks of code we'll be using.

Find the green " **on start**" block inside the&nbsp; **LOOPS** tab and drag it into the workspace. Anything we put in this block will run when the Circuit Playground first boots up.&nbsp;&nbsp;

Find the red " **digital write Pin A0 to high/low**" blocks under&nbsp; **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&nbsp; **LOOPS**.&nbsp; 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.

![](https://cdn-learn.adafruit.com/assets/assets/000/140/783/medium640/adafruit_products_makecode_simple_timer.jpg?1761589627)

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.&nbsp;** Simply drag the code you create in the next step to this drive to program the Circuit Playground.

![sensors_makecode_upload.jpg.jpg](https://cdn-learn.adafruit.com/assets/assets/000/090/508/medium640/sensors_makecode_upload.jpg.jpg?1587417409)

Give your project a name and save it, then click the pink **DOWNLOAD** button. A .uf2 file will be saved to your downolads folder.&nbsp;

Drag this file onto your **CPLAYBOOT** drive to program the Circuit Playground.

![](https://cdn-learn.adafruit.com/assets/assets/000/140/784/medium640/adafruit_products_download.jpg?1761590512)

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.

![](https://cdn-learn.adafruit.com/assets/assets/000/140/790/medium640/adafruit_products_Adafruit_Circuit_Playground_Express_-_Blocks___Javascript_editor.jpg?1761593083)

# Dancing Inflatables: Make your Holiday Display Move

## 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.

&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/140/785/medium640/adafruit_products_startup.jpg?1761591921)

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!

![](https://cdn-learn.adafruit.com/assets/assets/000/140/786/medium640/adafruit_products_run.jpg?1761592035)

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.

![](https://cdn-learn.adafruit.com/assets/assets/000/140/787/medium800/adafruit_products_IMG_4894.jpeg?1761592473)

## 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.


## Guide Products

### Circuit Playground Express

[Circuit Playground Express](https://www.adafruit.com/product/3333)
 **Circuit Playground Express** is the next step towards a perfect introduction to electronics and programming. We've taken the original Circuit Playground Classic and made it even better! Not only did we pack even more sensors in, we also made it even easier to...

Out of Stock
[Buy Now](https://www.adafruit.com/product/3333)
[Related Guides to the Product](https://learn.adafruit.com/products/3333/guides)
### Controllable Four Outlet Power Relay Module version 2

[Controllable Four Outlet Power Relay Module version 2](https://www.adafruit.com/product/2935)
Say goodbye to hazardous high voltage wiring and create the [Internet of Things](https://www.adafruit.com/categories/342) with safe, reliable power control. The **IoT Power Relay** &nbsp;from&nbsp;[Digital...](http://www.digital-loggers.com/iot.html)

In Stock
[Buy Now](https://www.adafruit.com/product/2935)
[Related Guides to the Product](https://learn.adafruit.com/products/2935/guides)
### 5V 2.5A Switching Power Supply with 20AWG MicroUSB Cable

[5V 2.5A Switching Power Supply with 20AWG MicroUSB Cable](https://www.adafruit.com/product/1995)
Our all-in-one 5V 2.5 Amp + MicroUSB cable power adapter is the perfect choice for powering single-board computers like Raspberry Pi, BeagleBone, or anything else that's power-hungry!

This adapter was specifically designed to provide 5.25V, not 5V, but we still call it a 5V USB...

In Stock
[Buy Now](https://www.adafruit.com/product/1995)
[Related Guides to the Product](https://learn.adafruit.com/products/1995/guides)
### Bolt-On Kit for Circuit Playground, micro:bit, Flora or Gemma

[Bolt-On Kit for Circuit Playground, micro:bit, Flora or Gemma](https://www.adafruit.com/product/4103)
You have a [Circuit Playground Express](https://www.adafruit.com/product/3333), and want to connect some wires to it for adding LEDs or sensors or speakers? You can use our nice alligator clips, but they are a little bulky. If you aren't quite ready to solder to your Playground,...

In Stock
[Buy Now](https://www.adafruit.com/product/4103)
[Related Guides to the Product](https://learn.adafruit.com/products/4103/guides)
### Pink and Purple Braided USB A to Micro B Cable - 2 meter long

[Pink and Purple Braided USB A to Micro B Cable - 2 meter long](https://www.adafruit.com/product/4148)
This cable is&nbsp;super-fashionable&nbsp;with a woven pink and purple Blinka-like pattern!

First let's talk about the cover and over-molding. We got these in custom colors, and if you&nbsp;_have_&nbsp;to have visible cables, then you might as well have the nicest fabric-bound...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/4148)
[Related Guides to the Product](https://learn.adafruit.com/products/4148/guides)

## Related Guides

- [Adafruit Circuit Playground Express](https://learn.adafruit.com/adafruit-circuit-playground-express.md)
- [Creating Slideshows in CircuitPython](https://learn.adafruit.com/creating-slideshows-in-circuitpython.md)
- [Expressive Pixels for Adafruit Matrix Portal](https://learn.adafruit.com/expressive-pixels-for-matrix-portal.md)
- [Make It Plot](https://learn.adafruit.com/make-it-graph-plot.md)
- [Glowing Bottle Castle and Capacitive Touch Piano](https://learn.adafruit.com/glowing-bottle-castle-and-capacitive-touch-piano.md)
- [No-Touch Hand Wash Timer for Circuit Playground Express and CLUE](https://learn.adafruit.com/no-touch-hand-wash-timer-for-cpx-and-clue.md)
- [Feather + Raspberry Pi Weather Monitoring Network with LoRa or LoRaWAN](https://learn.adafruit.com/multi-device-lora-temperature-network.md)
- [Motion Gift Box](https://learn.adafruit.com/motion-gift-box.md)
- [EZ Make Oven](https://learn.adafruit.com/ez-make-oven.md)
- [Motorized Grinch Fireplace](https://learn.adafruit.com/grinch-fireplace.md)
- [Magical Cardboard Craft Obsidian Sword](https://learn.adafruit.com/cardboard-obsidian-sword.md)
- [HalloWing All-Seeing Skull](https://learn.adafruit.com/hallowing-all-seeing-skull.md)
- [Astrolite NeoPixel Upgrade](https://learn.adafruit.com/astrolite-neopixel-upgrade.md)
- [Adafruit IO Basics: Schedule Actions](https://learn.adafruit.com/adafruit-io-basics-scheduled-triggers.md)
- [Tappy Robotic Hand](https://learn.adafruit.com/robotic-tapping-hand-with-cpx.md)
- [StarFlower NeoPixel Strand with MakeCode](https://learn.adafruit.com/starflower-neopixel-strand.md)
