Tuesday, January 6, 2015

Virtual Audio Streaming

As mentioned in a previous post, I was struggling to use SDR to decode APRS. I needed a way to connect the incoming stream from SDR into an audio decoder. Windows supports a 'virtual audio device' in the sound control panel, but not all sound cards support this feature - mine does not. What to do?

Enter "Virtual Audio Streaming," an app from virtualaudiostreaming.net This app enables you to pick up sound from any application on your Windows system and pipe that audio into another application. It runs as a service, so the controller is in your task tray. When you open it, this is what you see:


On the left, set Virtual Audio Streaming as the default audio device (alternatively, pick VAS as the audio device in your application, such as SDR#). On the right, set it as the default sound recording device (or, alternatively, select it as the sound input device in the target application like Qtmm).

The tool installs easily--as with most low-cost applications, it can be bundled with other apps so pay attention when you're running the installer (if you don't want any other apps installed). Once running, it isn't noticeable at all and seems to have no effect on the host. A quick peek in Task Manager shows it takes on average between 2% and 4% resources:


From here on out, it's a snap to run with. If your source and target apps allow you to pick custom sound devices, you can run Virtual Audio Streaming without impacting any other audio settings (this is handy for me, because I spend up to 75% of my day in online meetings using a variety of conferencing tools). Overall, the install was easy, configuration is a snap, the tool is very flexible and it's had no noticeable negative effect on my computer.

Enjoy!

Thursday, January 1, 2015

APRS Decoding - Windows

I'm setting up to decode APRS on Windows with a simple RTL-SDR USB dongle. Here's what's needed:

Eventually I'd like this to all be self-contained--seems like a great add-on for SDR#. But that's for a later date... My first step is receiving and decoding APRS, but my next step will be to use my HackRF to actually send encoded APRS packets.

I've been fighting Windows and various Linux OS's trying to make this work. In this article, I'm taking a step back and moving slowly back to the point where it's working successfully. My eventual goal is to use a Raspberry PI with a DRA818* radio chip, in a weather-proof box at the base of my antenna mast. But I digress...

If you follow the steps here, you'll get this up and running quickly. I spent the better part of New Year's Day morning on this.

What You'll Need

  1. Install your SDR software of choice
  2. Install the RTLSDR USB driver (the HDSDR site gives some good info on installing the driver)
  3. Grab Qtmm from sourceforge

What to Do

  1. Start your SDR tool
  2. Connect to the RTL-SDR dongle
  3. Tune up to 144.39 (North America) or whatever your APRS frequency is.
You should start to see signal on your waterfall. It will look something like this:


Note that I prefer HDSDR to SDRSharp. That's just me...

Getting Audio into Qtmm

The trick here is to pump the decoded audio out of your SDR tool into the AFSK decoder. For some people, this will be easy because their Windows sound card chip supports "Stereo Mix" in the Sound Recording control panel. My chip does not, so I had to use "Virtual Audio Streaming," a virtual sound card too. I installed it, and set the "Rec. Play" device to the default device in the sound control panel:

Next, I set "Virtual Audio Streaming" as the output to speaker in HDSDR's sound card selection dialog:


Wide vs Narrow

I had some issues capturing the signal early on when I was using SDR#. Wide FM seemed maybe too wide, but narrow wasn't right. I messed with the signal bandwidth till I had something I liked. In HDSDR, I have bandwidth set to 18,205.

Qtmm AFSK Decoder

Next, just launch Qtmm AFSK decoder and select "Rec. Play (Virtual Audio Stream) for input and click the "Decode" (play) button:

You should begin to see packets streaming in!

Tuesday, December 23, 2014

Arduino EEPROM - Power Trip

I've continued to work on the rocket telemetry platform. One of my last issues (beyond frying my Nano by back-feeding power) was that the combination of GPS + IMU + microSD card was simply consuming more power than the little Nano could produce. Right now I'm working on a small instrument package for a model rocket payload, so I really didn't want to go to all the trouble of adding a power regulator and such.

Well, since I fried my nano and missed the launch date anyhow, that gave me some time to noodle over the issue. In reading one of my Arduino books (Exploring Arduino, by Jeremy Blum), I came across a discussion of EEPROMs. That led to a fair amount of research and I ultimately concluded that, for a rocket, using an EEPROM is a great idea!

What is an EEPROM? 

