Classroom Activity
Coding a Radio Message for Space
Overview
In this activity, students use their knowledge of coding to create a system that can send and receive radio signals. Students then encode a message into the signal that can be decoded by other students.
Materials
Management
- Depending on student abilities, students can code in a text-based language, such as Python or JavaScript, or a visual-based language, such as MakeCode, Blockly, or Scratch.
- Some devices, such as Micro:bits, have built-in radio receivers, transmitters, LEDs, etc.. Other devices will need to have them attached and will require additional coding to function.
- When working with a limited number of devices, check to see if the microcontroller you are using has an online emulator that students can use to test their code before loading it to the device(s).
- Depending on availability of devices, consider splitting students into groups that write code for receiving devices or transmitting devices exclusively.
- Students should run and debug their code throughout the programming process rather than waiting to test everything at the end.
Background
NASA has been sending robotic spacecraft into the solar system for more than five decades. These mechanical explorers have ventured out to study every planet in the solar system and more, serving as our eyes and ears on their journeys to these far-off worlds by sending wondrous images and fascinating information back to Earth.

The Deep Space Network is made up of three complexes of antennas located approximately 120 degrees apart so we never lose touch with spacecraft even as Earth rotates. Image credit: NASA/JPL-Caltech | + Expand image
But none of these missions of discovery would have been possible without NASA’s Deep Space Network, or DSN – a worldwide system of sensitive antennas that communicates with interplanetary spacecraft. The Deep Space Network is made up of complexes of antennas at three locations around the globe: one complex in Goldstone, California (in the Mojave Desert), one near Canberra, Australia, and one near Madrid, Spain. This arrangement allows for any one station to have a line of sight with a spacecraft as Earth rotates. When a spacecraft “sets” below the horizon (like the Sun does at the end of each day) as viewed from one antenna station, another antenna station can track the spacecraft as it rises above the horizon at that location. This repeats as Earth rotates and the spacecraft moves out of view of the second station and into view of the third, and so on.
Watch this video to find out how NASA uses giant antennas stationed around Earth to navigate faraway spacecraft. | Video Transcript

A 34-meter antenna at the Goldstone Deep Space Communications Complex in Goldstone, California. Image credit: NASA/JPL-Caltech | + Expand image
Signals sent between the Deep Space Network and spacecraft travel millions, even billions, of kilometers, yet these signals are transmitted at very low power, usually at about the same wattage as a refrigerator light bulb (20 watts). As the signal travels to Earth, it weakens. Signals arriving at DSN antennas on Earth can be as weak as a billionth of a billionth of a watt. That is 20 billion times less than the power required for a digital wristwatch.
To hear the low-power spacecraft signal, receiving antennas on Earth must be very large, with extremely sensitive receivers. The signal from the spacecraft travels in a straight line, and it can be focused by a curved reflector dish (parabolic antenna). For this reason, it’s crucial to have large antenna dishes with precisely shaped surfaces. The Deep Space Network’s parabolic dishes, which range from 26 to 70 meters (85 to 230 feet) in diameter, are focusing mechanisms that concentrate power when receiving data and also when transmitting commands. The antennas must point very accurately toward the spacecraft because an antenna can “see” only a tiny portion of the sky – as though it's looking at the sky through a soda straw.
NASA experts talk about the system of antennas that make up the Deep Space Network and how it's used to communicate with distant spacecraft and collect science. | Watch on YouTube

