Hands-on Activity Mars Sample Return Coding Challenge

Quick Look

Grade Level: 9 (8-10)

Time Required: 2 hours

Expendable Cost/Group: US $0.00

Group Size: 3

Activity Dependency: None

Subject Areas: Computer Science, Earth and Space

NGSS Performance Expectations:

NGSS Three Dimensional Triangle
HS-ETS1-2
HS-ETS1-4
MS-ETS1-1

A photo showing individual components connected to a microcontroller through a MakeON Station board.
Students design and code a microdevice
copyright
Copyright © NASA/JPL-Caltech

Summary

Students work as part of an engineering team to help complete a simulated Mars Sample Return mission. Like real engineers at NASA, each group designs and codes a microdevice to accomplish one essential task, such as loading samples, generating power, sending signals, checking systems, or launching the return rocket. Groups may use multiple coding languages simultaneously, allowing students at all experience levels to participate meaningfully. After building their individual systems, the class collaborates to integrate all components into one fully functioning mission.
This engineering curriculum aligns to Next Generation Science Standards (NGSS).

Engineering Connection

In space missions, aerospace, systems, computer, electrical, and mechanical engineers work together to design, build, test, and integrate complex systems. Aerospace engineers design the spacecraft and mission architecture, while systems engineers ensure that all subsystems function together seamlessly. Computer and electrical engineers develop and program the embedded systems, sensors, and communication networks that allow the spacecraft to operate autonomously, and mechanical engineers design the physical mechanisms responsible for movement, sample handling, and deployment. By working in specialized teams and integrating their designs into a unified mission, professional engineers engage in the interdisciplinary collaboration, problem-solving, and tradeoff analysis essential for large-scale projects such as NASA’s Mars Sample Return mission.

Learning Objectives

After this activity, students should be able to:

  • Explain how complex engineering missions rely on interconnected subsystems.
  • Design and code a functional subsystem model using sensors, inputs, and outputs.
  • Test, debug, and revise code and circuitry to meet design constraints.
  • Collaborate across teams to integrate multiple subsystems into one working system.
  • Reflect on the challenges and tradeoffs of real-world engineering teamwork.

Educational Standards

Each Teach Engineering lesson or activity is correlated to one or more K-12 science, technology, engineering or math (STEM) educational standards.

All 100,000+ K-12 STEM standards covered in Teach Engineering are collected, maintained and packaged by the Achievement Standards Network (ASN), a project of D2L (www.achievementstandards.org).

In the ASN, standards are hierarchically structured: first by source; e.g., by state; within source by type; e.g., science or mathematics; within type by subtype, then by grade, etc.

NGSS Performance Expectation

HS-ETS1-2. Design a solution to a complex real-world problem by breaking it down into smaller, more manageable problems that can be solved through engineering. (Grades 9 - 12)

Do you agree with this alignment?

Click to view other curriculum aligned to this Performance Expectation
This activity focuses on the following Three Dimensional Learning aspects of NGSS:
Science & Engineering Practices Disciplinary Core Ideas Crosscutting Concepts
Design a solution to a complex real-world problem, based on scientific knowledge, student-generated sources of evidence, prioritized criteria, and tradeoff considerations.

Alignment agreement:

Criteria may need to be broken down into simpler ones that can be approached systematically, and decisions about the priority of certain criteria over others (trade-offs) may be needed.

Alignment agreement:

NGSS Performance Expectation

HS-ETS1-4. Use a computer simulation to model the impact of proposed solutions to a complex real-world problem with numerous criteria and constraints on interactions within and between systems relevant to the problem. (Grades 9 - 12)

Do you agree with this alignment?

Click to view other curriculum aligned to this Performance Expectation
This activity focuses on the following Three Dimensional Learning aspects of NGSS:
Science & Engineering Practices Disciplinary Core Ideas Crosscutting Concepts
Use mathematical models and/or computer simulations to predict the effects of a design solution on systems and/or the interactions between systems.

Alignment agreement:

Both physical models and computers can be used in various ways to aid in the engineering design process. Computers are useful for a variety of purposes, such as running simulations to test different ways of solving a problem or to see which one is most efficient or economical; and in making a persuasive presentation to a client about how a given design will meet his or her needs.

Alignment agreement:

Models (e.g., physical, mathematical, computer models) can be used to simulate systems and interactions—including energy, matter, and information flows—within and between systems at different scales.

Alignment agreement:

NGSS Performance Expectation

