Persist variables online with Spark Core

I am working on a project where a Spark Core samples a GPS receiver. The thing is to live indoor and is quite static, so even if I won’t always be able to receive the signal, that’s still fine. My user can place the thing near a window for a while, until the GPS signal is received, then I can just store the last result and use that, since I can assume that it won’t significantly move. However, having to place the thing near a window every time it boots up can be quite a pain, so I was thinking about storing the previous value somewhere on the cloud, and then fetching it when booting.

Is there an API for doing such a thing? Something to store a variable and then fetch it next time the Spark boots?


@matteo_monti, there is no cloud persistence for data right now. However, you could store the position in the Core’s eeprom using the EEPROM functions. If you store a checksum along with the data you can make sure you have valid data stored on bootup.


Places like Thingspeak have API’s that let you retrieve the last X number of measurements. So you could possibly read the last data point if it is stored that way.

Personally I think that implementing GPS on a Photon is a waste of time, since it is depending on a local and known WiFi connection. Unless you are only doing offline datalogging for later download. I guess that you could bundle a Cellular router in the package for improved connectivity…

I thought about including GPS in one of my projects until I realized that a $50 no-commitment cellphone and a couple of Apps made more sense. You get full offline mapping, local storage, a big touchscreen, interactive WiFi, GPS, camera, compass, etc. My emergency kit has a Nokia Lumia 520 and a solar charger just for GPS and mapping purposes. So writing an app to do whatever it is that you want to do with the Photon might make more sense.

It will be very interesting when the Photon firmware comes out that allows you to make your Photon an AP that you can connect to with your cellphone, then all kinds of practical hardware will become possible.

That sounds like a good idea. Thanks for the hint!