Build a Wearable Device Using an Arduino to Keep Astronauts Safe on Mars
Abstract
Astronauts on Mars missions must be protected from hazardous environments, like steep cliffs, rocky terrain, and extreme temperature variations. How can geofencing help? In this project, you will design a system that uses geofencing technology coupled with biosensors to ensure astronaut safety. The system will create a virtual boundary around astronauts, providing alerts if they approach dangerous areas or leave designated safe zones, or if their vital signs fall below a certain threshold. Can you build a reliable safety net for astronauts on Mars?
Summary
Previous Arduino experience is recommended. See our How to Use an Arduino page for tutorials.
A kit is available from our partner Home Science Tools®. See the Materials section for details.
No issues
Objective
Design and build a wearable astronaut safety device.
Introduction
Exploring Mars has been on the minds of space agencies for generations; however, it is no easy feat. While space agencies, such as NASA, have sent rovers and orbiters to Mars, no human has stepped foot on Mars. Why is that? Well, one of the reasons is due to how unsafe Mars is for humans, from lack of breathable oxygen to high levels of radiation and extreme temperatures. If we want to be able to explore Mars we need to do it in a way that keeps astronauts safe. One approach to achieving this is by establishing safe zones—areas that are less hazardous, such as those free from steep cliffs. Information required to be able to define these “safe zones” can be gathered through data collected by Mars rovers and spacecraft in orbit. Figure 1 shows an image of the surface of Mars taken by NASA's Perseverance rover.

