I discovered the really cool ISS live stream recently. I thought it would be good to show my son on his raspberry PI and make an alert light/sound when it was over our home see if we could see it.
I looked at making a Google map with their API then discovered Ubidots. An Internet of Things innovation for maker. Not knowing a thing about CURL i followed some of their examples in the docs and thought id document my progress here.
Step 1. Open an account and follow these tutorials here http://ubidots.com/docs/get_started/quickstart/tutorial-collections.html NOTE* I tried and failed using the CURL Windows package install and use Cygwin to execute the commands. This allowed me to get a basic understanding of Ubidots.
Step 2. I then moved on to http://blog.ubidots.com/live-tracking-the-international-space-station where i plan to develop the code to trigger a light or sound when the ISS is nearby our given location. The original code is below and i didn’t really know where to start with it, i emailed Ubidots support who replied super quick that it was a python script that would need to be run locally with Python 2.7 which you can download here
Step 3. Once you have installed Python on your machine (mine was Windows) You have to install an additional ubidots API client package from here. I again used Cygwin as it just seems to work better using this command. If you are copying and pasting the command remember to omit the dollar sign!
$ pi install ubidots==1.6.1
Step 4. Sign up for an account at Ubidots and get your API key found in your profile in the left hand menu. Make a note of this
|ISS Tracker Token||ftL4B1gzPmFzoch08ZaVs4elPYMDym|
Step 5. Open up Cygwin and request a token by using this command. Make a note of it in Notepad* Ive noticed you can request an auth token when viewing your API key in your profile too
curl -XPOST -H "X-Ubidots-ApiKey: fee9a80a51d6523cd41bbec803b9f97850e7673a" http://things.ubidots.com/api/v1.6/auth/token
Step 6. Go to Ubidots and create a new source, call it something like ISS tracker. Then create a variable of that source named Local Distance. Hover over the ‘I’ circle on the top right of the box and make a note of the variable ID 54c9552b76254241a053980e
For control variable – http://translate.ubidots.com/api/postvalue/?token=sbyKW29lNkm1YlM2haxxvEl10EfCUxrF04gw9c1eBiLrq6CGYRAZgqAwRTBn&variable=54ca56747625421b373d7bd3&value=1
Step 7.You now have the crucial info to set up your alert. Replace the api = ApiClient value with your API key. Replace the = api.get_variable with your variable ID above
Change the my_lat = 42.3581 my_long = 71.0636 to your location heres an easy way to find them out http://www.latlong.net/