SparkFunPhant (community library)


Name Value
Name SparkFunPhant
Version 1.2.0
Installs 5499
License GPL v3
Author Jim Lindblom
Download .tar.gz
All Versions 1.2.0, 1.1.1

A simple library for the Particle Photon that generates Phant posts, gets, deletes and more.

Example Build Testing

Device OS Version:

This table is generated from an automated build. Success only indicates that the code compiled successfully.

Library Read Me

This content is provided by the library maintainer and has not been validated or approved.

SparkFun Phant Particle Library

A Phant library for the Particle Core and Photon.


This is a firmware library SparkFun's Phant data storage/stream service, implemented on

Phant logo

Repository Contents

  • /firmware - Source files for the library (.cpp, .h).
  • /firmware/examples - Example sketches for the library (.cpp). Run these from the Particle IDE.
  • spark.json - General library properties for the Particle library manager.

Example Usage

Create a Phant Stream

Visit to create a Phant stream of your own. You'll be given public and private keys, don't lose them!

If you want to set up Phant on a server of your own, visit

Include & Constructor

Make sure you include "SparkFun-Spark-Phant/SparkFun-Spark-Phant.h":

// Include the Phant library:

#include "SparkFun-Spark-Phant/SparkFun-Spark-Phant.h":

Then create a Phant object, which requires a server, public key and private key:

const char server[] = ""; // Phant destination server const char publicKey[] = "DJjNowwjgxFR9ogvr45Q"; // Phant public key const char privateKey[] = "P4eKwGGek5tJVz9Ar84n"; // Phant private key Phant phant(server, publicKey, privateKey); // Create a Phant object

Adding Fields/Data

Before posting, update every field in the stream using the add([field], [value]) function. The [field] variable will always be a String (or const char array), [value] can be just about any basic data type -- int, byte, long, float, double, String, const char, etc.

For example:

phant.add("myByte", 127); phant.add("myInt", -42); phant.add("myString", "Hello, world"); phant.add("myFloat", 3.1415);


After you've phant.add()'ed, you can call to create a Phant POST string. returns a string, which you can send straight to a print function.

Most of the time, you'll want to send your string straight out of a TCPClient print. For example:

TCPClient client; if (client.connect(server, 80)) // Connect to the server { client.print(; }

After calling all of the field/value parameters are erased. You'll need to make all of your phant.add() calls before calling post again.

License Information

This product is open source!

Please review the file for license information.

If you have any questions or concerns on licensing, please contact

Distributed as-is; no warranty is given.

  • Your friends at SparkFun.

Browse Library Files