DIY If/Then Machine

I was thinking about activities to accompany my I Can Code board books, and came up with this fun DIY If/Then machine! This machine uses playdough to create an interactive pop-up animal machine for little ones.


Makey Makey (It’s pricey, but you can find all sorts of online lessons and tutorials for creating lots of tangible inventions for different ages.)
• Playdough (Or fruit! Or marshmallows! Anything conductive, meaning electricity can flow through it, will work.)
• Computer (NOTE: If your computer doesn’t have a USB port, you will need a dongle to connect the Makey Makey.)

STEP 1. Open the Scratch project

Open the Scratch project here.
Click on the green flag to run the project.
Click the fullscreen icon to make it fullscreen.

NOTE: I built this project by “remixing” an existing project under the CC BY-SA 2.0 license by @seraphicheart, who created all of the adorable art!

Scratch is a project of the Scratch Foundation, in collaboration with the Lifelong Kindergarten Group at the MIT Media Lab. It is available for free at

Tip: You can make sure the Scratch project is running properly by pressing the arrow keys to make animals pop up.

STEP 2. Plug in your Makey Makey

Plug in your Makey Makey into your computer. (If your computer throws up a dialog box, you can just dismiss it. You can learn more about setting up your Makey Makey for the first time here.)

STEP 3. Set up your connections

Attach an alligator clip to the following spots on the Makey Makey:
• Left Arrow
• Right Arrow
• Up Arrow
• Down Arrow
• Space
• Earth (typically, you use black for this one)

Attach a playdough ball to other end of each of the alligator clip wires. Be sure to keep track of which one is earth!

STEP 4: Play!

Touch the Earth playdough ball with one hand. Then touch each of the other playdough balls with your other hand to make the animals pop up! IF you press the yellow playdough, THEN what happens?

You can even identify which animals pop-up for each playdough ball and turn them into little animals to match their pop-ups!


When you touch the Earth clip and another clip, you are completing a circuit with your body through the playdough! When a circuit is completed, the Makey Makey sends a signal to the computer, telling it that a key has been pressed. Each of the clips sends a different key command when the circuit is completed.

The Scratch project is listening for keypress commands. When it receives a command from the Makey Makey, it shows the appropriate animal and backdrop, while hiding all the others. If you’d like to see the code, click “see inside” on the project and click on each sprite to see the code attached. (If you’d like to learn more about coding in Scratch, check out their tutorials. If you are new/introducing a younger kid to coding, I recommend trying ScratchJr.)


• Try other conductive materials, like fruit or marshmallows, or cups of water.
• Experiment with materials to figure out what is conductive, and what is not!
• Try hooking up your circuit to other Scratch Makey Makey projects, like the Makey Makey piano or Makey Makey Whack-a-Mole game.

My Books

I Can Code uses simple text, colorful illustrations, and interactive flaps to help little ones discover the building blocks of coding all around them! Released Oct 6, 2020.


If you’d like to receive occasional updates on book news, giveaways, and kids’ activities, please join my email list!

Success! You're on the list.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s