The Easiest Arduino High Altitude Balloon Data Logger
by AaronPrice in Circuits > Arduino
48422 Views, 327 Favorites, 0 Comments
The Easiest Arduino High Altitude Balloon Data Logger
Check out our 360 video from space here:
High Altitude balloons are effective tools in conducting experiments and measuring data in the stratosphere. A successful launch can cost less than $200 and give insight and video of how our planet functions.
For hundreds of years, humans believed the Earth to be flat. High altitude weather balloons prove the Earth is in fact round. The idea of high altitude balloons or HABs is to mount a payload on a giant helium balloon. The balloons are then released, flying to heights of 100,000 feet. Once at these altitudes, the balloon pops and uses a parachute to float back to the ground often many miles from where it was first launched. HABs are great vehicles to get footage from the stratosphere, conduct science experiments, and collect data from high elevations.
My high school has an astronomy club which regularly sends up these balloons. We have recovered 12 of our 14 launched balloons. Launches sent cameras, donuts, yeast, and more odd things into space. Yet, we had never gotten any data from sensors. I wanted to change this. When looking at tutorials online for building data collectors I found most of them:
1. Were extremely complicated - involved making custom shields, multiple coding languages, and other stuff I didn't want to deal with
2. Used GPS units not able to record above 60,000 ft. - What's the point of putting sensors up there if they don't work at apogee.
You can purchase HAB trackers online but they'll cost you $150. So, I decided to build my own! This logger gathers latitude, longitude, altitude, wind speeds, time, and satellites in view and logs them onto a microSD card and can be made for under $70.
This Instructable focuses on the data collector only. Another Instructable detailing how to launch a weather balloon will be coming out soon.
Things We Need
Parts
Arduino- I've used Unos and Nanos on this build. Most Arduino boards should work.
Authentic will be about $25 but you can pick up a clone for cheap.
In the comments section users PirateKittyK and ltheoret pointed out that authentic Arduinos are rated to -40 degrees Celsius. While fakes die at about 0 degrees Celsius. Because space is cold, splurging on an authentic is probably a smart idea.
GPS- this one works at the altitude requirements and is pretty cheap and accurate
https://store.uputronics.com/?route=product/produc...
$30
SD card logger- I went with this one cause ya know Sparkfun
https://www.sparkfun.com/products/13712
$15
1k resistors (2) for the rx lines
http://www.ebay.com/itm/like/171673253642?lpid=82&...
75¢
Battery clip, I like the ones that plug into the jack on the uno
https://www.amazon.com/Battery-Power-barrel-connec...
$2.50
Powersource- Space is really cold, so no alkaline batteries. Stick with lithium.
I used a 9v battery
https://www.amazon.com/Odec-9V-Rechargeable-Batter...
$1.20
LED (optional)
http://www.ebay.com/itm/200-pcs-3mm-5mm-LED-Light-...
1¢
Breadboard (optional)
https://www.adafruit.com/product/65
$4
Perf Board (optional)
If you're looking for a professional look.
https://www.amazon.com/dp/B01N3161JP?psc=1
50¢
Various Wires
I'll assume you have these. Some male to male and some male to female
Micro SD Card 8-16 GB are adequate
$5.85
https://www.amazon.com/SanDisk-microSD-High-Capaci...
(optional) Headers, you can use wires instead.
https://www.amazon.com/15Pcs-2-54-Single-11MM-Head...
Total cost: About $65
If you already have everything besides the GPS and DataLogger its only $45!
Tools Needed
Soldering Iron - many components need headers or wires soldered on
Solder
Programs
Arduino IDE
Libraries Used
SoftwareSerial any software serial library should work.
Building the Circuit
You may need to solder headers onto the GPS and Sd card holder you can learn how here:
https://learn.sparkfun.com/tutorials/arduino-shiel...
Arduino - GPS
3.3v --- VCC
GND --- GND
D3 ----- 1k resistor ----- RX
D4 ------ TX
Arduino -- OpenLog
Reset --- GRN
D0 ---- TX
D1 ---- 1k resistor ---- RX
3.3v ----- VCC
GND ---- GND
GND ---- BLK
Optional
Arduino -- LED
D13 ------ + (longer leg)
GND ------ - (shorter leg)
Programming
You can download the libraries from the parts page of this Instructable.
Use this page to learn how to install a library if you are unsure
https://www.arduino.cc/en/Guide/Libraries
The programming for this is pretty easy. Most people use the TinyGPS library for communicating with GPS units but I couldn't get it to parse the characters we were producing. The library was showing we were getting characters but wasn't able to turn them into information we could use. I then took to the Arduino Forum for alternatives or solutions and the NeoGPS library was recommended. I switched to this library and it works flawlessly. My code is based off of the NMEAloc example. This example grabs latitude, longitude, satellites in contact, and wind speed. Satellites in contact is important because it shows which readings are the strongest. The more satellites, the more accurate the reading.
A software serial library is also needed because both the GPS and SD Card work through serial. I used software serial because I already had it installed but others would work just as well if not better.
I added time and altitude readings, put the GPS in flight mode (it will only work to the heights we need if in this setting), and a nice display to the code. The GPS unit gives out a reading about every second. With an average flight time of two hours this would mean we would have more than 7,000 readings to go through.
GPS readings are very fragile and messing with timing will give false readings. This means adding a delay so we get a reading every 30 seconds would ruin our data. To get around this, we take a reading every second but use a variable (i) we only allow every 30th reading to be printed to the serial port / SD card. I took every 30th reading because I wanted to keep a reading every 30 seconds but you can change this to whatever you'd like.
You'll need to change these values to your offset from GST
If you don't know yours you can find it here http://www.timetemperature.com/tzus/gmt_united_sta...
static const int32_t zone_hours = -8L; // PST
static const int32_t zone_minutes = 0L; // usually zero
This line should be changed to how often you want a reading recorded. I set mine for a reading every 30 seconds.
if (i == 30) {
Attached are both versions 1.0 and 2.0 of the code. Version 1.0 is only compatible to 40,000 feet. Version 2.0 will work to 150,000 feet. Version 2.0 also blinks an LED when data is recorded to the microSD card.
Testing
Before we run the program, we need to format the micro SD card to a fat16 or fat32.
I followed this tutorial by GoPro
https://gopro.com/support/articles/sd-card-reforma...
To upload the code, unplug the SD card logger as those pins need to have nothing on them to upload the code. Ensure everything is plugged in right and that you have the right port selected. Once uploaded you can either plug in the SD card logger or leave it disconnected. With the SD card logger disconnected, the data will be displayed on the Serial Monitor. For the first test I like to see every reading so I change if (i == 30) to if (i == 1).
You'll notice it will start by displaying ?. This is because the unit has a cold start time of about 2 minutes. Sometimes it is longer, do not freak out! After about a minute it'll show the time. If you put in the correct time zone this should be correct after the first couple of readings. A short time after, the rest of the data will display. The altitude reading may show 0 but just give it a few seconds and it will be correct as well. Notice the altitude readings change even when the altitude stays the same. This is normal and since we are printing the altitude in centimeters a change of 1000 is only 33 feet.
Grab the latitude and longitude and search and you'll be shocked by the accuracy. I did this for the first time and not only did it drop a pin on my house but it dropped the pin specifically where I was doing the testing in my house. Pretty cool!
Next, change variable i back to 30, upload the code and plug in the SD card logger. Push the SD card into place. You can plug it into either a battery, your computer, or a power supply at this point. Every 30 seconds the blue light on the SD card logger will flash meaning it recorded data. That means it is working. Let it run for a few minutes and then cut the power and then pull out the SD card. Once you plug the SD card into your computer you should notice two files. If you hit the reset button or plugged and unplugged it in there will be more. The first is a file named config.h Do Not Delete this file. Secondly you should find a file named log. Open it up and all of your data should be there. If so, you're almost ready to launch.
If there is no file or nothing on the file, check your wiring connections.
Consider adding glue to the wire connections. The package will experience some major wind so make sure connections are tight.
Launch
If you're using a styrofoam box as your payload, just throw the electronics in. I used a payload where the electronics are exposed so a case was needed. I was 3d printing a box but it wasn't going to finish in time so I put the electronics in a small cardboard box, wrapped the box in hand warmers, and then put all of it in a ziplock bag to make it water proof and retain heat. This was vital, the balloon sat in snow for three days before it was recovered.
Before releasing the balloon:
Plug in the battery - a fresh one
Check to see the data logger blinks a blue light about every 30 seconds - this means the system is working.
You can check out the 360 video here:
Recovery
The balloon landed atop Palomar Mountain. Home to the famous Palomar Observatory. We drove up there and realized the balloon landed 1000 feet away from the Observatory itself! We then realized that that part of the property is off limits to the public. We talked to some workers and they told us we needed special permission from the board to have the balloon recovered. Three days and many emails later the staff at the Observatory recovered the balloon and brought it into a back room of the observatory. They told us we could pick it up whenever. Thank you for recovering the balloon Observatory staff!
Right after we received the email, multiple storms hit Palomar Mountain, closing the roads surrounding it for a week. Finally, when the snow melted, we were able to recover the balloon and bring it back to school. This was the moment of truth. I snuck out of my other classes, as in the time between launch and recovery the semester had ended, and saw the package. One of the teachers told me they had started to take apart the box for the electronics. I walked up to the box and saw a wire disconnected to the Arduino. I was now worried. Had the wire been undone the whole time? Did I have any data? I reached the microSD card, popped it out of the logger and into my computer. I open the file and saw a log. My nerves increased. Did flight mode work? Is there any data? With a group of students and teachers watching, I opened up the file.
It worked! Almost perfectly. It showed latitude/longitude/wind speed/altitude/time/satellites for about 35 minutes. It then showed all but altitude for another half hour before the battery died.
I had just collected data on one of these weather balloons for the first time. So cool!
Analysis
Overall, this was a successful first attempt. The logger was extremely accurate, aligning perfectly with the location readings from the SPOT GPS.
The last altitude reading was at 39,000 feet this was 35 minutes into the flight. This makes sense. Weather balloons typically rise at about 1,000 feet per minute. We used extra helium and had a light package which is most likely the reason our balloon rose at 1,100 feet per minute. I was surprised the balloon rose linearly.
The wind speed data is interesting. It looks like the wind came in gusts. Once we got above 14,000 feet the wind speeds didn't seem to change with altitude. If you look at the raw data, the wind speeds jump up to 70 mph every couple of minutes, the graph is a little deceiving.
When looking at the raw data keep in mind that the higher the number is in the SAT line, the more accurate that data point is.
Downloads
Conclusion
Overall, I would call this a success. Although we lost altitude at 40,000 feet and the battery died before the end of the flight, this was proof of concept. With a few simple switches, I think we could get a full flight documented. For the next flight, I will change two things:
1. I will use a better battery - Maybe a Double AA battery pack, I'm not sure.
2. I made a hole for the GPS to stick out of for better signal - I now realize this probably wasn't needed.
I think encasing the whole unit will keep it warmer resulting in longer battery life.
If you have any questions please leave them in the comments section.
This is my first Instructable
This Instructable is in the Microcontroller contest as well as the Sensors Contest. Please vote if you enjoyed!