Use node.js to interact with LLAP devices (example): https://github.com/flabbergast/node-llap
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
flabbergast b5888e6887 Update README. 7 yıl önce
modules Add simple logging of data to csv. 7 yıl önce
public Fix client-side sensor code separation. 7 yıl önce
views Provide the app's version for rendering. 7 yıl önce
.gitignore Add simple logging of data to csv. 7 yıl önce
README.md Update README. 7 yıl önce
TODO.md Add init calls to sensors; update TODOs. 7 yıl önce
app.js Provide the app's version for rendering. 7 yıl önce
package.json Add simple logging of data to csv. 7 yıl önce

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:

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).

Changelog

0.1.0

Working code (on my machines). Running elsewhere will likely need some source modifications.

Credits

Originally inspired by Node-LEDS.