MS-ETS1-1. Define the criteria and constraints of a design problem with sufficient precision to ensure a successful solution, taking into account relevant scientific principles and potential impacts on people and the natural environment that may limit possible solutions. (Grades 6 - 8)

Do you agree with this alignment?

Click to view other curriculum aligned to this Performance Expectation
This activity focuses on the following Three Dimensional Learning aspects of NGSS:
Science & Engineering Practices Disciplinary Core Ideas Crosscutting Concepts
Define a design problem that can be solved through the development of an object, tool, process or system and includes multiple criteria and constraints, including scientific knowledge that may limit possible solutions.

Alignment agreement:

The more precisely a design task's criteria and constraints can be defined, the more likely it is that the designed solution will be successful. Specification of constraints includes consideration of scientific principles and other relevant knowledge that is likely to limit possible solutions.

Alignment agreement:

All human activity draws on natural resources and has both short and long-term consequences, positive as well as negative, for the health of people and the natural environment.

Alignment agreement:

The uses of technologies and any limitations on their use are driven by individual or societal needs, desires, and values; by the findings of scientific research; and by differences in such factors as climate, natural resources, and economic conditions.

Alignment agreement:

Suggest an alignment not listed above

Materials List

Worksheets and Attachments

Visit [www.teachengineering.org/activities/view/jpl-3049-mars-sample-return-coding-challenge] to print or download.

Pre-Req Knowledge

Students should:

  • Be familiar with programming concepts such as inputs, outputs, variables, loops, conditional statements, and event-driven actions. Note: Experience with block-based or text-based coding platforms is helpful.
  • Have knowledge of simple sensors (light, distance), actuators (motors, servos), buttons, LEDs, and other output devices.

Introduction/Motivation

Who has heard of the Perseverance Mars rover? (Let students raise their hands.) The Mars 2020 Perseverance Rover searches for signs of ancient microbial life, to advance NASA's quest to explore the past habitability of Mars.

One of the most significant scientific advancements on the Perseverance Mars rover was that, unlike its predecessor, the Curiosity rover, which drilled holes, Perseverance can collect core samples. These rock cores, each just several centimeters long, will allow NASA scientists to explore internal rock structures as they exist on Mars, without reducing them to powder. But collecting the core samples is only the first step for the future of Mars exploration. Although the scientific tools onboard Perseverance are advanced, they are still limited compared to the complexity of facilities here on Earth. Thus, the question was asked: How can we bring those samples back home for analysis?

How do you think we could bring rocks back from another planet? (Let students offer answers.) Now we are going to do a quick think-pair-share. I want you to think about two questions: (1) What challenges do you think engineers face trying to do this on Mars? (2) Why wouldn’t one single team be able to handle everything? (Give students a minute to think about these questions.) I want you to turn to your shoulder partner and share your thoughts on these two questions. (Give students two minutes to think–pair–share.)

NASA is working on this exact issue. This mission is called the Mars Sample Return mission, and it is incredibly complex. It involves multiple spacecraft, robotic systems, and international engineering teams, all working together. Let’s look at this short video.

