Serial connection for flight computer: Arduino and RPi

Good morning,

After a fair amount of research, I've decided on an approach to creating a flight computer for a scientific ballooning project to run with high school students. (NOTE: While there are Arduino projects out there that talk about a "flight computer" - these are data loggers, not a system that can send commands to the balloon in flight and receive data.)

Requirements:
The system needs to communicate with a scientific ballooning payload (or any remote system) by using a packet radio (APRS) approach over ham radio frequencies. The ground station needs to send emergency commands (such as to initiate an unexpected cutdown) and receive critical data (payload temperature, battery condition, etc..)

Selected approach:
Using the strengths of each system, my approach will be to have the flight computer on the balloon be an Arduino (the Mega, because it has more serial connections) and the base system be a Raspberry Pi running Python.

Testing:
Step 1 will be to connect the Arduino to the RPi through a wired serial connection and get them talking to each other. Step 2 will be to connect each device's serial I/O to a modem (terminal node controller or TNC) to ham radios and confirm they can communicate over the air. Step 3 will be to move the two radios as far apart as possible and confirm communication over a 20 mile line-of-sight distance. Once all three steps are completed, development can begin on the actual flight systems.

Request for input/comments:
I have spent the past 20 years tinkering with a variety of systems and have no problem getting square pegs to fit in round holes. Suggestions and links to resources would be greatly appreciated. Please don't assume that I know much of anything - I certainly won't get bent out of shape if you're sharing something I already know!

Thanks,
-- Markus

I don't know anything about the wireless system you mention but for wired serial communication between a Mega and an Uno the examples in Serial Input Basics will be appropriate. The system in the 3rd example will be the most reliable.

...R

Since you will be using high powered radios and the balloon electronics will be subjected to high altitudes, I would suggest researching ways to reduce EMI and using the Arduino's watchdog timer (on the baloon Mega only).

EMI:

  • Use twisted pair wiring with mesh metal shielding terminated and connected to GND (both balloon and ground station)
  • Use complete metal enclosures for housing the main electronics - especially the Mega on the balloon (at high altitudes, it is easier for certain electromagnetic waves to cause bit flips in memory that can crash your Mega. Such shielding can prevent this from happening. In the case you do get a bit flip and the Arduino crashes, the watchdog timer will recognize the crash and "reboot" the Arduino)

Watchdog:
info

The system needs to communicate with a scientific ballooning payload (or any remote system) by using a packet radio (APRS) approach over ham radio frequencies

Are you a ham then?

MaineWebDad:
The system needs to communicate with a scientific ballooning payload (or any remote system) by using a packet radio (APRS) approach over ham radio frequencies.

Why ?

APRS is low range and low data rate capability in the context of remote control and data transfer, you need a HAM licence too.

I would also forget Python on Pi, its a complete dog. You can write on paper faster. In terms of radio I\O a humble Arduino Pro Mini running at a mere 8Mhz is still around 250 times faster than a 800Mhz Pi.

srnet:
I would also forget Python on Pi, its a complete dog. You can write on paper faster. In terms of radio I\O a humble Arduino Pro Mini running at a mere 8Mhz is still around 250 times faster than a 800Mhz Pi.

While I do not doubt what you're saying, isn't the RPi3 a 1.2GHz? Is it slower because it has an OS to deal with? What about if you did the code in C++ instead of Python, would it still be slower than an 8MHz machine?

Just curious - I'm a beginner in RPis.

Power_Broker:
While I do not doubt what you're saying, isn't the RPi3 a 1.2GHz? Is it slower because it has an OS to deal with? What about if you did the code in C++ instead of Python, would it still be slower than an 8MHz machine?

Just curious - I'm a beginner in RPis.

My Pi was actually 900MHz, sorry for the typo.

No idea why Python is so slow on a Pi, I suspect just a very poor implementation of what is after all an interpreted lanuguage.

What slows down Python on a Pi is the print statement. Remove them and it speeds up considerably. What you do get is Linux steeling time, it used to be in big chunks in the order of seconds on the early versions but it is now down in the mS region. Still enough to destroy anything that requires real time but a lot better than it was.

You can now run Processing on the Pi which is a lot more like C and it has support for the GPIO.

MaineWebDad:
The system needs to communicate with a scientific ballooning payload (or any remote system) by using a packet radio (APRS) approach over ham radio frequencies. The ground station needs to send emergency commands (such as to initiate an unexpected cutdown) and receive critical data (payload temperature, battery condition, etc..)

No need to use APRS, which is an Amateur service not for 'commercial' use.

LoRa modules can be used license excempt @ 10mW in most parts of the world. They provide more than enough range for high altitude baloon tracking, put a modest Yagi on a tripod and you will be able to track a balloon at greater than 500km. Close in you can shift reasonable amounts of data, I have had 14Kbits\sec working at more than 100kM.

Two way remote control is easy enough too. A basic balloon tracker is simple low cost ATMEGA328 powered device or one based on a Pro Mini. Will run for a week or more on AA batteries.