Geofencing is a method of creating these virtual boundaries or safe zones on Mars, where astronauts can safely roam and work without fear of encountering dangerous terrain or high-risk areas. "Geo" comes from "geography" as the fencing is defined by location i.e. GPS coordinates. Using sensors and real-time location tracking, we can define these boundaries and alert astronauts when they are approaching hazardous areas, such as steep cliffs or high-radiation zones. To put yourself in the shoes of the astronaut, watch this video, which is a visual exploration of Mars:
In this project, you will create a device that uses sensing and geofencing to keep astronauts safe while exploring Mars. Geofencing uses GPS technology to create virtual geographic boundaries that enable code to trigger some sort of response when a device leaves a particular location. By using sensors to track location and monitor environmental conditions, your device will warn astronauts if they are about to leave a safe zone and enter a restricted or dangerous area. To do this, you'll need to understand how to use GPS technology for tracking, as well as how to work with sensors that can detect environmental factors like air quality and temperature. You will also need to program your device to send warnings, either through flashing lights or audio cues, when an astronaut approaches a danger zone. This approach will make use of basic geofencing concepts, allowing you to create a real-time safety system for astronauts. To learn more about geofencing and how it works, watch the following video:
Your project will involve designing a prototype wearable device that integrates GPS, sensors, and geofencing software. As you build and test your device, you will learn how these technologies work together to create a system that can protect astronauts during their missions on Mars. Can you design a system that will keep astronauts safe as they explore the Martian surface?
Terms and Concepts
- Geofencing
- Mars
- Safe zones
- Sensors
- Geofencing
- GPS technology
- Wearable device
Questions
- How has Mars previously been explored?
- How can you use data from those explorations to help design the geofence boundaries?
- How can geofencing technology be implemented on Mars, where GPS may not function as it does on Earth?
- What communication technologies can be used to send alerts and data to a remote monitoring station on Mars or Earth?
Bibliography
- Science Buddies (n.d.). Engineering Design Process. Retrieved May 6, 2025
- Science Buddies (n.d.). How to Use an Arduino. Retrieved May 6, 2025
Materials and Equipment 
Recommended Project Supplies
Note: this is an engineering design project. The circuit diagram and example code in the project's procedure will show you how to use the components listed below. However, you may choose to remove, substitute, or add other sensors or outputs to your project.
-
Electronics Kit for Arduino, available from our partner Home Science Tools®.
The kit includes the following parts that you need for this project:
- Arduino-compatible microcontroller board
- Note: This project will work with the Arduino UNO R3, UNO R4 Minima, UNO R4 WiFi, and compatible third-party boards.
- Breadboard
- Ultrasonic distance sensor
- 9V battery with snap connector
- Assorted jumper wires
- 10kΩ resistor
- Arduino-compatible microcontroller board
- Sensors
- NEO-7M. This is the GPS module you will use to collect coordinates and define the 'safe zone.' While Mars currently lacks GPS satellites, for the purposes of this project, we'll assume that Mars has been colonized and GPS satellites are now in orbit, enabling us to track location accurately. In reality, radio frequency towers and receivers might be necessary for this function.
- Heart rate pulse sensor to monitor the astronaut's vitals to enure they stay safe and healthy. A high pulse could indicate they are hurt or in danger, and an alert will be sent.
- DS18B20 temperature sensor to track the ambient temperature and send an alert if this gets too high or falls too low, which could indicate that the astronaut has left the 'safe zone.'
- Air quality sensor that can detect gases like Ammonia (NH3), sulfur (S), Benzene (C6H6), CO2, and other harmful gases and smoke. This can help us keep the astronaut safe by alerting them if any of these gases go above a safe threshold. The following video shows how it can be used to detect flammable gases, smoke, and alcohol:
-
- MPU6050 (optional): if you want another added layer to keep the astronaut safe, you can add this inertial measurement unit, which contains an accelerometer and a gyroscope, and can detect if the astronaut falls or has not moved for a long period of time.
- Alert system
- OLED display to inform the astronaut of their position and vitals
- LEDs (optional)
- A buzzer to alert the astronaut if their vitals fall out of the safe range or if they leave the 'safe zone'
- Communication
- ESP8266 Wi-Fi Module (optional) to communicate the astronaut's vitals and location information back to a central base station on Mars. We can use it to send information to ThingSpeak, an open Internet of Things (IoT) platform.
- Wearable device
- Plastic or cardboard box to house the electronics
- Velcro straps to attach the device to the astronaut
- Windows or Mac computer. See this page if you have a Chromebook. Your computer will need:
- Access to the Arduino IDE, either installed local version or web-based editor. Watch this video for a comparison of the two options.
- USB port. The Science Buddies kit comes with a USB-A to C cable. The "C" end plugs into the Arduino, and the "A" end plugs into your computer. You will need an adapter or different cable if your computer only has USB-C ports. Watch this video to learn about the different types of cables and adapters.
Disclaimer: Science Buddies participates in affiliate programs with Home Science Tools®, Amazon.com, Carolina Biological, and Jameco Electronics. Proceeds from the affiliate programs help support Science Buddies, a 501(c)(3) public charity, and keep our resources free for everyone. Our top priority is student learning. If you have any comments (positive or negative) related to purchases you've made for science projects from recommendations on our site, please let us know. Write to us at [email protected].
Experimental Procedure

You will first assemble your circuit and test your code. This makes it easier to identify and fix any issues with your circuit or code. After everything is working, you will house your Arduino and circuit into a box and then test the wearble device.
Assemble the circuit
See Figure 2 for the circuit diagram and Figure 3 for the final result of what your circuit will look like. Important: this is an advanced project. The instructions assume you know how to use a breadboard and how to build a circuit from a circuit diagram. Review the linked resources if you need help.

