Skip to content
Fiore Basile edited this page Feb 21, 2016 · 9 revisions

This short tutorial shows how to setup the new HTML5-based version of Fab Modules

Find the modules

You can find the new modules at the following address

[https://github.com/fabmodules/fabmodules-html5]

Pre-requisites

There are some pre-requisites

  • git (apt-get install git)

  • wget (apt-get install wget on a debian / ubuntu system)

  • node.js & npm (download from nodejs.org and follow instructions there) on ubuntu apt-get install nodejs-legacy npm

  • Python

  • PySerial library. After getting python working, just run

    sudo pip install pyserial

  • Python TKinter sudo apt-get install python-tk

Download instructions

Open a terminal and cd to a folder where you like the fabmodules to be downloaded.

In my case its /home/fiore/. Make sure you can write to the folder if different from your home.

cd /home/fiore
git clone https://github.com/FabModules/fabmodules-html5.git fabmodule

If you followed all the instructions correctly you should now have a fabmodules folder with all the necessary software.

Once in a while remember to git pull inside the folder so you get the latest stable version.

Start Fab Modules Server

You now can run the mod_serve, installing the ws library dependency using npm first.

cd mod_server 
npm install ws           # needed only once 
node mod_server.js
listening for connections from 127.0.0.1 on 12345

You can install mod_serve on all machines where you have machines attached. Then from the Fab Modules interface type in your server/port combination instead of 127.0.0.1:12345.

You can change the host and port inside the mod_server.js file, look at the top the two lines:

var server_port = '12345'
var client_address = '127.0.0.1'

Changing client_address to 0.0.0.0 will make the server listen for connections coming from any machine in the local network (or the whole internet if the machine has a public ip-address, not recommended).

You can also change the port to any greater than 1024 (otherwise you must launch mod_serve with sudo, again not recommended).

Using Fab Modules

You can use the new Fab Modules in different ways:

Locally from a web server

You can run your own webserver on the local folder. Assuming you have Python installed just run inside the folder:

python -m SimpleHTTPServer

The open the page http://localhost:8000

Using the GitHub server

Open your browser on the http://fabmodules.org page and use the hosted version of the modules.

Optional configuration

The file mod_settings contains the ports and speeds used for the modules operation. Make sure they match your actual devices.

You can load your mod_settings using the last menu item appearing when you open the index.html page.

Clone this wiki locally