Currently getting "too many responses in 5 mins" error even though I've only made one post today, so here's a quick reply to all the great input received, particularly the questions:

  • Ham Radio
    Yes, I'm a ham radio operator (KB1MSA) though I haven't used it for much lately. I purchased it for a ballooning project I was helping out with about 15 years ago and want to get back to it.

  • Pi and Python
    It was recommended by techs in the field that having some Python experience would be good for my students. Maybe that should be re-evaluated? The Pi doesn't have to be fast - it just has to listen and transmit reliably. My techs in the field are interested in Processing too, so that might be a better way to go? I was thinking the Pi would display a simple GUI with information from the balloon. Clicking on a command button on the screen changes the value of that field in the local text file. The solution assembles a string of all the different values and broadcasts it to the balloon, then receives the incoming string from the balloon. If there's a better way to build the ground station, I'm open to alternatives.

  • Why Ham? Why not something like a LoRa module?
    I would like this project to give my students the feeling they can take a bunch of parts, get their ham radio license, and make something themselves. I've seen some TNC projects that are basically a fist full of capacitors and resistors in a breadboard connected to a microcontroller - that's the kind of experience I'm looking for. From there students can design/modify a circuit design in Eagle CAD, mill the board on a tabletop CNC router I have access to, and solder the components. So I'm ALMOST there! This would be so much easier if I had a veteran C++ engineer, but since I don't have one, I have to become that resource! :wink:

  • Why APRS?
    The concept behind APRS (connectionless data broadcasting) seems to fit the project. I don't need to have the balloon take action in real time - only to be received in a reasonable period of time (3-5 min?) and acted upon. There will also be a separate APRS beacon on board, so it would be good to have the flight computer use similar technology.

  • Why one approach over another?
    The best answer I can give is that I picked this approach based upon what I feel I can absorb for knowledge, what I can get students interested in, and what I can tell my boss are the learning standards I'm covering that count toward graduation. Beyond that, it is my hope that future students will fork the project and may even implement systems using entirely different technologies and languages. But I have to get the ball rolling with what I have, what I can learn, and what I can share with students in understandable ways that capture their interest.

This is great - I hope people will keep contributing to this thread!
Thanks,
-- Markus

The info about LoRa modules is new. I was aware of older modules like this, but only found solutions which had a range of less than a mile. I will probably still go with the ham radio approach, but given the cost and capabilities of LoRa, I'll need to get a couple of these for tinkering. I'll see how that goes!
-- Markus

Ok - did some research on LoRa modules. I definitely want to keep going in this ham radio direction for now, but LoRa is quite interesting and I'll be doing some experiments on this as well.
-- Markus

MaineWebDad:

  • Why Ham? Why not something like a LoRa module?
    I would like this project to give my students the feeling they can take a bunch of parts, get their ham radio license, and make something themselves. I've seen some TNC projects that are basically a fist full of capacitors and resistors in a breadboard connected to a microcontroller - that's the kind of experience I'm looking for. From there students can design/modify a circuit design in Eagle CAD, mill the board on a tabletop CNC router I have access to, and solder the components. So I'm ALMOST there! This would be so much easier if I had a veteran C++ engineer, but since I don't have one, I have to become that resource! :wink:

I have had some experience in that type of project, involving students, $50SAT.

The aims might be very laudible but starting from scratch, with no or limited electronics knowledge, thru to building an airborne TNC\Tracker might appeal to some students, but not very many in my experience.

You would likley get far more interest and involvement if you can keep the complexity and cost very low, LoRa is the way to go here. You can use the same hardaware for other things, remote sensors, trackers, data links all stuff that APRS is not suitable or licensable for.

Attached is all the components needed for a LoRa tracker, this one is going to go on a foil party balloon in the next copule of weeks.

I checked out the $50SAT project. Very interesting - particularly the tape measure antenna!

I'm thinking of changing course slightly. Rather than doing everything from scratch, maybe it would be best to use an existing TNC solution. That way, the Arduino flight computer just needs to talk serially to the TNC. I have a Kenwood D-7 HT radio with a built-in TNC, so may tinker with this approach over the next few weeks as time permits.

Still looking for thoughts and input from folks - please share!

MaineWebDad:
I checked out the $50SAT project. Very interesting - particularly the tape measure antenna!

I have been progressing the LoRaTracker HAB programs, the early LoRa HAB flight (January 2015) and $50SAT used PICAXEs, although the Arduino version of the HAB tracking software has been around since mid 2015.

There are other platforms that use LoRa for HAB tracking costing many $$$$$, but I prefer to adopt the easy build low cost DIY approach, Arduino is ideal here.

The HAB tracking software has just been significantly updated, the remote control is a lot better, the beta versions of this are here;

LoRa HAB Tracker

I dont dissagree much with your 'ready made stuff' approach, its too easy for us oldies to assume that students are interested in the minute detail of how such things work, some will be of course, but not many I suspect.

One approach to consider is a compare and contrast exersize, i.e. for the launch use both and compare the effectivness of a ready made TNC\APRS approach versus LoRa.