Figure 2. Circuit Diagram of the Safety Wearable Device
- First, let's wire the 5V and GND pins from the Arduino Uno R4 to the breadboard. This will serve as your power distribution for all components.
- 5V from Arduino → Breadboard positive rail (+)
- GND from Arduino → Breadboard negative rail (-).
- The GPS Neo 7M communicates via serial (TX/RX), so you'll connect the TX and RX to the RX and TX on the Arduino, respectively:
- VCC → Breadboard positive rail (+)
- GND → Breadboard negative rail (-)
- TX → RX (Pin 0) on Arduino
- RX → TX (Pin 1) on Arduino
- Note: When using TX/RX for serial communication, you need to be careful not to interfere with the Arduino’s USB serial connection. For proper serial communication, you should disconnect these two wires when connecting to USB to upload code, then reconnect after the code is uploaded.
- The MAX30102 Heart Rate and Oxygen Sensor wiring is as follows:
- +ve → Breadboard positive rail (+)
- -ve → Breadboard negative rail (-)
- S → A1 on Arduino
- The DS18B20 uses a 1-Wire communication protocol, and it needs a 10kΩ pull-up resistor between the Data Pin and VCC to work correctly.
- VCC → Breadboard positive rail (+)
- GND → Breadboard negative rail (-)
- Data Pin → A2 on Arduino
- 10kΩ Pull-up Resistor between Data Pin (A2) and VCC (5V)
- The MQ-135 Gas Sensor uses analog output, so you'll connect the AOUT pin to an analog pin on the Arduino for reading gas concentrations:
- VCC → Breadboard positive rail (+)
- GND → Breadboard negative rail (-)
- AOUT → A0 on Arduino
- The OLED Display communicates via I2C, so you'll connect SCL and SDA to the corresponding pins on the Arduino.
- VCC → Breadboard positive rail (+)
- GND → Breadboard negative rail (-)
- SCL → A5 (SCL pin) on Arduino
- Pin A5 has SCL functionality, even though this is not labeled on your Arduino
- SDA → A4 (SDA pin) on Arduino
- Pin A4 has SCL functionality, even though this is not labeled on your Arduino
- The buzzer can be connected to any digital pin on the Arduino for feedback alerts:
- Buzzer Pin 1 → Pin D9 on the Arduino
- Buzzer Pin 2 → Breadboard negative rail (-)
- 9V battery clip for portable power:
- Connect the battery clip from the Arduino kit to the battery
- Connect the other end to the battery jack of the Arduino

