b5888e6887 | ||
---|---|---|
modules | ||
public | ||
views | ||
.gitignore | ||
README.md | ||
TODO.md | ||
app.js | ||
package.json |
README.md
Sensors base server
A node.js app for collecting and displaying LLAP messages from sensors (a-la Ciseco sensors).
Hopefully it should not be too hard for you to poke around the sources, figuring out what code does what and how to modify it to one's needs.
Notice
While doing this project was fun, I have moved on to a different solution for the same "problem". The approach taken in this project is "one app to rule them all": the node app monitors the incoming transmissions, processes them, logs the data, takes care of displaying the data over http. I was having hard time making the logging work the way I wanted, and figuring out how to display graphs was a bit daunting. So, all in all, I probably won't work on this anymore.
Setup
The basic hardware setup is:
- a server which runs this app (e.g. a Raspberry Pi with a Slice of Pi+XRF, or a Slice of Radio (appropriately set up); or just a PC/mac with an URF)
- some sensors whose messages are in Ciseco's LLAP format, and are being received on a serial port on the server (e.g. the ones from Ciseco with their default firmware).
The software setup / server side:
- have node installed
- get the app's sources, e.g. clone this git repo:
git clone https://github.com/flabbergast/node-llap
- run
npm install
from the app's source directory - run the app by
npm app.js
- open the website and enjoy
Note that currently the app expects one Ciseco's sensor with a thermistor, in the cyclic sleep/transmit mode. The device name should be TM
. All the other LLAP will be only displayed in the log.
More explanations
Since it's veery unlikely that you'll have the same setup as me, some editing of the sources might be necessary. For this reason, I'm including some explanations for the sources; and list some current limitations:
-
Problems:
- only one serial port on the server: so one can't have wireless sensors together with, say, an Arduino over a USB
- the displayed logs are not being continuously updated, one has to click the 'refresh' button
-
Structure:
- On the server side there is a socket to each client (the main chunk of code for this is in
modules/socket_server.js
); and code to deal with the serial port (modules/serial_node.js
). - The client side is connected to a socket (code is in
public/js/socket_client.js
). - Sockets are implemented via socket.io; for 'transmitting' a message via a socket one uses
socket.emit(...)
; for 'listening' for a message and act upon its receipt one usessocket.on(...)
. - The sources for the web page are
views/{index.jade,layout.jade}
,public/css/style.styl
andpublic/js/index.js
. Clicking on buttons (code inindex.js
)socket.emit
's, received messages aresocket.on
-listened to insocket_client.js
, which then updates the page using jquery. - All received messages are logged to winston's file backend on receipt (function
onDataOverSerial
insocket_server.js
).
- On the server side there is a socket to each client (the main chunk of code for this is in
Changelog
0.1.0
Working code (on my machines). Running elsewhere will likely need some source modifications.
Credits
Originally inspired by Node-LEDS.