SparkFun Forums 

Where electronics enthusiasts find answers.

Everything pertaining to the data.sparkfun.com service, the phant project which powers it, and user projects which talk to the service.
By Stuart
#179616
Hi Dan,

I think I've successfully launched Phant on my own AWS instance but as yet I haven't been able to call it properly. I think I need the full URL of the Phant service, where it's running, but don't know what that is.

How far have you got?

Stuart
By agilb
#182752
So far I think I am the same. I have launched Phant, but am unable to send data to it. I have the same thing going to the Sparkfun Phant and it works just fine. The only difference I can see is the URL and the keys. I will keep trying, but somebody let me know if they find a solution.
By agilb
#182831
New bit of data. I have been running an Electric Imp but have been puzzled as to why other devices, like my laptop can log to the local instance of Phant, but the Imp can not. I thought since the Imp is speaking over the same network as the phant, it can all stay local and is fine. I assume the problem is I don't have a URL that can be accessed outside of this network, so after the data is transferred and processed on the Imp cloud, data can't make it back in. I will try to process data before it gets there, but my hopes aren't high. If anybody as help on this, much thanks in advance.
By bdevlin
#184892
No luck here either. Installed nodejs and "npm install -g phant"... I can telnet to 8081 and run commands but http to 8080 does nothing, just blank screen. I can 'create' a stream and get keys for it over the telnet client, but I don;t seem to be able to post data via http as in the docs using the keys provided by the 'create' function. So cool. yet so frustrating. Maybe I'll just use postgres for my project... oh well.
User avatar
By distro inferno
#191611
I also want to ask anyone who successfully got Phant running on a local server how much speedup they notice in data throughput. Right now I'm trying to get an ESP8266 Thing Dev to post lots of data to Phant, but I need much higher throughput than I'm getting using data.sparkfun.com. I'll be taking 150Hz measurements on 4 channels so I need to upload (150*4)*(4 bytes per integer) = 2400 B/s. The values come in out-of-order and some get dropped.

If I can run Phant on a server on my own home network hopefully this would let me get the data throughput I need while still using the nice Phant demo code. I want to do this because trying to craft TCP or UDP packets with the data and send it from the ESP8266 to a device running $netcat -l has not worked. (I think it needs some kind of application layer rather than trying to clumsily push raw packets).
User avatar
By distro inferno
#191613
bdevlin wrote:No luck here either. Installed nodejs and "npm install -g phant"... I can telnet to 8081 and run commands but http to 8080 does nothing, just blank screen. I can 'create' a stream and get keys for it over the telnet client, but I don;t seem to be able to post data via http as in the docs using the keys provided by the 'create' function. So cool. yet so frustrating. Maybe I'll just use postgres for my project... oh well.
I'm having this experience too.

I am pretty impressed that I was able to install it on an Intel Edison with no issues at all. Telnet works, cute elephant ASCII, phant server does open port 8080 and 8081 as advertised, but that's it- nothing seems to work on the 8080 side of things.

Also should I be worried that the git repo, which was last updated Nov 2015, has an icon that says "build|failing"? Doesn't sound good.
By gsolar
#195562
I’ve got phant running on an Arduino Yun.

I have a scale under a bee hive out in the yard driven by an ESP8266 Thing Dev and a couple of C batteries. It posts to data.sparkfun.com just fine except that this site often goes down for hours at a time so I wanted a more reliable place to upload the data. I have several Yuns on my local net that are on all the time anyway and may as well log the data there.

1) Get the latest OS. First I tried this procedure
https://gist.github.com/cvarta/894c5d40bf7391c97853
but this version of opkg accesses an out-of-date version of nodejs. This procedure
https://www.arduino.cc/en/Tutorial/YunSysupgrade
seems to give you the same OS but now opkg accesses a newer version of nodejs. Go figure.

