Dispatch data from devices to the web. This project is able to capture information from RS232 and distribute it on a webpage
Have gcc installed (C/C++ compiler) On Mac OSX, this means you must have XCode install (available for free from the appstore) and start it once to accept the licence !
Start your server.
npm installnode server.js
Go to http://[ip address]:[port]/ to configure your application. This will load an admin view where you can see and edit all your configurations. Edit and save the "appconfig" window and click "Reload configuration". This will relaunch the dispatcher with the new settings.
Go to http://[ip address]:[port]/. Make sure you have a valid configuration loaded. Click on "Nav views" in the header. Then browse the available views and double-click any you would like to load. The default available views are:
You can also create your own views and save them easily.
server.config.json contains all the server configuration option, like ip address and port. By default, the ip address is automatically detected and the port used is 80.
For advanced users, you can edit the server configuration.
vim server.config.json # Edit
For changes to be effective you must relaunch the server.
When you start the program and you specify the argument
--config zigbee the system will look for a file named
You may create any new file in this
./configs folder. For example you could create
bioreactor.json and then start the program with
node server.js --config bioreactor
There are two places where to define configuration files.
configs/myconfig.json. Here you define the boards that are physically connected to the computer via a serial board, and the list and type of devices associated to that board
The configuration contains the list of boards that the dispatcher should be looking for. The basic structure for the configuration file is:
Each element in the array represents a board that is physically connected (via a serial port) to the machine that is running the dispatcher (here the raspberry pi). If there is only one board connected, then you don’t have to use an array:
The best way to connect several boards is to define one board per file and to specify several configuration files when launching the dispatcher. A board has several parameters:
baudrate: the serial connection’s data rate. For a zigbee hub from Shuncom the speed should be 38400. When connecting directly with an Arduino it should be 9600.
port: the serial connection’s port. For a zigbee hub it could be on linux:
/dev/ttyUSB0 or on macosx:
/dev/tty.SLAB_USBtoUART. If connected directly on the computer is could be on macosx
The port can be a regular expression: (usefull because names can change when replugged)
%followed by a letter, for example
$AThis is important for zigbee devices since commands must be prefixed. Leave empty if it’s not a zigbee device
Device configuration files are on separate files and correspond to a type in the main configuration file. So if you have a device in the main config file with the type “abc”, the loading procedure will look for the file devices/abc.json. This system enables to have several devices with the same parameters without duplicating them in the config file. (will be useful for solar decathlon) Here is the structure of a device configuration file:
data to the database. For a non-multilog device, a refresh will put the latest parameter values in cache.
Each board can have several devices. If the board has zigbee, then you can have several devices defined.
Restart your server automatically everytime you save (VERY useful when developping)
sudo npm install -g nodemonnodemon server.js
Indicate for what files you want to see debug messages separated by commas
DEBUG=cache,SerialQueueManager,parser,database,PromiseWrapper nodemon server.js --config zigbee
You can also debug with all the debug informations
DEBUG=* nodemon server.js --config zigbee
sudo diskutil unmount /dev/disk3s1
sudo dd bs=1m if=2014-01-07-wheezy-raspbian.img of=/dev/rdiskXXX
vi /etc/network/interfacesauto eth0iface eth0 inet staticaddress 192.168.2.1netmask 255.255.255.0gateway 18.104.22.168/etc/init.d/networking restart
sudo bashapt-get updateapt-get install dnsutilsapt-get install apt-fileapt-file update```## Install node JS```cd /usr/local/srcwget ""tar -xzvf "node*tar.gz"mkdir -p /usr/local/nodemv "node-*pi" /usr/local/nodeln -s /usr/local/node/node*pi /usr/local/node/latestln -s /usr/local/node/latest/bin/node /usr/local/bin/nodeln -s /usr/local/node/latest/bin/npm /usr/local/bin/npm```## Install dispatcher```cd /usr/local/nodegit clone ""cd dispatchernpm install```## Install monitoring```apt-get install monit```Known issues===========* Getting an error when saving file in the nav view: it could be that what you are trying to save is too large. Open the server configuration file ```server.config.json``` and edit the ```bodyLimit``` option. Increase it.