An EEPROM chip is a small non-volatile memory chip. Each Arduino has between 512k and 1024k EEPROM built in, and it's rarely ever used. For less than $5, you can buy an external EEPROM and use it for the same purpose, and the external EEPROMs are generally larger (I bought an 8k RCA chip from Ballard Supply (which just happens to be in my home town). I haven't used the chip yet, but the onboard EEPROM has worked like a charm.

This will work great for a rocket project, where I am gathering minimal telemetry data and the flight is short. For the balloon platform, I'm still planning to use the microSD reader along with a Mega - more memory, more expansion.

What's in a Structure?

With the storage issue solved, at least partly, my next challenge was writing data to the card. The built-in EEPROM.h library is a byte-by-byte read/write tool, and the data I'm storing is variable in length and format so I was stumped by how I could store and retrieve that data. My original thought was to store it as a long string, which is how I planned to do it with the microSD card. The challenge was that the string length would vary as numbers had more or fewer digits. Plus, building strings on Arduino can suck up memory. And along came... the struct. I've never really messed with structs before, but they are a sort of 'uber' datatype, which contains data within. In essences, it is a complex data type which includes datatypes within.

A struct looks something like this:
// Struct for storing a blog of data
struct store_t {
    float gpsLat, gpsLon;
    float gpsSpeed, gpsAlt;
    float imuX, imuY, imuZ;
    float imuPress, imuAlt;
  } storeBlob;

With the EEPROManywhere library from Arduino Playground, I can actually write an entire struct directly into the EEPROM. No mess, no fuss, no pointers or array indeces. Just write and read.

Writing to the EEPROM

With some research in the Adafruit GPS library, I realized every bit of data I'm writing is a float and, since floats have fixed length, my struct is a predictable 36 bytes, every single time. That means I have a predictable length and, therefore, a predictable starting point to read the next struct.

With a struct of 36 bytes, I can write 28 'blobs' to the Arduino's internal EEPROM, and 227 blobs to an 8K EEPROM chip. I anticipate about a 30-second flight, so I could write 7 times per second (if the Arduino could keep up). I intend to write 2 times per second, not much more.

Reading from the EEPROM

The EEPROManything library is dirt-easy to use. To write, you give it a starting location and the object (struct, in my case). To read, give it a starting location and an object to store the result in (again, a struct). So writing looks like this:
EEPROM_writeAnything(0,storeBlob);

And reading looks like this
EEPROM_readAnything(0,storeBlob);

The only challenge in all of this will be to keep track of the starting point, but it's actually straightforward, just have to careful of 0-based indexing.

Test Code

Here is some test code for writing and reading:
#include <EEPROManything.h>
#include <EEPROM.h>


// Struct for storing a blog of data
struct store_t {
    float gpsLat, gpsLon;
    float gpsSpeed, gpsAlt;
    float imuX, imuY, imuZ;
    float imuPress, imuAlt;
  } storeBlob;
  
  
void setup ()
{
  Serial.begin(9600);
  Serial.println ("Creating storeBlob");
  storeBlob.gpsLat = 4026.1162;
  storeBlob.gpsLon = 11202.8095;
  storeBlob.gpsSpeed = 141.2;
  storeBlob.gpsAlt = 1506.80;
  storeBlob.imuX = 13.2;
  storeBlob.imuY = 4.2;
  storeBlob.imuZ = 97.9;
  storeBlob.imuPress = 847.69;
  storeBlob.imuAlt = 1547.39;
  
  // Calculate length
  Serial.print("storeBlob length:" ); Serial.println(sizeof(storeBlob));
  
  // Now write to EEPROM
  Serial.println (EEPROM_writeAnything(0,storeBlob));
}

void loop ()
{
  
}



#include <EEPROManything.h>
#include <EEPROM.h>


// Struct for storing a blog of data
struct store_t {
    float gpsLat, gpsLon;
    float gpsSpeed, gpsAlt;
    float imuX, imuY, imuZ;
    float imuPress, imuAlt;
  } storeBlob;
  
  
void setup ()
{
  Serial.begin(9600);
  Serial.println ("Reading storeBlob");
  
  // Read from EEPROM
  EEPROM_readAnything(0,storeBlob);
  
  // Write to screen
  Serial.print("Lat:.. ");  Serial.println(storeBlob.gpsLat);
  Serial.print("Lon:.. ");  Serial.println(storeBlob.gpsLon);
  Serial.print("Speed: ");  Serial.println(storeBlob.gpsSpeed);
  Serial.print("Alt:.. ");  Serial.println(storeBlob.gpsAlt);
  Serial.print("X:.... ");  Serial.println(storeBlob.imuX);
  Serial.print("Y:.... ");  Serial.println(storeBlob.imuY);
  Serial.print("Z:.... ");  Serial.println(storeBlob.imuZ);
  Serial.print("Press: ");  Serial.println(storeBlob.imuPress);
  Serial.print("Alt:...");  Serial.println(storeBlob.imuAlt);
}

