Posted on by

One objective of the BLUEsat High-Altitude Ballooning Mission is to acquire data about flight dynamics and atmospheric characteristics. The payload includes an assortment of sensors connected to a Raspberry Pi, which logs the sensor outputs to an SD card to collect the required data during flight.

Assembled High Altitude Balloon Sensor System
Assembled Sensor System

The code was written in Python and the necessary modules had to be installed to interface the code with the sensors, which will be covered here for each sensor. Please refer to our GitHub repository for all our code related to this project.

Getting Started

First, purchase a good-quality SD card from a reputable seller. I prefer to use a 32GB card so there is extra room for future uses, but if you are using it to record your flight with a Pi Camera, then I would recommend a 64GB card due to the storage requirements of the HD video and images.

This tutorial assumes you are going to be using the Raspbian Stretch OS on your SD card. Download the latest version from the Raspberry Pi website here, and extract the image file from within.

Download Etcher from here. Connect your SD card to your computer, select the image file that you extracted above and select the drive as your SD card. Hit “Flash!” and allow it to complete the flashing and validating process. Alternatively, you can use Win32 Disk Imager.

Now insert your SD card into your Pi and power it up.

Before starting work with your Pi, make sure your software is up to date. First connect your Pi to the internet (if your model doesn’t have WIFI, you can use a USB WIFI dongle or ethernet).

Open a terminal window and enter:
sudo get-apt update

sudo get-apt upgrade

Both of these commands may take a while since they download/install files (make sure your internet stays connected).

Next we will install a python module to communicate over I2C.

sudo pip install smbus2

The next command will install I2C tools.

sudo apt-get install i2c-tools

Next enable I2C on the Pi:

sudo raspi-config

Look for I2C under Interfaces, enable and reboot when prompted.

The following command will show you the hexadecimal addresses of all connected I2C devices. This will be useful in later stages after wiring up I2C sensors.

sudo i2cdetect -y 1

Components

I will now detail the setup process for each sensor.

DHT22

The DHT22 is a combined temperature and humidity sensor. This module by DFRobot has all required resistors already attached and a removable plug for easy connection, and will be mounted externally on our payload.

DHT22 Humidity & Temperature Sensor module from DFRobot
DHT22 module from DFRobot

You will need to download the following python class to interface with the sensor, available here. It is also included in our code repository named “DHT22.py” under the DHT22 directory.

The PIGPIO daemon must be running for your scripts to work. Start it by typing the following into a terminal:

sudo pigpiod

BMP280

The BMP280 is a precision barometric pressure sensor with ±1 hPa absolute accuracy. The breakout board offers both I2C and SPI digital communication interfaces.

BMP280 Temprature Sensor Breakout Board
BMP280 breakout board

First install a python library to use the sensor. Download/copy this file to your Pi, available here.

Then open a terminal and navigate to the folder in which the file is saved. Run the following command and wait until install completes:

sudo pip install RPi.bme280-0.1.3.tar.gz

MPU9250

The MPU9250 is a 9-axis motion tracker: Gyroscope + Accelorometer + Compass. We used a GY-91 module, which combines the BMP280 and MPU9250 sensors into a single board.

GY-91 breakout board containing both BMP280 and MPU9250 sensors
GY-91 breakout board containing both BMP280 and MPU9250 sensors

First install the MPU9250 python library. If connected to the internet, run this command:

sudo pip install FaBo9Axis_MPU9250

If the Pi has no internet, download this repository as a ZIP file and copy over to the Pi. Then navigate to the folder it is saved in within a terminal and run:

sudo pip install FaBo9AXIS-MPU9250-Python-master.zip

You can check which python modules are installed by running:
pip list

PT100 RTD Temperature Sensor with MAX31865 Amplifier Board

The PT100 sensor is a platinum “resistance temperature detector” (RTD). A piece of platinum in the probe changes resistance according to the temperature, and has a resistance of 100 ohms at 0 degrees Celsius (hence the name ‘PT100’). This resistance is amplified and converted to a digital signal by the MAX31865 board, which allows SPI connection with the Pi. The probe was mounted outside our enclosure to measure external temperature.

A PT100 connected to a MAX31865 on a bread board
PT100 connected to the MAX31865 board

Refer to the following document for wiring instructions, available here. Make sure you carefully cut the appropriate trace on your board, using a blade or box cutter of some kind, and short the respective pads as instructed by the guide.

Wiring diagram of the MAX31865 connecting to the raspberry pi. Left is MAX31865 right is Raspberry Pi. Wires are: VIN to 5V, GND to GND, CLK to SCLK, SDO to MISO, SDI to MOSI, CS to CEO.
Wiring the MAX31865 to the Raspberry Pi

The original python module to interface with the sensor can be found here, but it won’t work since some code needs to be added/changed. A working version can be found in our repository linked at the start, named “max31865.py” within the MAX31865 directory.

