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;