void loop ()
{
  
}

Saturday, November 15, 2014

GAPA Launch Facility

We took our Scout troop to the GAPA launch facility in northwestern Utah. The facility is reached by taking I-80 to exit 81, backtracking about a mile on a frontage road, then turning left. The site is snug up behind "Clean Harbor" which bills themselves as a waste management company.

What is GAPA?

In the late 50's the US Air Force tested surface-to-air missiles known as "Ground to Air Pilot-less Aircraft" build and designed by Boeing. Boeing built the GAPA launch site, which is now a Utah Historic SIte and on the national register of historic places. The site is on Bureau of Land Management land, although we did need special permission to camp there due to the historic status of the site.
Utah Historic Site Sign

Launch Bunker

 The site consists of a small bunker, which has been damaged by vandals (apparently someone exploded a large charge inside, blowing out the door and shattering the windows) and what remains of a launch tower: the pad and a few bolts for the towers.

Launch Pad

Tower Stanchion in Foreground

Panoramic view: there is NOTHING out here

Launching Rockets

We woke this morning to 28 degrees, a skiff of snow, and a stiff wind. We ended up scrubbing the launch but we had a nice trip anyhow!

Just a little snow

Tuesday, November 11, 2014

Ultimate Telemetry Platform

I have been working for the past 4 years, off and on, on building the ultimate telemetry platform for rockets and balloons. I started originally with a set of stackable Arduino shields - GPS, SD card, etc. Over the years my understanding has grown and the technology has shrunk quite a bit, to the point where I've designed what I think to be the ultimate platform.

Ultimate Telemetry Platform

The ultimate platform consists of:
  1. Arduino Mega
  2. Mega proto shield
  3. Adafruit "Ultimate GPS" breakout
  4. Adafruit microSD breakout
  5. Adafruit 10 DOF IMU
  6. 2m amateur "radio on a chip"
  7. 3.3v power supply
I liked the Mega because of the extra size. My vision is that my local Scout troop will start a NOVA team and that the kids will throw additional experiments onto the telemetry platform, and the Mega gives me plenty of pins!

Thanks to my employer, Caliber Security Partners, I was able to stock up on supplies for the project:


Arduino Uno, Mega, and the breakout boards.

My original design focused on ballooning, but I ran into an opportunity to launch the telemetry platform via a rocket. My buddy and amateur radio "Elmer" has a high-power rocket with a payload. Perfect for the Mega!

Here's a shot of the Mega proto shield with the breakout boards:

Mega proto shield with the GPS and IMU. Radio chip and power supply will go in the empty spot on the left.


With the radio chip and power supply, there's not enough acreage for the microSD card, so I put it on the bottom!


This tangle of wires is the 3 sensors on a breadboard, tied to an Uno


Life Is Full of Opportunity

I ran into a number of issues building my platform:
  • My buddy had to back out - no motor, his high power license expired, and he's out of time.
  • The radio and power supply haven't arrived
  • The microSD card draws too much power to use without an external power supply
  • ...
So now I have an opportunity! My launch is scheduled for 11/15, and it's 11/11 today. I have to build a solution practically overnight.

Options

Launch Platform

I have an old Estes "Maxi Force" 3-motor cluster rocket that I can launch with. It wasn't made for payloads, so I'm taking a bit of a risk here but at this point I am going to go for it. The nose cone is just exactly wide enough to fit an Arduino Uno:

It's this, or we launch with a kite (and the kite's not all that exciting, especially since we're launching rockets the boys built as part of Space Exploration merit badge).

Telemetry Package

I have a few options on the telemetry side:
  • Powered Arduino sd shield, with is big and bulky
  • Strip out the GPS and send up the microSD shield and the IMU on an Uno
  • Do the same, but use a PC board and solder on a nano
The next few hours will be telling, as I hook the Nano up to the breadboard to see if it can handle everything. I have a number of 3.3v batteries from various cell phones, so I think I can actually use them to power the microSD card. If the nano idea pans out, I just need to find enough power to bring up the Nano and the sensors.