Figure 3. Final result of what your circuit will look like once assembled and placed inside a box.
Test Your Code
Since this is a complex project with lots of moving parts, first we will test everything individually to confirm it all works, and then integrate everything together.
- To start off simple download this code to first just display temperature on the OLED screen.
- After that, try this code which allows you to blink the Arduino onboard LED using the heart rate sensor and your heartbeat.
- This code contains the rest of the sensor capabilties. So now incoporate it into your script depending on which sensors you chose to use.
- Now let's start incorporating the geofence capabilities! this code contains just that.
- To obtain the GPS coordinates of your location, follow these steps:
- Open Google Maps, click on your location, then right-click to display the coordinates at the top.
- Once you have your coordinates, update the code with your location and set a reasonable radius, such as 10 meters.
- The geofence radius in the code is set to 0.00005 degrees, which translates to about 5.57 meters (18 feet) in real-world distance. Since one degree of latitude is approximately 111,320 meters, multiplying by 0.00005 gives this small radius.
- With such a small geofence, even a minor misclick on Google Maps—like selecting the house next door—could place the user outside the safe zone immediately. Increasing the radius slightly could help avoid these issues.
- To test the geofence capabilities, move the GPS module around to simulate movement and observe how the system responds to the geofence.
- Geofence Alert:
- If you move outside the geofence area, the buzzer should activate.
- If the buzzer doesn’t sound when crossing the geofence boundary, check the geofence_lat, geofence_lon, and geofence_radius values that you entered are correct.
- Inside the Geofence:
- When within the geofence area, the buzzer should turn off.
- Geofence Alert:
- The OLED screen should display:
- Temperature (°C) – accurately updates in real-time.
- If the OLED does not display correctly, check wiring connections for the display.
- Now that we've confirmed everything works, here is the full code!
- This code integrates all the components you've set up, including MQ135 gas sensor, GPS module, temperature sensor, pulse sensor, and OLED display. It continuously reads data from these sensors and displays relevant information on the OLED screen while also triggering alerts based on certain conditions.
- What the code does:
- Monitors air quality using the MQ135 gas sensor.
- Retrieves GPS coordinates using the GPS module and checks if the location is within a predefined geofence.
- Measures temperature with the Dallas Temperature sensor.
- Reads heart rate signals from the pulse sensor and flashes the onboard LED.
- Displays this information on the OLED screen.
- Triggers a buzzer if the device moves outside the geofenced area.
- Try modifying these settings:
- Adjust sensor thresholds:
- Change
Threshold = 580;for the pulse sensor to see how sensitive it is to detecting a heartbeat. - Modify
geofence_radius = 0.00005;to change how far the device can move before triggering the geofence alert. - Adjust the gas concentration warning level in the display logic (
gasConcentration > X) to make it more or less sensitive.
- Change
- Customize alerts:
- Change the buzzer frequency or duration in
playTone(int frequency, int duration)to make different alerts for different situations, such as it getting louder the further away the astronaut is or, the longer they are outside the geofence. - Add a warning on the OLED display if temperature exceeds a certain value (e.g.,
if (tempC > 30)display a "High Temp!" alert).
- Change the buzzer frequency or duration in
-
Add more data to the OLED display. Currently, the OLED screen shows temperature, gas levels, acceleration, and GPS data. You can modify it to:
- Display heart rate data if above a threshold.
- Add warnings for high gas concentration or extreme acceleration.
- Show a countdown timer for when the next GPS update occurs.
- Adjust sensor thresholds:
Troubleshooting tip: if things aren't working as expected, check your wiring! That is where most issues arise.
Wearability
To make your device wearable, follow these steps:
- Place your device in a box or container.
- This can be cardboard or plastic. But note that whatever box or container you use you'll want to be able to see the OLED display and have easy access to any switches.
- Once the electronics are secured in the container, close it.
- Attach the velcro straps around the container.
- Attach velcro straps to whichever item you wish to wear the device on, such as a sweatshirt.
- Now you're all set to wear your personally made device with pride!
Ask an Expert
Global Goals
The United Nations Sustainable Development Goals (UNSDGs) are a blueprint to achieve a better and more sustainable future for all.
Variations
- Using the MPU6050, detect either an extreme acceleration, indicating that the astronaut fell or experienced an impact, or a lack of movement for an extended period of time, indicating that they're stuck or hurt
- Adjust the alert thresholds for heart rate, temperature, and gas sensors
- Combine LEDs with buzzer alerts for different levels of danger (green for safe, red for emergency)
- You can connect the LEDs to any digital pins on the Arduino. Each LED needs a 220Ω resistor in series to prevent damage:
- LED1 → Pin 3 (with 220Ω resistor)
- LED2 → Pin 4 (with 220Ω resistor)
- LED3 → Pin 5 (with 220Ω resistor).
- You can connect the LEDs to any digital pins on the Arduino. Each LED needs a 220Ω resistor in series to prevent damage:
- Use the ESP8266 Wi-Fi module to send data to ThingSpeak and visualize data remotely
- You will also connect its TX and RX pins to the Arduino's RX and TX pins, respectively. The ESP8266 operates at 3.3V, so connecting it directly to 5V can damage it. Here's the wiring:
- VCC → 3.3V on Arduino (NOT 5V)
- GND → Breadboard negative rail (-)
- TX → RX (Pin 0) on Arduino
- RX → TX (Pin 1) on Arduino
- You will also connect its TX and RX pins to the Arduino's RX and TX pins, respectively. The ESP8266 operates at 3.3V, so connecting it directly to 5V can damage it. Here's the wiring:
- Introduce sleep modes for sensors to save power
- Use a 7.4V Li-ion batter with a compatible charger and a JST plug connector for rechargeable battery options
Careers
If you like this project, you might enjoy exploring these related careers:
Contact Us
Our kits are developed in partnership with Home Science Tools®. If you have purchased a kit for this project, Home Science Tools® is pleased to answer any questions.In your email, please follow these instructions:
- Include your Home Science Tools® order number.
- Please describe how you need help as thoroughly as possible:
Examples
Good Question I'm trying to do Experimental Procedure step #5, "Scrape the insulation from the wire. . ." How do I know when I've scraped enough?
Good Question I'm at Experimental Procedure step #7, "Move the magnet back and forth . . ." and the LED is not lighting up.
Bad Question I don't understand the instructions. Help!
Good Question I am purchasing my materials. Can I substitute a 1N34 diode for the 1N25 diode called for in the material list?
Bad Question Can I use a different part?
Contact Support













