Skip to content

Moenupa/LaserEngraverDriver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LaserPrinterDriver

Progressive Lab Notes

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.

Communication Protocols

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.

List of Features

  • Connect
  • Preview location (a rectangle region)
  • Move to location (a point)
  • Engrave a simple shape
  • Config settings for engraving
  • Transform shape

Usage

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]

Switch to GRBL open source firmware

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:

  1. Install GRBL firmware
  2. Install Arduino IDE
  3. Download GRBL source code (in C)
  4. 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]

Emulate Driver Traffic

Use Wireshark to capture USB traffic and python lib usbrply to emulate instructions for USB printer. See usbrply pypl page

[Deprecated] Reason:

Capture USB traffic

  1. Capture use pack using Wireshark
  2. Save the instructions into a .pcapng file
  3. Install Python lib usbrply using the following:
    python -m venv env
    source env/Scripts/activate
    pip install usbrply
  4. Reconstruct Python code to emulate the same instructions using usbrply, as the following demonstrates:
    python env/Scripts/usbrply usbcap/my.pcapng > src/replay.py
  5. Complete.

Emulate Traffic

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.