Ensure that your logging script will be in the same folder as this python module to read the digital output of the MAX31865.

Putting it all together

The in-flight power source for our Pi is a 5000mAh USB power bank, and the various boards were arranged onto a Perma-Proto HAT for a neat final assembly.

Sensor boards mounted on the Perma-Proto HAT
Sensor boards mounted on the Perma-Proto HAT

You will also see some bash scripts in our code repository which automate various processes, such as starting all logging scripts together, removing existing CSV files or killing all script processes. You can experiment by creating your own bash scripts that do cool things. You need to give these files permission to execute by using the following command from the command line:

chmod +x filename.sh

Then run it using this:

./filename.sh

Also, it is simple to join multiple CSV files using this command (order of filenames is important as they will be joined in that order):

cat file1.csv file2.csv > combined.csv

Or you can combine all CSV files in the folder using:

cat *.csv > combined.csv

Concluding Remarks

I hope this tutorial has been useful for you. Whilst you may use our code, you are encouraged to develop your own scripts to improve your learning experience. If you intend to perform multiple functions using your on-board computer (e.g. sensor logging, photography/recording), then I recommend using separate hardware to implement these functions for greater reliability in the event of system failure during flight. Furthermore, you may wish to add a DS18B20 digital temperature sensor to measure internal temperature, which was not covered in this tutorial. You may also want to script automated logging upon startup of the pi, but further functionality will be left to the imagination and experimentation of the reader.

For any technical inquiries, you can contact us at: info@bluesat.com.au


Posted on by

A view of the curvature of the earth from our most recent high-altitude balloon mission.

 

Things have changed since the glory days of Yuri Gagarin when we first reached for the stars. Now, it is easier than ever to get involved in a space mission.

The High-Altitude Ballooning project at BLUEsat UNSW brings together passionate students from a wide range of degrees to build, test and launch equipment to altitudes over 30km.

Our most recent mission was on the 5th of August, where we sent our custom-built scientific research payload up 33km to gather data on the atmosphere and capture video of the ascent.

So, you’re probably thinking to yourself, how can I do this from home?

Objectives

Do you want to take stunning pictures of the curvature of the earth? Perhaps take a photo of your teddy bear against the backdrop of space?

Our main objective was to study the atmosphere to gain knowledge for future missions. This involved sensors, an onboard computer, and code to log data. We used a Raspberry Pi for computing, with an accelerometer, gyroscope, magnetometer, barometer, temperature probes and humidity sensor recording data to an SD card.

We also captured video and photos with two cameras mounted on our payload.

Tracking

Without knowing where your payload is during flight, you have just launched a glorified party balloon. We used 3 discrete self-contained systems to track our flight, pictured below.

The SPOT GPS Tracker simply transmits and uploads coordinates to a website, where we can view location updates on a map. An APRS radio device, the yellow box, transmits GPS coordinates over amateur radio bands which are uploaded to an online network. The third device is a short-range radio beacon which plays a continuous tune over radio frequencies, allowing us to pinpoint the landing area.

Balloon Tacking Equipment. Left to Right: SPOT Tracker, ARPS, Radio Beacon
Tracking equipment

Separation

Typically, a mission is ended when the balloon bursts, but if you are feeling fancy, you can build a device that can remotely cut down your payload. We have developed a mechanism that runs a current through a piece of nichrome wire, which is wrapped around the rope connecting the balloon to the payload. An on-board radio receiver decodes a termination signal which we can send from the ground, causing the nichrome to heat up and sever the rope.

Approval

Before you can send anything into the air, you must seek approval from CASA, the Civil Aviation Safety Authority. You will also need to perform predictions of your flight using online prediction software, such as that found at HabHub, which will allow you to visualise the estimated flight path and burst altitude based on weather forecasts. The figure below shows a predicted trajectory for our launch.

Prediction of the stratospheric balloon's flight trajectory from Muswellbrook, NSW using HabHub.
Prediction of flight trajectory from Muswellbrook, NSW

Logistics

You now need to hire a tank of helium and drive all your equipment out to your launch site. Make sure you take a toolbox and spare parts with you for any last minute adjustments.

BLUEsat's high-altitude balloon team preparing for the launch.
Final preparations

The Launch

Once you have inflated the balloon with enough helium to attain the desired lift and attached your payload, you are ready for launch. Perform a final flight prediction, check your on-board systems, turn on your cameras and cross your fingers!

The stratospheric balloon being launched by the BLUEsat team from an oval in Muswellbrook, NSW
It’s time to let go…

 

Watch the promotional video of our launch below:

Watch our student-led group BLUEsat launch a high-altitude balloon! Spectacular footage as it reaches an altitude of 33,000 m…. 3 times higher than a commercial aircraft.

Posted by UNSW Engineering on Wednesday, 23 August 2017

 

 

 

If you would like details on anything you have seen in this article, please contact us at info@bluesat.com.au