This project aims to control a laser engraver using Python. Target engraver is WAINLUX JL3. The code mimics protocol used by the manufacturer's software written in Java, downloadable from their website.
Laser engraver uses driver CH34X to communicate via a virtual serial port which is physically a USB port. The port is shown as COM7
for windows and /dev/ttyUSB0
for linux. Supported features of the original software are listed below.
- Connect
- Preview location (a rectangle region)
- Move to location (a point)
- Engrave a simple shape
- Config settings for engraving
- Transform shape
Make sure you have Python 3.8+ installed. Then, install the dependencies using the following:
python --version
python -m venv env
source env/Scripts/activate
pip install -r requirements.txt
python src/main.py
[Alternative Approaches]
Manufacturer documentation is available at GRBL User Manual.
Github repos: GRBL, LaserGRBL (GUI app)
This requires that GRBL is installed on the Arduino board, which will replace the original firmware, causing existing software to be unusable. The following steps are expected:
- Install GRBL firmware
- Install Arduino IDE
- Download GRBL source code (in C)
- Write own code to control the laser engraver (may not be Python)
At the same time, https://github.com/arkypita/LaserGRBL is a good GUI application to control the machine.
[Deprecated Approaches]
Use Wireshark to capture USB traffic and python lib usbrply
to emulate instructions for USB printer. See usbrply pypl page
[Deprecated] Reason:
- Capture use pack using Wireshark
- Save the instructions into a
.pcapng
file - Install Python lib
usbrply
using the following:python -m venv env source env/Scripts/activate pip install usbrply
- Reconstruct Python code to emulate the same instructions using
usbrply
, as the following demonstrates:python env/Scripts/usbrply usbcap/my.pcapng > src/replay.py
- Complete.
python src/replay.py
Note that there is a minor error, which due to the missing bulkWrite()
function. Manual fix is required. Refer to this sample for the fix.