Software apps and online services

Hand tools and fabrication machines

Soldering iron (generic)

3D Printer (generic)

Story

Intro

During Halloween my girls were unicorns (and my boys, ninjas). A few weeks before the holiday my oldest daughter jumped online to Google "rainbow unicorn horn". She found a killer tutorial from Adafruit outlining everything you needed to get a rainbow unicorn horn (check it out). I wanted to expand the project by adding GPS tracking sent to the cloud through Hologram's cellular network for IoT.

Why add GPS? As my kids get older, they want to try things without adult supervision. As a parent, that is one of the scariest thoughts. Being able to track my kids helps my wife and I transition into less-crazy parents.

What follows is the not-so-easy story on how we accomplished our Unicorn Finder.

Next, we ordered the Adafruit Neopixel sticks and wired them up as per the tutorial. Once back in the 'burbs, we hit up Hobby Lobby for headband material, followed by mom sowing it all together.

1 / 3 • The finished headband.

The Neopixel wiring and unicorn horn were the only parts taken from the Adafruit tutorial. We decided to use an Arduino UNO as the base to build the rest of the project.

Arduino UNO + GSM Shield

A couple weeks before this project, the good folks at Arduino sent me a few GSM Shields to try on Hologram's cellular network. I decided to grab some UNOs along with those GSM Shields and go at it. The integration worked great and you can see the final code here. Below is a quick example using TCP.

Note: When using a Hologram SIM, you can send data directly to any cloud provider (no vendor lock) using any protocol that provider supports. In this example, I chose to send data to Hologram's data router because it is quick, secure and conserves data.

Adding Adafruit Ultimate GPS Breakout

Here is where things got hairy. I ran into a conflict between Arduino's GSM library and Adafruit's GPS library. The issue resulted from the GSM library's implementation of software serial. Eventually after an embarrassing amount of time, I found this forum post providing an alternative GPS library using the wonderful AltSoftSerial library. I included the alt GPS zip file in this project's code section.

Unfortunately, that was not the only issue I ran into. My Arduino UNO was running out of dynamic memory (RAM). You'll see in my sketch where I check and print available RAM. I kept those serial prints just in case you modify it. If things start acting weird, it is likely because you have no RAM left.

Eventually, after some code reorganization and wrapping all strings in F(), I was able to free up just enough memory (around 85% used). Sigh of relief.

1 / 3 • Hardware all done :)

Cloud Data Routing to Losant Dashboard

We have rainbow lights; we have GPS location; we have cellular connectivity. Now we need a place to easily store, manipulate and display our IoT data. There are a number of great providers who offer these services. For this project I chose Losant.com - go ahead and create a free account.

Let's setup a connection from Hologram's data router to Losant's platform. We first will create a new Losant application. This application will consume data through a webhook, set the state of a virtual device then display our location on a dashboard map. Last, we create a new Hologram data route to send all new GPS coordinates to the Losant webhook.

3b. Losant: The Webhook node will automatically map to the only available webhook you created in step 1. In the Device State node will need both the device and state values configured like the image below.

Your device name will be different but the state settings need to match

4. Losant: Create a Dashboard and add a GPS history block. You should have only one option in all the drop down inputs. You should now have an empty block waiting for it's first data.

5. Hologram: You should have a Hologram international SIM and a Hologram account. Create a new data route, select Advanced Webhook Builder and copy the setting from the image below (your Losant/Structure webhook ID will be different).

Conclusion

You should now see new coordinates update the Losant dashboard map. Since we are using the integrated GPS antenna, it may take up to 30 minutes for the satellites to connect. Enjoy!