Learn about variables, sequences, algorithms, and loops and code a dirt volcano!
Coders take big problems and turn them into smaller, more manageable problems. Let’s take the classic volcano experiment, an acid-base reaction, and turn it into directions for a robot to complete.
We will start with a big problem and turn it into small steps and commands that a robot can follow.
Big Problem: Make a Volcano
This post contains affiliate links. As an Amazon Associate, Our Family Code earns from qualifying purchases. Please see our Disclosure Policy for more details.
Vacation Under the Volcano
How to Code a Volcano is part of our Magic Tree House book activity series based on the Magic Tree House books by Mary Pope Osborne.
This activity is a great way to pair a STEAM concept with book number thirteen, Vacation Under the Volcano.
Find more MAGIC TREE HOUSE ACTIVITIES
- Learn the Science of Mummification with Apple Mummies
- Can You Build a Working Drawbridge? Castle STEAM Challenge
- Deciphering Dinosaur Names with Greek and Latin Words
- Rocket Ship Decomposition Unplugged Coding Activity
MAKE SURE TO GRAB THE MAGIC TREE HOUSE BOOKS 13-16 TO FOLLOW ALONG WITH MORE MAGIC TREE HOUSE ACTIVITIES!
WHY ARE UNPLUGGED CODING ACTIVITIES IMPORTANT?
Unplugged coding activities are designed to build the foundation of coding.
These activities allow kids to participate in kinesthetic opportunities that help them relate the concepts they are learning to their own lives and teach children how to think logically about objects.
Kids also learn how to break down large tasks into smaller tasks that are easier to complete and how to identify errors.
Working hands-on makes coding concepts tangible and unplugged coding activities are ideal for young coders.
Unplugged activities are great for classrooms or homes that don’t have access to the internet or a computer and ideal for young students who don’t have experience working with computers.
It’s never too early to start teaching the foundation of coding.
RECOMMENDED: GET STARTED WITH ALGORITHMS AND CODE YOUR ART!
How to Code a Volcano
If you tell a robot to build a volcano for you, would that robot know what to do?
The answer is no. A robot needs smaller, more clear directions to build a volcano for you. In this activity, we are going to learn how to communicate with a robot with clear steps and commands.
How to Do a Classic Volcano Demonstration
To conduct the classic volcano demonstration, we must find a place outside or inside that can get a little messy, make a volcano (we used some dirt!), use a small container to hold our slurry, gather our baking soda, dish soap, food coloring, and vinegar.
Let’s break these steps down into an algorithm, or set of instructions, for our robot to follow. We are going to think about each step as a smaller problem.
We also tried to use a recycled material for our demonstration too! To hold our chemical reaction, we used an old K-Cup from my morning coffee to put inside our volcano!
Step #1: Find a place to conduct your volcano demonstration.
Do you think you can tell a robot to find a place to conduct your volcano demonstration and have them find the perfect place? Why not?
For this step, we can use an If-Then-Else statement. An If-Then-Else is a conditional statement that is kind of like answering a true or false question.
If the answer is True, then you do the action listed. However, if the answer is False, you do the something else.
When giving instructions to a robot, you have to be very specific with your instructions. Our robot instructions could look something like this:
IF the spot is flat and can get messy
THEN, build a volcano
ELSE, find a new spot.
Step #2: Gather Dirt
To build our volcano out of dirt, we must first gather up some dirt! In order to gather some dirt, we might need some tools like a bucket and a shovel.
For this problem, we can write a sequence to help our robot collect the dirt and bring it to our spot. A sequence is a specific order to follow. If our code was written in the wrong order, the directions would not make sense.
Your robot should follow the sequence below. We are going to group the commands into a single function. We will call our function gatherDirt().
A function is a group of commands that can be run with one line of code rather than using multiple lines. To define a function, enter a set of commands between the { and } curly brackets to define the repeated behavior.
For the purpose of this exercise, we are going to keep the commands as they are instead of shortening them.
func gatherDirt (){
Scoop the dirt with the shovel ()
Fill the bucket with dirt ()
Dump the dirt in the spot ()
}
Depending on the size of your volcano, you might need to make several trips to get dirt.
You can use a loop to tell your robot to complete the sequence a set number of times. For our volcano, we are going to loop 2 times.
for i in 1 … 2 {
gatherDirt ( )
}
Step #3: Build a Dirt Volcano
For this step, the goal is to write the correct algorithm so that your robot builds a volcano made from dirt around a small plastic container (like a 35mm film container or half a plastic Easter egg). The dirt volcano should be taller than the container.
For this step, we can use an If-Then-Else statement just like we did in Step #1.
An If-Then-Else is a conditional statement that is kind of like answering a true or false question.
If the answer is True, then you do the action listed. However, if the answer is False, you do the something else.
IF the dirt is taller than the plastic container
THEN stop building, shape the volcano, and move to the next step
ELSE keep adding dirt
You might also like our Fitness Coding Cards to learn more about conditional statements!
Step #4: Prepare Volcano
Code should follow a sequence. For Step #4, we will use a sequence to add materials in the correct order.
Your robot should follow the sequence below in order to prepare the volcano for eruption!
Add 2 Spoonfuls of Baking Soda
Add a Spoonful of Dish Soap
Add 5 Drops of Food Coloring
Step #5: Eruption!
To complete your classic volcano demonstration, give your robot the final command!
Add 1/4 cup of vinegar
The Science Behind the Classic Volcano Activity
This is an acid-base reaction. Vinegar is an acid and baking soda is a base. When combined, they react with each other to produce sodium acetate and carbonic acid, which quickly decomposes into carbon dioxide gas and water.
The bubbles from the carbon dioxide can be seen as the reaction takes place. This type of acid-base reaction is used for baking cakes. The reaction causes cakes and breads (without yeast) to rise! How cool!!
KEY CHEMISTRY TERMS TO SHARE WITH YOUR KIDDOS
- Acid – a solution that has a higher amount of hydrogen ions than water (ex. vinegar)
- Base – a solution that has a lower amount of hydrogen ions than water (ex. baking soda)
- Neutral– a solution that has a concentration of hydrogen ions equal to water (ex. water)
- Chemical Reaction – a change in the molecular structure of a substance
- Reactants – a substance or substances that start a chemical reaction
- Products – the substance created by a chemical reaction
PRACTICE WITH FRIENDS – TAKE TURNS BEING THE ROBOT
Another fun way to do this activity is to work in a large group to identify your commands.
After you have established the commands and function, you can practice by writing your own code for a friend and see how they act as the machine and run your program.
Can your robot follow your instructions and complete the volcano demonstration?
How to Code a Dirt Volcano Free Coding Worksheet – Build Your Code!
Print out these two pages of code, cut out the blocks, and put your code in the correct steps and sequence!
This is a great way to visualize your code and work hands-on with this awesome unplugged coding activity!
PIN THIS IMAGE TO SAVE THIS UNPLUGGED CODING + SCIENCE ACTIVITY!
Unplugged Coding Activities
Find more Elementary unplugged coding activities to work on basic coding skills!
Bitmap Coding Unplugged Coding Activity for Kids
Introduce algorithms with this hands-on unplugged coding activity for kids!
Teach Kids Binary Code with this 5-bit Binary Code Challenge
Teach kids binary code by exploring the binary number system, translate letters and numbers to binary code, convert binary code to text, decode a binary code message with the ASCII binary code alphabet, and grab a free binary code workbook for kids!
Fitness Coding Card Game: Unplugged Coding Activity
Are you ready to play the Fitness Code! This Fitness coding game teaches kids coding concepts, including conditionals and variables. This activity focuses on remaking the way we traditionally teach these concepts and uses large motor movements to reinforce the activity and make it a tangible, fun learning experience!
Earth Day Coding Recycling Sorting Activity
This Earth Day coding recycling sorting activity teaches children how conditional statements work while learning how to sort recyclables!
How to Code a Lion Directed Drawing Algorithm Art
Can you follow the algorithm and draw a lion in this directed drawing unplugged coding + art activity?
Pi Necklace Coding Unplugged Coding Activity
We love to pair math and technology to create fun art! This Pi Necklace coding activity is the perfect combination of math, binary, and hexadecimal coding for upper elementary and middle school students. It’s also an engaging Pi Day activity!
Guess the Animal Unplugged Boolean Coding Activity
Learn about boolean and comparison operators with this Guess the Animal boolean coding activity!
Layers of the Rainforest Unplugged Coding Activity
Explore the layers of the rainforest and code the correct animals to each layer using logical reasoning!
Rocket Ship Decomposition Unplugged Coding Activity
This rocket ship decomposition unplugged coding activity is designed to teach kids the concept of decompositions and algorithms!
Ahoy Algorithms Treasure Hunt Unplugged Coding Activity
Pair this pirate algorithm activity with the Magic Tree House! Use your coding skills to find the treasure in this treasure hunt unplugged coding activity!
Introduce Computer Programming with this Elementary Coding Activity
This elementary coding activity is a great introduction to the basics of computer programming and is ideal as a classroom coding resource or homeschool resource for kids in Kindergarten through 5th grade. Teach kids to code!
Meet Toni, the Maker Mom behind Our Family Code
Hey there, I’m Toni! I’m a software engineer and Maker Mom that finds my joy in unleashing my children’s curiosity by exploring STEAM concepts with my fantastic five!
When I’m not chasing toddlers or raising tweens, you can find me tearing things up and putting them back together over here at Our Family Code.
I am the owner and content creator of multiple educational websites designed to increase access to STEAM & STEM education with a focus on teaching computer science and coding to kids of all ages!
You can also find out more about me by visiting ToniGardner.com!