2) The Yun doesn’t have enough native memory to install nodejs so you have to create root space on the SD card. This is done using the ExpandingYunDiskSpace sketch. I found two versions of this sketch, one older by a few months and which doesn’t work. Use the newer one. Reboot and type “df” and you should see that rootfs has a ton of room on it. Here is a “regular” Yun, which few MB on rootfs and a bunch of room on sda1. (Sorry about the typesetting- copy/paste isn't handling tabs very well.)

root@Well:~# df
Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                    5952      1160   4792  19% /
/dev/root                 8704      8704  0 100% /rom
tmpfs                    30728       104     30624   0% /tmp
tmpfs                      512         0       512   0% /dev
/dev/mtdblock3        5952      1160  4792  19% /overlay
overlayfs:/overlay   5952      1160  4792  19% /
/dev/sda1              3862528     37312 3825216   1% /mnt/sda1

Here is a Yun reconfigured as above. It has way more room in rootfs, which is the only reason there’s enough room to install nodejs.

root@SPO2:~# df
Filesystem 1K-blocks  Used Available Use% Mounted on
rootfs   1321980   150484  1105244 12% /
/dev/root 7680 7680 0 100% /rom
tmpfs         30560 136  30424   0% /tmp
tmpfs     512 0 512   0% /dev
/dev/sda3 1321980    150484   1105244  12% /overlay
overlayfs:/overlay 1321980  150484  1105244  12% /
/dev/sda1    12275984 24 12275960   0% /mnt/sda1

3) Now install node and phant.

opkg update
opkg install node
opkg install node-ws
opkg install node-serialport

npm -g install phant

4) If you telnet into the Yun you can set up a phant stream just like you do on data.sparkfun.com

[Johns-MacPro:~] john% telnet spo2.local 8081
Trying 10.0.1.7...
Connected to spo2.local.
Escape character is '^]'.
            .-.._
      __  /`     '.
   .-'  `/   (   a \
  /      (    \,_   \
 /|       '---` |\ =|
` \    /__.-/  /  | |
   |  / / \ \  \   \_\  jgs
   |__|_|  |_|__\
  welcome to phant.

Type 'help' for a list of available commands

phant> help

list       list public streams
create     create a new stream
delete     remove a stream
help       display this dialog
quit       close the connection

If you need help getting started, visit http://phant.io/docs.

phant> create
Enter a title> Hive
Enter a description> hive weight
Enter fields (comma separated)> upTime,temp,Vbat,weight
Enter tags (comma separated)> 

Stream created!
PUBLIC KEY: aK…..Pd6a
PRIVATE KEY:  Pn5…..QqzE
DELETE KEY:  lBb……ZNk

If you need help getting started, visit http://phant.io/docs.

phant> 

The ESP8266 board driving the beehive logs to spo2.local just fine. Make sure your ESP8266 has
const int httpPort = 8080;
By gsolar
#195572
agilb wrote:So far I think I am the same. I have launched Phant, but am unable to send data to it. I have the same thing going to the Sparkfun Phant and it works just fine. The only difference I can see is the URL and the keys. I will keep trying, but somebody let me know if they find a solution.
What is httpPort set at in your sketch? I've got phant running on a Yun. The ESP8266 that is collecting data used to send to data.sparkfun.com with httpPort = 80 but I had to change this to httpPort = 8080 to send to the Yun.
By CaptAndy
#195692
I have the phant server running on a Raspberry Pi Zero W with the DietPi operating system.

It took a while to get it working as the latest version of Node Js was crashing when trying to start up the phant server.
To get it working I had to modify a node js file, validator.js .

I believe the problem is to do with a missing object property.

Have a look at this link as it explains what is causing the crash to occur:

https://github.com/sparkfun/phant/issues/200

The modification to validator.js worked for me and I can continue to use the latest Node Js. I believe that reverting to an earlier version of Nods Js may also fix the issue but have not tried this.

I should think that this issue will affect most people trying to get the phant server up and running on their own platform.