1
0
Fork 0
Use node.js to interact with LLAP devices (example): https://github.com/flabbergast/node-llap
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
flabbergast 7d2156c539 Update README. 9 years ago
modules Add a refresh button for displayed logs. 9 years ago
public Add a refresh button for displayed logs. 9 years ago
views Add a refresh button for displayed logs. 9 years ago
.gitignore Add logging incoming messages to a file via winston. 10 years ago
README.md Update README. 9 years ago
TODO.md Add a basic temp sensor display. 9 years ago
app.js Initial checkin. 10 years ago
llap.sublime-project Initial checkin. 10 years ago
package.json Basic log displaying. 9 years ago

README.md

Sensors base server

A node.js app for collecting and displaying LLAP messages from sensors (a-la Ciseco sensors).

Setup

The basic hardware setup is:

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 uses socket.on(...).
    • The sources for the web page are views/{index.jade,layout.jade}, public/css/style.styl and public/js/index.js. Clicking on buttons (code in index.js) socket.emit's, received messages are socket.on-listened to in socket_client.js, which then updates the page using jquery.
    • All received messages are logged to winston's file backend on receipt (function onDataOverSerial in socket_server.js).

Credits

Originally inspired by Node-LEDS.