This artist's concept shows what a new antenna dish capable of supporting both radio wave and laser communications, will look like when completed at the Deep Space Network's complex in Goldstone, California. Image credit: NASA/JPL-Caltech | + Expand image
To hear the spacecraft’s faint signal, the antennas are equipped with amplifiers, but that presents two challenges. First, the signal becomes degraded by background radio noise (static) emitted naturally by nearly all objects in the universe, including the Sun and Earth. The background noise gets amplified along with the signal. Second, the powerful electronic equipment amplifying the signal adds noise of its own. The Deep Space Network uses highly sophisticated technology and techniques, including cooling the amplifiers to a few degrees above absolute zero and employing special coding techniques so the receiving system can distinguish the signal from the unwanted noise.
The long wavelengths of radio waves mean that signals can better resist distortion, but radio waves are not very efficient when it comes to transmitting a lot of information in a short amount of time. As more and more complex data is being sent across space, NASA is exploring higher frequency (and therefore shorter wavelength) light sources to be able to beam messages more efficiently.
This new form of spacecraft communication, called Deep Space Optical Communications, will use a focused beam of infrared light to transmit information. Switching from the longer wavelengths of radio to the shorter wavelengths of infrared light could result in 100 times more data being transmitted.
Learn more about the Deep Space Network and see which spacecraft we are communicating with at this very moment on the DSN Now interactive.
Procedures
- Ask students how humans communicate with spacecraft. If necessary, share with students that radio signals are used to send commands to and receive information from spacecraft, such as photos and measurements.
- Tell students their challenge is to program a microcontroller to send a signal, receive a signal, or both, and include code that instructs an output device, such as an LED or speaker, to indicate that a signal has been sent or received.
- Sending a signal: Students will code their device to send a radio signal on command. This should be a signal triggered by an input rather than a constant radio signal.
Students should consider:- What will be sent? A single digit? A string of characters? Something else?
- What type of input will trigger the sending of the signal?
- How will the device confirm the signal has been sent?
- Can the output power level be adjusted?
- How far can the signal travel?
- How can a receiving device identify the source of this signal?
Example send-signal script in JavaScript.
Example send-signal script in Python.
- Receiving a signal: Students will develop code that will allow a device to receive a radio signal from another device. The device should indicate, in some way, that a signal has been received.
Students should consider:- How will the device display the received signal? Characters on an LED grid? Blinking lights or a buzzing sound in Morse code? Something else?
- How will the device distinguish the signal from one transmitter over another?
- How far from the transmitting device can the receiving device be and still receive a signal?
- Can the device send a return signal to the transmitting device?
Example receive-signal script in JavaScript.
Example receive-signal script in Python.
- If students are working in groups to write code for receiving or transmitting devices exclusively, be sure they work together to ensure their devices can communicate with each other.
- Testing devices: Students should test and debug their code throughout the development process. When students have a working version of the code for sending and receiving signals, they should practice sending signals between their devices to make sure their code works “in the real world” and is not affected by other devices. Students should also test what materials block or reflect signals and what materials allow signals to pass through.

Example send-signal script in Makecode. | + Expand image
![Screengrab of Makecode script with 'radio set group (2)' inside the 'on start' code block followed by 'show string [receivedNumber]' inside the 'on radio received [receivedNumber]' code block.](https://www.jpl.nasa.gov/edu/images/activities/radiomessage_receive_makecode.jpg)
Example receive-signal script in Makecode. | + Expand image
Discussion
- What do spacecraft operators need to consider when planning communications between Earth and spacecraft? Other spacecraft communicating with Earth, confirmation that signals have been sent and received, lost signals
- What do spacecraft designers have to consider when building spacecraft? Signal frequency, signal strength, distance from Earth
Assessment
- Students can explain what their code is supposed to do.
- Devices send and/or receive signals as designed.
Extensions
Explore More
Educator Guides & Resources
-
Lesson Collection: Deep Space Network
Explore a collection of standards-aligned educator guides to get students engaged in STEM while learning about the Deep Space Network.
-
Teaching Space: Engineering the Deep Space Network
In this one-hour education webinar, NASA experts discuss how we communicate with spacecraft using the Deep Space Network, a system of massive antennas stationed around the world.
-
Teaching Space: La Red del Espacio Profundo de NASA
Un bosquejo de su importancia para la exploración del universo; un esfuerzo en busca de descubrimientos beneficiosos para la humanidad.
Student Activities
-
Mars in a Minute: Phoning Home – Communicating from Mars
How did we know that the Curiosity Mars rover landed safely on the surface of Mars?
Type Video
Subject Science
-
Building With Spaghetti
Use spaghetti to build a tower modeled after the giant structures NASA uses to talk to spacecraft.
Type Project
Subject Engineering
-
The NASA Pi Day Challenge
Can you use π (pi) to solve these stellar math problems faced by NASA scientists and engineers?
Type Slideshow
Subject Math
-
Mars in a Minute: What Happens When the Sun Blocks Our Signal?
What is "solar conjunction," and how does it affect communications with our spacecraft at Mars? Learn more in this 60-second video.
Type Video
Subject Science
-
Bouncing Radio Waves Off Titan's Lakes
How does a spacecraft study the mysterious lake on Saturn's moon Titan without ever touching down on the surface?
Type Video
Subject Science