In this brief post I will walk you through the steps I took and challenges I faced in connecting my Raspberry Pi 3 running PiAware (flight tracking software) to my Particle Spark Core IoT device via the MuleSoft Anypoint platform.

Goal:

Light up a LED on the Core whenever a aircraft emitting an ADS-B signal passes overhead. Additionally, I wanted to learn about the Mulesoft tools, hence the over-complication.

Software involved:

Process

Step 1 - Program the Spark Core

This was supposed to be a simple task, however, due to the fact that the Core hadn't been used in over a year quickly I found that I wasn't even able to push the simplest of apps to it. After a few hours of trial and error I was finally able to connect it to my computer, flash it with the following commands, and establish a solid link to the Photon cloud.

photon flash --usb cc3000
photon setup

I then pushed a barely modified version of the Web Enabled LED sample program to it that, instead of on/off, received true/false as parameters to the enable & disable function. The input of true (planeOverhead) would light the diode and false would turn it off.

Step 2 - Configure and Hack the Pi

Installing PiAware is a whole different topic and one that is covered very well by FlightAware. Therefore, I will skip to the part where I figured out two ways to pull the data that the Dump1090-FA module received from the receiver and antenna.

1. TCP via port 30003 - this is a *decoded* stream to which Dump1090-FA writes when aircraft data is received. It includes information like latitude, longitude, identity, speed and altitude.

Example data:

2. JSON file published via Lighttpd so accessible remotely (http://<host>:8080/data/aircraft.json). This file is updated with the current aircraft nearby and is exposed via the bootstrapped HTTP server. It looks like this:

3. Useless in this scenario but cool nonetheless, a web page with detailed information:

In the integration I would attempt to consume both data endpoints with varying levels of success.

Step 3 - Create an Integration Flow in Mule

Easier said than done... at least it is when you're starting from scratch. Anyway, I love integrations, when I was implementing software the part where I got to assist with the nuts and bolts of making two very different systems speak was my favorite part, hence why I wanted to give Mule a spin and see how it makes things easier.

I briefly skimmed a few tutorials and then jumped right in.

And sank.

My first flow (above) failed because of my poor attempt at trying to read from the socket with the TCP connector. Sure, in theory this should work but this connector seemed to be 1) new to the product/lightly documented and 2) geared towards a server role and therefore wanted to accept connections and NOT create them. Couple that with the fact I didn't want to deal with decoding the stream, I moved on after I found the JSON file I mentioned earlier.

Try #2 was marginally better since I switched over to the HTTP component and started my attempt at reading that JSON file. I still had a few major problems though:

The HTTP component wanted to accept connections, not create them.

My payload kept coming back erroneous/unable to be manipulated or tested.