Sunday, September 21, 2014

Repairs Complete

A day later and the repairs are finished. The tail section isn't perfect, but it should fly without complaints. Much like 2x4's, it appears balsa thicknesses have changed over time, so I had to putty the seem where I replaced the broken leading fin. You can totally see the seam.

If it's less than straight in flight, replacing the tail fins with laser-cut plastic, and assembling with a custom fin jig will be the next step. We will see--this guy launches in less than a month!


Saturday, September 20, 2014

Rocket Repairs

I was hanging on with my Elmer Chuck (WB6YOK) the other day and the conversation turned from radios to radios in balloons. We have been "working on" a balloon project for what, five years now? We started in with Arduino several years ago and, while we haven't launched anything yet, we've got solid plans and a lot of functioning code for various sensors. As we were talking about the balloon project, I mentioned that I am interested in starting a BSA Nova program (BSA's new STEM initiative, to encourage youth to study science, technology, engineering and math). I told him that we are doing space exploration merit badge in Novemeber and mentioned that I would like to launch a rocket at October's Jamboree on the Air campout, to start to generate some interest.

Well, as it always does, the conversation quickly devolved into some wild fantasizing about having a rocket that was large enough to carry the balloon payload, so we could test it. As we were discussing that, Chuck said "Hang on, wait a minute..." and left the room. He returned with an enormous 3-peice rocket (base, payload bay, and nose cone). "This ought to do what you want," he said. Turns out, Chuck is high-powered certified. This is the rocket he certified with--it's powered by a single "H" motor and should go as high as 8,000 feet or more. 

As we talked further, I got more excited about the possibilities. That rocket could carry an Arduino, a Pi with a camera--pretty much anything! Suddenly Chuck left again and returned with this rocket:



An Estes Maxi-Force 3-engine cluster 50" tall rocket. These were a short-lived rocket built by Estes in the early 80's. Chuck said "It's yours if you want to fix the fins." Well, gosh... How difficult could that be? I took it before he could change his mind! 

Two out of three fins needed repair. The first had several cracks lengthwise, and the second had lost its leading edge. Today's project was to swing by Hobby Lobby after my trail run, to grab a few motors and some balsa wood, and then to fix the fins.



These are the cracks on the first fin (above).


And this is the broken leading fin. 

The fins are made of several peices: the main or base fin, a leading fin above it, and some edging which appears to be made of tougher material to withstand the bumps of landing.

My first plan was to just rip all three fins off and replace them with laser cut plastic fins (another buddy has a laser cutter). The more I thought about that, though, the more I realized it was more work than it's worth. As I looked over the fins again, I realized they were totally fixable. I needed to trace one of the leading fins to make a pattern to cut a new one from balsa, and I needed to glue the cracks together on the other. 

So today I dropped by the store and picked up balsa. After a few chores, I started in. First I opened up all the cracks in the fin, as shown below:


Then with a toothpick, I started to slip Gorilla Glue into all of the cracks. It's not as precise as I would like to be, but it worked. Here is the fin, drying, with a little pressure supplied by a couple rubber bands:


Next I traced an intact leading fin, cut some balsa, and dry-fitted a new leading fin. First I had to carve away the remainder of the leading fin--it isn't perfect, the surface of the rocket body was a bit wavy when I finished but the glue will help with that. Balsa is a really forgiving medium, and the dry-fit went quickly.

Knowing that it would be a challenge to have the new leading fin attach at every point and stay aligned, I opted to only glue where it touches the base fin and where it contacts the rocket body nearby. Once it's dried, I will glue up the rest. It's that easy...

I had to laugh--I spent more time thinking up a variety of ways to replace the fins than I actually spent repairing them. In fact, I've spent more time writing up this blog entry! With only an hour's effort, everything is glued except the front of the leading fin.

My next steps are to sand out the excess Gorilla Glue, then using a light putty I will fill in gaps and holes. Once the fins are smooth and straight, I think I'll paint the base again--probably black, just to put my own touch on the rocket.

The Scouts don't know about this rocket, but this is the one we will launch at JOTA, in an effort to pique their interest. I think it'll get their attention!

If I had unlimited time and funds, I would put together a tiny XBee unit, with an XBee 2 transceiver and a GPS. Then I would find a way to slip that into the nose cone so we could stream telemetry while flying the Maxi-Force. But I decided to keep my focus on building a package for the November launch, instead.