Skip Navigation

Coding The Solar System

By Jennifer O'Driscoll
Grades 9-12
Science and Technology,
  • Programming
  • Data
Tools & Languages

Key Coding Concepts

  • Algorithms
  • Debugging
  • Functions
  • Loops
  • Sequences



A step-by-step set of operations to be performed to help solve a problem



Finding problems or ‘bugs’ in code and solving them



A type of procedure or routine that performs a distinct operation. There are often ‘canned’ functions that exist already like the ‘jump’ block



Running the same sequence multiple times i.e. repeat or forever blocks



Identifying a series of steps for a task. Computers and Scratch read and perform commands in order from top to bottom

Learners will use what they know about the distance between planets and the diameter of each to create a to-scale model in OpenProcessing.


  • Learners will need prior knowledge of the structure of our solar system - the distance between each planet, and the diameter of each (this will be a follow up to a 'Properties of Planets in Our Solar System' lesson where these things are covered).
  • It is recommended that the Code-moji lesson is completed prior to this lesson - as an introduction to Processing.


Before the lesson…

  • Review key coding concepts and ensure you are confident describing them to your group
  • Create a sketch that the learners will fork once the lesson begins (if using modifications), or use the provided starter project
  • Build the lesson’s main project, ensuring you are comfortable with all steps

Learners will log into OpenProcessing and fork this sketch.

In a 'Code-Along' environment, walk the learners through how to:

  • Increase the size of the sketch to fit the entire model
  • Resize the ellipse to be a scaled down version of the sun

Work with the learners to come up with a ratio that they will use to scale down their model. Explain that they will use the same ratio on the diameters of all of the planets to complete their model.

Once learners have a firm understanding of how to create an ellipse, explain that they will repeat this process with the rest of the planets, making each their appropriate size.

Demonstrate how to use the Processing reference guide and show them where they can look up explanations for ellipses, walk them through how to 'fill' their shape with RGB values.

Show them the Google colour picker and allow them to choose their own shade for the sun.

Finally, discuss with learners how they need to use a ratio to scale down the distance between each planet. Discuss how coordinates on a computer screen are measured in pixels, and we will be changing the km or AU distances into pixels. Have learners try to determine the appropriate distances/scale on their own.

Learners will need to reference their notes (or research) the distance between planets and decide which unit (km or AU) they will scale, and what scale they will use to represent that distance in pixels for their final display. Here’s a great website for reference.

Success Criteria

Learners can describe the major components of the solar system and the universe (e.g., planets, stars, galaxies), using appropriate scientific terminology and units (e.g., astronomical units, scientific notation, light years)

Learners are able to compare and contrast properties of celestial objects visible in the night sky, drawing on information gathered through research and using an appropriate format (e.g., compare the size of planets) [D3.3]

Learners can add additional ellipses/shapes to create dimensions/colours on their planets (i.e. Jupiter's red spot).

Learners can include moons with the planets that have them, or even include rings using arcs (sequence would become important here).


The teacher can create a starter project that provides ellipses already made to be the correct diameter - have students simply line them up to scale and change the colours.

Lunar Eclipse photo by Johannes Plenio from Pexels

Processing Reference

Distance Between Planets

Teach lessons that are tied to your existing curriculum!


More Lesson Plans For Grades 9-12

    View All Lesson Plans

    Explore lessons based on components

    The K-12 Computer Science Framework

    Although learning how to build digital projects is a key part of Computer Science education, students should also learn a wider set of skills and competencies that will help them to harness the power of digital technologies as both creators and consumers. A comprehensive approach to K-12 Computer Science education includes learning about the following five focus areas:

    View Framework ➝


    By the end of high school, students should be able to create a simple computer program.

    Computing and Networks

    By the end of high school, students should understand and be able to use the tools and devices commonly used to build digital projects.


    By the end of high school, students should be able to explain how we use computers to create, store, organize, and analyze data.

    Technology and Society

    By the end of high school, students should be able to explore the ways in which technology and society have mutually shaped each other.


    By the end of high school, students should be able to apply design principles to the digital projects they create.