(Show the YouTube video: https://www.youtube.com/watch?v=t9G36CDLzIg [1:46 minutes].)

This short animation features key moments of the Mars Sample Return campaign: from landing on Mars and securing the sample tubes to launching them off the surface and ferrying them back to Earth. Notice that instead of one rover doing everything, the mission is broken into separate subsystems, such as collecting samples, storing them, checking systems, communicating with Earth, generating power, and launching the return rocket.

One of the first steps in this process is to retrieve the samples collected by Perseverance with its coring tool. Collecting these samples and bringing them to a stationary lander will allow for samples to be readied for launch back to Earth. Mission architecture could have the Perseverance rover (or future helicopters, as a backup) deliver the samples to our sample retrieval lander. This specific lander would be the first ever mission to bring along a rocket, called the Mars Ascent Vehicle. The lander would transfer the samples into the rocket for launch from the Martian surface. Although returning material from Mars has been impossible in the past, this rocket was specifically created to house our Martian core samples. This small rocket will carry the samples to an orbiter above the surface for redirection back to scientists eagerly waiting for the first arrival of samples sent from another planet.

Today, you are part of NASA’s engineering teams. Each group will design and code one mission subsystem. Just like the teams at NASA, each of your groups will design, code, and test a subsystem that must work with the other groups’ systems to complete the mission.

An illustration showing a concept for multiple robots that would team up to ferry to Earth samples of rocks and soil being collected from the Martian surface by NASA's Mars Perseverance rover.
This illustration shows a concept for multiple robots that would team up to ferry to Earth samples of rocks and soil being collected from the Martian surface by NASA's Mars Perseverance rover.
copyright
Copyright © NASA/JPL-Caltech

Procedure

Background (Teacher's Guide)

The Mars Sample Return (MSR) mission is an ambitious multi-step effort by NASA, in collaboration with international partners, to bring rock and soil samples from Mars back to Earth for detailed analysis. The Perseverance rover, part of NASA’s Mars 2020 mission, collects core samples of Martian rock using a coring tool. These samples are carefully stored in sealed tubes, preserving their internal structure and chemical composition, which cannot be fully analyzed with the rover’s onboard instruments. Once collected, the samples must be transferred to a stationary sample return lander on the Martian surface, a critical step that allows them to be prepared for launch.

The Mars Ascent Vehicle (MAV), a small rocket carried aboard the lander, will lift the collected samples off the surface of Mars. From there, the samples will be transferred to an orbiter, which will transport them safely back to Earth. This mission is inherently complex, requiring precise coordination between multiple spacecraft, robotic systems, and engineering teams across different countries. Each step of the mission involves specialized tasks, from sample handling and system checks to communications and launch operations. Understanding this context helps students appreciate the scale of engineering challenges and the need for careful planning, integration, and collaboration in real-world space exploration.

Systems engineering is a critical discipline in complex missions like the Mars Sample Return, focusing on designing, managing, and integrating interconnected subsystems to ensure the overall system functions as intended. Each subsystem—whether it is communications, power generation, sample handling, or launch sequencing—must operate independently while also interacting seamlessly with other components. For example, the lander’s power system must reliably provide energy to the rover handoff mechanisms, communications equipment, and rocket launch systems, all while adhering to strict timing and safety constraints.

You should emphasize that in real missions, failures in one subsystem can affect the entire operation. Engineers must plan for these interactions, consider tradeoffs, and communicate frequently across specialized teams to prevent problems and ensure mission success. By framing the classroom activity around systems engineering, students can understand that the success of the Mars Sample Return mission depends not only on individual technical skills but also on the coordination and integration of multiple subsystems into a cohesive whole.

Before the Activity (Preparation)

  • Prepare device kits with basic components.
  • Print copies of:
  • Optional: Test sample programs for:
    • Button input.
    • LED output.
    • Sensor readings.
    • Servo or motor movement.
  • Optional: Prepare integration stations where groups can connect subsystems together.

During the Activity

Mission Introduction

  1. Introduce (or review) the Engineering Design Process.
  2. Introduce the Mars Sample Return mission and explain that real missions require many teams working together.
  3. Emphasize systems engineering: Each part must work individually and as part of the whole.
  4. Distribute the Engineering Rubric to each student.
  5. Optional: Review the elements of the rubric.

Ask

  1. Present the challenge: Retrieve the samples collected by Perseverance and return the samples to Earth.
  2. Assign or have students pick from a list of objectives required to make the complete Mars Sample Return mission successful. Some suggested objectives using common devices are provided below to assist with brainstorming:
    • Sample loading into rocket: Students can code a servo or motor that will allow incoming samples to be properly loaded into the return rocket. This may also include a physical or digital counter to keep track of how many samples have been received.

A figure showing a motor connected to an on/off switch.
A motor is connected to an on/off switch.
copyright
Copyright © NASA/JPL-Caltech

    • Power and energy: Solar energy will need to be collected to power the sample return lander. Students can code a light sensor capable of signaling that it is receiving enough energy to power the station.

A figure showing a microcontroller connected to a three-LED board.
A microcontroller is connected to a three-LED board.
copyright
Copyright © NASA/JPL-Caltech

    • Communications: To be certain that the lander can send and receive signals to and from Earth, we need to have active communications. This could include coding a radio receiver and/or transmitter that indicates when a message has been sent or received. This can include an audio signal too, using a speaker, although this may present a distraction in the classroom.
    • Systems check: Before any launch, the mission should have an internal checklist to verify everything is ready to go. Students can code a manual input (buttons) or on-screen input (text prompt) to confirm all systems are working.

A figure showing a microcontroller connected to three individual LEDs and a sound board module.
A microcontroller is connected to three individual LEDs and a sound board module.
copyright
Copyright © NASA/JPL-Caltech

    • Launch the return rocket: Once the system has confirmed everything is in working order, it is time to launch our newly collected Mars rocks back home. Students can code the final operation via external inputs such as buttons, levers, etc. to initiate the launch countdown.

A figure showing a microcontroller connected to a button switch.
A microcontroller is connected to a button switch.
copyright
Copyright © NASA/JPL-Caltech

    • Rover to lander handoff: If you have a device with the capabilities, code a distance sensor that can detect when the rover has reached the sample return station. On Mars, the rover needs to safely approach the station, so consider sounds and/or lights that indicate the right distance has been reached.

Research

  1. Optional: Give students time to research their objective.

Imagine

  1. Have students brainstorm and imagine how they would code their microdevices to reach their objective. Consider framing the challenge as a “representative model.” That is to say, the rocket does not need to launch; we just need confirmation that it is ready via successful coding and interface with an external device.
  2. As students brainstorm:
    • Ensure students clearly understand their objective.
    • Have students identify the inputs, processes, and outputs.
    • Remind students to break the problem into steps.
    • Suggest they create a flowchart or pseudocode of their program logic.
    • Make sure they brainstorm multiple solutions.

(Optionally, have students complete the Imagine and Plan Worksheet.)

  1. Circulate around the room as groups brainstorm, prompting groups to also consider:
    • How will they know the code is successful?
    • What devices will they require to represent successful operations? 

Plan

  1.  Once students have brainstormed and imagined solutions, have them pick one solution that their team will implement.

Create

  1. Give student groups time to code their microdevices to reach their objective.
  2. With each student group confident in their individual code, have them determine how they will integrate their individual tasks into an integrated mission. (Note: Depending on the available  equipment, this can take many forms. For example, kits such as Mission Design Labs have a central hub that multiple students can connect to simultaneously. Others, such as Cubit, have ports that devices can connect to, although multiple Cubits may be needed to have enough ports for each group. Raspberry Pi’s, combined with breadboards, present the most flexibility on space but will also require clear communication about which group is using which General Purpose Input/Output [GPIO].)

A photo showing individual components connected to a microcontroller through a MakeON Station board.
Individual components are connected to a microcontroller through a MakeON Station board.
copyright
Copyright © NASA/JPL-Caltech

Improve and Iterate

  1. Provide ample time for revision and modification as constraints present themselves. Likely, the combined codes will not all fit together seamlessly.

Reflect

  1. Upon successful launch of the core samples (i.e., integrating all individual group code into a working class code), have students reflect on the engineering process. (Optionally, have students complete the Reflections Worksheet.) Potential reflective questions include:
    • Reflection & Improvement
      • What worked well in your design?
      • What would you improve next time?
      • If you were to repeat this project, what would you do differently to improve communication and teamwork?
      • What advice would you give future students working on a multi-team engineering challenge?
    • Understanding System Complexity
      • How did having multiple teams with different goals make the overall project more complex?
      • What challenges arose because your team’s decisions affected other teams’ work?
      • What did you learn about how complex engineering systems depend on many connected parts?
    • Tradeoffs & Decision-Making
      • What tradeoffs did your team have to make to meet your own goals while supporting the goals of other teams?
      • Describe a time when improving one part of the system caused a problem for another part. How did you handle it?
      • How did limited time, materials, or information affect your team’s decisions?
    • Communication & Collaboration
      • Why was it important for teams to communicate early and often during this challenge?
      • What happened when communication worked well between teams?
      • What problems occurred when communication was unclear, delayed, or missing?
      • How did communication help prevent or solve design conflicts?
    • Systems Thinking
      • How did your understanding of the entire system change the way your team designed its solution?
      • What strategies helped your team coordinate with other groups?
      • How is this activity like how real engineering teams collaborate on large projects?

Vocabulary/Definitions

input / output: Input refers to information or signals a system receives (e.g., button presses, sensor readings), while output refers to the action or result generated (e.g., motor movement, lights, sound).

integration: The process of combining individual subsystems into a larger system so that they work together effectively.

Mars Ascent Vehicle (MAV): A small rocket designed to lift the collected Mars samples from the surface into orbit for transfer back to Earth.

Mars Sample Return (MSR) Mission: A NASA-led mission, in collaboration with international partners, to collect rock and soil samples from Mars and return them to Earth for detailed scientific analysis.

orbiter: A spacecraft that receives the samples from the MAV in Mars orbit and transports them back to Earth.

Perseverance rover: NASA’s Mars 2020 Rover designed to search for signs of ancient microbial life and collect rock and soil samples in sealed tubes.

pseudocode / flowchart: A way to plan code or processes before programming: pseudocode uses plain language instructions, while flowcharts use visual diagrams of steps and decision points.

Sample Return Lander: A stationary platform on Mars that receives samples from the rover, prepares them for launch, and carries the Mars Ascent Vehicle.

sensor: A device that detects changes in the environment (light, distance, temperature, etc.) and converts them into signals for a microcontroller to process.

servo / motor: A device used to create controlled movement in machines, often programmed to perform precise tasks such as loading samples.

subsystem: A smaller, specialized part of a larger system that performs a specific function, such as power, communications, or sample handling.

systems engineering: A discipline focused on designing, managing, and integrating multiple subsystems to ensure the overall system functions correctly and efficiently.

tradeoff: A decision-making situation where improving one aspect of a system may cause challenges or compromises in another aspect.

Assessment

Pre-Activity Assessment

Think-Pair-Share: Before the activity begins, students think-pair-share on the following questions: How do you think we could bring rocks back from another planet? What challenges do you think engineers face trying to do this on Mars? Why wouldn’t one single team be able to handle everything?

Activity Embedded (Formative) Assessment

Imagine-Plan: Circulate the room as groups brainstorm and plan, prompting groups to also consider: How will they know the code is successful? What devices will they require to represent successful operations?

Post-Activity (Summative) Assessment

Engineering Rubric: Assess individual groups using the Engineering Rubric.

(Optional) Peer review: Students can conduct peer reviews for the design and code of the microdevices as part of the assessment to promote student cross-communication.

Troubleshooting Tips

  • Consider limiting groups to 2-4 students to ensure that all students are actively engaged, if materials allow for it.
  • This project can be tailored to include as many teams as the classroom requires, with suggested team objectives highlighted in the above objectives. Feel free to explore this as a project for a small group of students, wherein they explore each objective, or instead as a collaborative project for numerous groups, each with one objective that fits into the larger mission goal.
  • Devices such as Micro:bit and Cubit allow for students to switch between multiple languages, such as block coding and Python. This may be helpful for addressing student differentiation within groups and the class as a whole.

Activity Extensions

  • Consider extending the challenge to include how it is that we will communicate with the mission while here on Earth. This can include programming a device capable of sending written messages or detecting signals of light, depending on the types of devices available and student coding knowledge.
  • Students can also code the sample collection process by building their own game in scratch.

Activity Scaling

  • For groups with mixed coding levels, such as groups being split between block coding and Python, consider a setup where devices can be physically connected to each other and each group can demonstrate their objective(s) one at a time.
  • For students exploring more complicated coding, focus can be on the written progression of how each objective is confirmed or rejected.

Subscribe

Get the inside scoop on all things Teach Engineering such as new site features, curriculum updates, video releases, and more by signing up for our newsletter!
PS: We do not share personal information or emails with anyone.

More Curriculum Like This

High School Activity
Mars Chemistry Coding Challenge

Students use real data from the Perseverance Mars rover to create a system that monitors and tests the functioning of the Mars Oxygen In-Situ Resource Utilization Experiment (MOXIE) instrument, which converts carbon dioxide in the Martian atmosphere into breathable oxygen. Students analyze temperatu...

Middle School Lesson
The Amazing Red Planet

Students are introduced to the planet Mars. They begin by discussing the location and size of Mars relative to Earth, as well many interesting facts about this "red planet." Next, the history of Martian exploration is reviewed and students discover why researchers are so interested in studying this ...

Middle School Lesson
Come On Over Rover

During this lesson, students discover the journey that a Mars rover embarks upon after being designed by engineers and before being prepared for launch. Students investigate the fabrication techniques, tolerance concepts, assembly and field-testing associated with a Mars exploratory rover.

Middle School Lesson
Six Minutes of Terror

This lesson discusses how each component of a spacecraft is specifically designed so that a rover can land safely in six minutes. Also, students learn how common, everyday materials and technology, like nylon, polyester and airbags, are used in space-age technology.

Other Related Information

NASA/JPL-Caltech

Modified from https://www.jpl.nasa.gov/edu/resources/lesson-plan/mars-sample-return-coding-challenge

Copyright

© 2026 by Regents of the University of Colorado; original © 2025 Jet Propulsion Laboratory

Contributors

NASA/JPL-Caltech

Supporting Program

NASA Jet Propulsion Laboratory (JPL)

Last modified: April 24, 2026

Free K-12 standards-aligned STEM curriculum for educators everywhere.
Find more at TeachEngineering.org