Commit 722fbdfc by EduardoChamorro

mods/html5 fabmodules tutorial fix

parent 093f6958
Pipeline #63628 passed with stage
in 5 minutes 28 seconds
......@@ -19,7 +19,7 @@
* Week 2: Computer Aided Design
* [Fab Modules (HTML5) setup_linux](week02_computer_aided_design/
* [MODS setup_linux](week02_computer_aided_design/
* [2D Modeling Tools and Video Tutorials](week02_computer_aided_design/
* [3D Modeling Tools and Video Tutorials](week02_computer_aided_design/
* [Unwrap with Blender](week02_computer_aided_design/
......@@ -41,6 +41,7 @@
* Week 4: Electronics Production
* [MODS](week04_electronic_production/
* [MODS setup_linux](week02_computer_aided_design/
* [FabTinyISP_english](week04_electronic_production/
* [Fab ISP_english](week04_electronic_production/
* [Use an Arduino UNO as an ISP to program your first FabISP](week04_electronic_production/
# HTML5 FabModules setup tutorial
# HTML5 MODS setup tutorial
### This short tutorial shows how to setup the new HTML5-based version of Fab Modules
### This short tutorial shows how to setup the new HTML5-based version of MODS
## Find the modules
- editing
- subgraph copy paste
- nested module graphs
- ui
- collapse nodes
- refactor for skinning
- processes
- three-axis rough and finish cuts
- Cross-Origin Resource Sharing (CORS)
- formats
- HPGL input
- SVG export
- DXF export
- ...
You can find the new modules at the following address
# To install and run mods locally
You need to first install [node.js](
## Pre-requisites
Install the [http-server]( npm package. Including '-g' sets the installs the package gloabally, allowing you to use it as a command line tool:
There are some pre-requisites
<code>npm install http-server -g</code>
* wget (apt-get install wget on a debian / ubuntu system)
Clone the mods repository:
* node.js & npm (download from []( and follow instructions there)
<code>git clone ssh://</code>
* Python
Use the command line to navigate to the root of the mods repository:
* PySerial library. After getting python working, just run
<code>cd mods</code>
sudo pip install pyserial
Start up a server:
## Download instructions
Open a terminal and create a folder where you like the fabmodules to be downloaded.
Open a browser tab and go to <code></code> which is the same as <code>http://localhost:8080</code> to view the server that you just started.
In my case its /opt/fabmodules, and I'm creating it with sudo and I'm changing the ownership for this folder to my user :
Depending on how to need to use mods you can start local servers located in <code>mods/js</code>, for example, if you start from the root of the mods repository:
sudo mkdir /opt/fabmodules
sudo chown -R fiore /opt/fabmodules
<code>cd js</code>
At this point make sure you have wget installed. Start downloading the first file:
<code>node printserver.js</code>
cd /opt/fabmodules
# Mods Connection Debugging
Now make it executable and run it:
set correct serial port permission (do this each time you reboot the machine): <code>chmod a+rwx /dev/ttyUSB0</code>
chmod +x mod_get
start serialserver in the terminal so you can see the logs as it tries to connect. navigate to the mods/js folder in the terminal (probably use <code>cd ~/mods/js</code>) and type: <code>node serialserver.js ::ffff: 1234</code>
If you followed all the instructions correctly you should now have inside /opt/fabmodules a folder named ****.
check serialserver is running with: <code>ps aux | grep node</code>
# Common Issues
You now need to copy it alogn with the mod_server folder to /usr/local/bin, make sure you use sudo if you don't have enough privileges. Also you need to make the mod_serve file executable:
1. **_Help! My SRM-20 will only run a single job and then go dead!_** Chances are you are using printserver.js instead of deviceserver.js to connect to the machine. For now, we need to treat the SRM-20 as a device instead of a printer.
2. **_Argg... why do I need to reset permissions on /dev/usb/lp0 every restart?_** You can use `sudo add_user username lp` and `sudo add_user username lpadmin` to make persistent permissions.
3. **_Why is my web socket connection refused when the addresses are the same?_** This can happen due to a difference between IPV4 and IPV6 addresses. In your start mods server script, try changing to ::ffff: and see if it helps.
sudo cp -R mod_serve mod_server /usr/local/bin
sudo chmod +x /usr/local/bin/mod_serve
We are almost done.
## Start Fab Modules
You now can run the mod_serve, check /usr/local/bin is in your path:
**Forked tutorial:**
mod_serve &
listening for connections from 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
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 = ''
Changing client_address to 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).
### Starting mod_serve every time the machine is switched on
As you might notice you must launch the mod_serve manually every time you want to use Fab Modules.
You can automate this process, assuming you are running a Linux system supporting "Upstart" by creating a service entry for it.
Add a user to the system. I.e. fabmodules
sudo adduser fabmodules
Create (with sudo/root) a new file named /etc/init/fabmodules.conf, and add inside it
# upstart service file at /etc/init/fabmodules.conf
description "HTML5 Fab Modules"
author ""
# When to start the service
start on runlevel [2345]
# When to stop the service
stop on shutdown
# Automatically restart process if crashed
respawn limit 10 5
# drop root proviliges and switch to mymetorapp user
setuid fabmodules
setgid fabmodules
export PATH=/usr/local/bin:/opt/local/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
export NODE_PATH=/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript
# set to home directory of the user Meteor will be running as
export PWD=/home/fabmodules
export HOME=/home/fabmodules
exec /usr/local/bin/mod_serve >> /home/fabmodules/fabmodules.log
end script
You can test / start your service with
sudo service fabmodules start
Stop your service with
sudo service fabmodules stop
If you find any issue go and look into the /home/fabmodules/fabmodules.log file. Be aware the log might grow big in time. So you might replace the >> with single >, to replace the whole file at each startup rather than appending to it.
## Using Fab Modules
You can use the new Fab Modules in different ways:
### Locally from your computer
Just open the index.html in your browser, and you should be going.
### 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 CBA server
Open your browser on the 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.
* * *
**Original tutorial by:**
* Fiore Basile - []( - Last updated 2015-01-26
* MODS CBA GITLAB - [ORIGINAL REPOSITORY]( - Last updated 2019-02-12
......@@ -7,12 +7,12 @@
* [Fab ISP "NEIL"](
* [Fab ISP "NEIL" ATtiny44 - Crystal or Resonator](
Parts Layout (20MHz crystal)
* [Fab ISP "ALI"](
* [Fab ISP "ALI" FabOptimus ATtiny44](
Parts Layout
......@@ -28,7 +28,23 @@
* [Fab ISP key "VALENTIN"](
* [FabISP-ATtiny44 -Big Crystal](
* [Fab Tiny ISP- ATtiny45](
* [TinyStar-ATtiny45](
**Downloadable Electonics libraries**
* [FabIsp Firmware *ATtiny44*](files/
* [FabIsp Firmware *ATtiny45*](files/
* [Fab Eagle Library](files/fab.lbr)
* [Fab Eagle Design Rules](files/fabmodule.dru)
>For downloading the content,(right click - save as)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment