Mars Ingenuity in flight on Mars

Coding Activity: Control NASA’s Ingenuity With Your Own Code

What if you can control NASA’s Ingenuity Helicopter?  You can with this simple coding activity built with your own code using Scratch and a cool Mars Ingenuity helo graphic.

On April 19th, 2021 NASA’s Ingenuity Helicopter took off from the surface of Mars for a short test flight.  This flight was done with programming code that controlled it’s startup, lift off, and landing.

We can now say that human beings have flown a rotorcraft on another planet

Mimi Aung, Ingenuity Project Manager, NASA Jet Propulsion Laboratory in Pasadena, California. Tweet

Ingenuity Quick Facts

  • Total flight time: about 40 seconds
  • Total weight: 4 lbs
  • Total flight height: 10 ft (3 meters)

The Mars 2020 Mission Background

As part of NASA’s Mars Exploration program, an Atlas V rocket was launched on July 30, 2020 containing a  land rover called Perseverance and Ingenuity, a small robotic helicopter.  It then touched down on Mars on February 18, 2021.

Ingenuity Specifications

You can learn a great deal more about Perseverance and Ingenuity on the NASA website but here are some things to think about when doing this coding activity.

Gravity On Mars

The atmosphere on Mars is less dense than Earth at the surface and that makes it harder for Ingenuity to fly.  You will see you can control this factor in this coding activity.


Due to the atmosphere being thinner, the propeller blades of the helicopter have to spin five times faster than on Earth in to get it up into the atmosphere.  This can place a drain on the battery and impact time in flight.


Ingenuity has six Sony Li-ion cells that are charged by it’s solar panels.


In order to navigate during flight, the helicopter uses a Linux operating system running on a Qualcomm Snapdragon 801 processor.  It contains a series of sensors that detect incline and height that are also connected to the onboard processing.  When it needs to communicate to the Perseverance rover it communicates via radio link using Zigbee communication rules (eg. protocols).

Mars 2020 Ingenuity Helicopter
By NASA/JPL-Caltech - Screenshot of, Public Domain,

Coding Activity

The following activity is an adaptation of an idea presented by where they introduce the idea of using Scratch to code a fun activity.  I take it a bit further and introduce you to some coding concepts not covered in their activity.   Still not sure what is coding?  Read my explanation to get you moving!

There are two coding activities in this download:

Introductory (Ages 7yrs old to 107 yrs old)

Designed for first time coders using Scratch and a no-code environment.  It allows you to explore programming concepts and exercise some creativity.  If you unsure what is NO-CODE, read my explanation here.

Advanced (Ages 13 yrs old to 107 yrs old)

Designed as a follow-on to the introductory activity here.  It introduces variables in a way that also simulates the effects of gravity during flight.

I hope you find this activity as fun as I enjoyed making it and teaching it to others.   Learning to code can be alot of fun but when you pair it with a real world event such as this, it can really release the creativity in a young person or anyone beginning to learn how to code.


Happy coding!! Mr Fred



Mr. Fred



Be sure to signup for the free activity where I explain things and offer a challenge!

Start Coding Today In 5 Minutes!

Get Me Coding Free Activity

Take 5 minutes and try a FREE coding activity!

Let Me Help You

GetMeCoding Mentoring

If you are a teacher or someone looking to help others learn to code, let me help you.

Scroll to Top

it only takes

5 Minutes and 22 Seconds