Remotely Control Your 3D Printer With JS
Writing a PhoneGap/Framework7 app to control a 3D printer
Framework7 is a Mobile UI framework that can be used to build hybrid apps with PhoneGap. This app is written in PhoneGap (Cordova) using Framework7.
Robo 3D is a company in San Diego which makes 3D printers for the consumer market. This app is designed for their printers, specifically the C2 and R2 models.
The original Robo beta app provided by Robo 3D was written for the iOS platform and works reasonably well. Although some work has been put into porting this to other smartphones, no app has yet been released.
For this reason, I decided to re-write the entire portable application using a platform which is more conducive to cross-platform development, Adobe PhoneGap (Cordova).
There are two paths for serving up the app, depending upon how much pain you're willing to endure.
Build and Publish
The first option would be to create an Adobe ID and to use their online Build platform to generate the code. This will create app versions for the various mobile platforms.
This requires that you first get developer IDs from Apple [$99/year], Google [$25 setup fee] and Microsoft [$19 setup fee] and then to upload your collection of certificates to Adobe's website.
Once done, you may then build these platform-specific versions.
Host Locally and Use Browser
The easier method is to simply install the necessary dependencies and to serve up the app locally. You'd then use your browser on your mobile, for example, to visit this hosted site.
$ npm install -g phonegap@latest $ mkdir ~/sites && cd ~/sites $ git clone https://github.com/OutsourcedGuru/Robo $ cd Robo $ npm install $ npm start
Then, on your mobile phone or your workstation, visit the indicated website in your browser.
For my own printer, I intend to serve up this app with a $10 Raspberry Pi Zero W single board computer inside the bottom of my printer's case (rather than potentially polluting the OctoPrint installation on the main Pi). It will be powered via microUSB cable from the main Pi computer.
The app looks great so far. I've managed to reasonably mimic the original look and feel after the port to PhoneGap/Framework7.
I'm now pulling data by querying the underlying OctoPrint API which is running in the printer's computer.
Here is the latest collection of screenshots from the running app.