This tutorial will help you get phant up and running on a Beaglebone Black Rev C.

Table of Contents


The wish list below containing the list of hardware used in this tutorial.

Getting Started

Connecting the BeagleBone Black to your local network is fairly straightforward. You will need to provide it with power and connect it to your router with a ethernet cable.

Connecting via SSH

Once you have the power and ethernet cables connected, you can connect to your BeagleBone from a computer on the same network via SSH. If you are using Mac OSX or a Linux Distro, then you should already have a SSH client installed. If you are running Windows, then your best bet is to install the PuTTY SSH client.

To connect to your BeagleBone, you need to run ssh [email protected] from a terminal.

$ ssh [email protected]
 The authenticity of host 'beaglebone.local (' cannot be established.
 RSA key fingerprint is 19:f8:35:4a:fe:f3:fd:d2:46:3f:ed:d8:6a:05:e1:16.
 Are you sure you want to continue connecting (yes/no)? yes
 Warning: Permanently added 'beaglebone.local' (RSA) to the list of known hosts.
 Debian GNU/Linux 7 BeagleBone Debian Image 2014-04-23
 Last login: Thu Jul  3 14:34:16 2014 from todd.local
 [email protected]:~#

If you see the prompt [email protected]:~#, then you have connected successfully.

Stopping Apache

The Beaglebone Black Rev C comes with the Debian Wheezy Linux distribution pre-installed. By default, there is an instance of the Apache HTTP Server running on the ports phant uses, so we need to stop Apache.

You can stop Apache by running service apache2 stop from the SSH prompt.

[email protected]:~# service apache2 stop
 [ ok ] Stopping apache2 (via systemctl): apache2.service.

Installing Phant

Phant is a node.js application that is distributed via npm. Luckily, both node.js and npm are part of the default BeagleBone Black install, so we can use npm to install the required packages.

Install the phant package via npm.

[email protected]:~# npm install -g phant
 npm http GET
 npm http 304

Starting Phant

Now that you have the required packages installed, you can start the phant server by running phant from the SSH prompt.

[email protected]:~# phant
 phant http server running on port 8080
 phant telnet server running on port 8081

You can now browse to http://beaglebone.local:8080/, and you should see phant is ready and listening for input. in your web browser.

Creating a Test Stream

By default, the web stream management user interface (like the one uses) is disabled. It is not included by default because it can become a resource hog on boards like the BeagleBone Black.

Instead, data stream management can all be done via a telnet client. If you are using Mac OSX or a Linux Distro, then you should already have a telnet client installed. If you are running Windows, then you can use PuTTY as your telnet client. You can connect to your phant server over telnet by running telnet beaglebone.local 8081.

$ telnet beaglebone.local 8081
 Connected to beaglebone.local.
 Escape character is '^]'.
      __  /`     '.
   .-'  `/   (   a \
  /      (    \,_   \
 /|       '---` |\ =|
 ` \    /__.-/  /  | |
   |  / / \ \  \   \_\  jgs
   |__|_|  |_|__\
  welcome to phant.
 Type 'help' for a list of available commands

If you see a phant> prompt, then you have successfully connected to the telnet stream manager. You can now type create and follow the prompts to create your first data stream.

phant> create
 Enter a title> Test
 Enter a description> Testing BeagleBone Black.
 Enter fields (comma separated)> test
 Enter tags (comma separated)> test
 Stream created!
 PUBLIC KEY: aAYVpdNaOeu6rQ80Ogeau2vxDKq
 DELETE KEY:  lAEwmPboWZuBqa10LQ9wcyz9qn8
 If you need help getting started, visit
 phant> quit
 Connection closed by foreign host.

After responding to all of the prompts, you should be given a unique PUBLIC KEY, PRIVATE KEY, and DELETE KEY. Write these down. You will not be able to retrieve them.

Logging Data To Your Stream

Now that you have your keys, you can try logging to your stream by pasting the following URL into your web browser. Replace the PUBLIC_KEY and PRIVATE_KEY with the keys given to you during the stream creation process.


If everything worked, you should see 1 success. If something went wrong, you would see a 0 followed by an error message.

Retrieving Data From Your Stream

Once you have successfully logged data, you can make a HTTP request to retrieve it. Data is currently available in CSV and JSON formats. You can retrieve to your stream data by pasting the following URL into your web browser. Replace the PUBLIC_KEY with the key given to you during the stream creation process.

Example CSV output


Example JSON output


Keeping Phant Running

You may have noticed that phant will stop running if you end your SSH connection to the BeagleBone. You can get around this by installing the forever npm module.

[email protected]:~# npm install -g forever
 npm http GET
 npm http 304

You can now start phant using forever.

[email protected]:~# forever start /usr/local/bin/phant
 warn:    --minUptime not set. Defaulting to: 1000ms
 warn:    --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
 info:    Forever processing file: /usr/local/bin/phant

Phant will now continue running after disconnecting from the SSH session.

Final Thoughts

You can read more about how to interact with phant by visiting If you spot any errors, or have any issues, let us know in the comment section below.