MODS Implementation for IoT Lab¶
The goal is o create a unified Print and CNC platform for IoT Lab. Preferrably we want all machines networked and spoken to in a unified way mixing MODS and native/direct connection.
Why?¶
Having 8 Fab Academy students causes major queues for PCB printing etc. so networked machines would give us better utilization of them. 3D Printing of items of decent size take over 3 hours so remotely monitoring from outside of lab would be desirable.
Inspiration was this video where user just selects printer, uploads STL or NC file and processes from there in standerdized envorinment. https://www.youtube.com/watch?v=36cwDwuATLc
Specific objectives:
A. Setup MOD for Roland Modela mdx-20, Stepcraft CNC’s and potentially all other devices in our LAB
B. Integrate/coexist MODS with other specialized tooling - Octoprint for 3D printers & Laser machines - CNC.JS for CNC devices
C. Setup a Respberry PI 2 or 3 on each of our Machines to enable linkup with the FabModules and networking. Make each machine also WifiAP for direct access.
D. Where possible we will add “our devices” functionality to the FabModules system for unknow devices (like our stepcrafts that are now operating under their own propriatary sofwtares)
Progress (so far)¶
Installing Raspberry Pi¶
Requirement: - Raspbian, at least Jessie or Switch - Setup HostApd & DNSMasqWiFi AP to enable direct connection to the device (via device Wifi LAN) - LAN connection to the internal IoT Lab network (wired or wireless optional) (- TO DO: Authentication syndication setup for controlling acces to machines per member based on management system or training/skill level)
-
Installed NVM
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash nvm ls-remote (shows all available versions)
-
Nodejs up to par version 8.11.1
nvm install 8.11.1
- Install Python¶
-
Start your apps using Forever or PM2 to run at boot and keep running apps as soon as RPI powered up
-
Nice to have: Serve-up/Connect multiple printers/CNC machines to single host/server?
Installing Fab Mods:¶
Following Wiki instrictions
install required/essentials¶
sudo su
apt-get install python-tk
pip install pyserial
npm install http-server -g
cd /home/pi
git clone https://github.com/FabModules/fabmodules-html5.git fabmodules
cd fabmodules
npm install
npm start
npm start should give you:
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 hostto 0.0.0.0 and port to what you desire inside the mod_server.js file, look at the top the two lines:
var server_port = '12345'
var client_address = '0.0.0.0'
ERROR OCURRED: npm ERR! fabmodules-html5@1.0.0 start: PATH=./mod_server/:$PATH node ./mod_server/mod_server.js npm ERR! Exit status 1
fix this problem by editing package.json
“dependencies”: { “mime”: “^1.3.6”, to “mime”: “1.3.6”,
Remove the old files and reinstall
rm -r node_modules/mime npm install mime@1.3.6
Connect Roland Modela MDX-20 to FabMods¶
- Serup Serial comm
- Persist TTY’s across reboots
Instruction on using MDX via MODS Clone the MODS repository (requires password) download zip locally works fine Upload it manually to Rpi host
Note: Instructions for copying/downloading files with SSH: #copy from local machine to remote machine scp localfile user@host:/path/to/whereyouwant/thefile or #copy from remote machine to local machine scp user@host:/path/to/remotefile localfile
Making USB-Serial RS45 connection to Modela¶
First we had to make the cable from USB -> RS232 (9pin) -> RS48 (25pin) https://www.instructables.com/id/How-to-make-a-MODELA-serial-cable/
Run the serial server?? To be determined
Install OctoPi¶
Objective Installing Octoprint and connect MDX-20 via unified UI leaving Mods connection undisturbed (!!manage how to lock ports in use) Install WiFiAP via OctoPrint (since it holds Authentication props anyway)
Install WiFiAP on OctoPi https://medium.com/@kennethjiang/painless-wi-fi-for-octoprint-4e6b68005400
Had to fix RTL Driver issue for Hostapd https://jenssegers.com/43/Realtek-RTL8188-based-access-point-on-Raspberry-Pi
Steps - Manually install Octoprint https://community.octoprint.org/t/setting-up-octoprint-on-a-raspberry-pi-running-raspbian/2337 Includes: HAProxy for reverse proxy MJpegStreamer (install https://github.com/jacksonliam/mjpg-streamer) Cura 3D printer Slicer for multi-purpose use of this installation ()