FormLabs Form 1+ OpenFL API Connection
I had a longshot idea to revive the galvanometer control of a broken FormLabs Form 1+ resin laser 3D printer. It didn't work and galvanometer remains broken. Because the printer also had a broken resin tray tilt motor and other smaller problems, I wasn't trying to get it to print again. What I had in mind was to repurpose the optical core into a laser light show machine.
This was made possible because FormLabs opened up the Form 1/1+ for experimentation after they stopped supporting the hardware. Since they are no longer responsible if anything goes wrong, they freed the hardware for people to mess around with. This consisted of a special build of the PreForm software, which will flash a special (final?) edition of firmware. This firmware is willing to talk to a PC beyond accepting print jobs from PreForm. To make this communication easier, they released a Python library. All of these were posted on a GitHub repository under their "OpenFL" umbrella.
I really appreciate the fact FormLabs did this, exposing an API to control hardware independently of PreForm print jobs make it possible to do things completely outside the realm of printing. One of their examples turn the Z-axis stepper motor into a single-channel MIDI instrument making buzzy electromechanical music. The API also allows control of laser power and galvanometer position, which lead to my idea of turning the printer into a laser light show machine.
But first, I had to get it up and running. The first problem is that, as a seven-year-old Python library, it was written for Python 2 which is now discontinued. To create a backwards compatible Python environment, I used Miniconda to create a Python 2 environment called "openfl"
conda create --name openfl python=2
Following instructions in OpenFL repository I setup and installed Python dependencies. It allowed me to load OpenFL library but I immediately ran into an error.
Python 2.7.18 |Anaconda, Inc.| (default, Apr 23 2020, 17:26:54) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from OpenFL import Printer as P
>>> p = P.Printer()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "OpenFL\Printer.py", line 62, in __init__
self.dev = usb.core.find(idVendor=self.VID, idProduct=self.PID)
File "C:\Users\me\miniconda3\envs\openfl\lib\site-packages\usb\core.py", line 1297, in find
raise NoBackendError('No backend available')
usb.core.NoBackendError: No backend available
>>>
This "No backend available" error came from pyusb
library, complaining about a missing dependency outside of Python: we need a compatible USB driver installed. Solving this error required the following chain of events:
- Read up on PyUSB at https://pyusb.github.io/pyusb/
- Which point me to LibUSB at https://libusb.info/
- Which pointed me to its Wiki for running on Windows at https://github.com/libusb/libusb/wiki/Windows#How_to_use_libusb_on_Windows
- Which recommended the Zadig utility at https://zadig.akeo.ie/
Zadig offered several options for USB drivers, I tried them in the order recommended by LibUSB.
- WinUSB (v6.1.7600.16385): nope, still got "No backend available" error
- libusb-win32 (v1.2.6.0): looks good!
Python 2.7.18 |Anaconda, Inc.| (default, Apr 23 2020, 17:26:54) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from OpenFL import Printer as P
>>> p = P.Printer()
>>> p.state()
<State.MACHINE_READY_TO_PRINT: 3>
>>>
I'm in! Now to poke around and see what I can do with the laser.