Neje Laser Engraver on Linux

I bought a Neje DK-8-KZ laser engraver (Gearbest). It’s not bad at all but does not have any Linux Software. Luckily the communication protocol is pretty basic so understanding it was pretty easy.

Neje Printer

The working principle is pretty easy: The machines accept a 512×512 bit matrix in form of a 1 bit depth BMP.

I made a linux bash script to send the matrix to the Neje DK-8-KZ laser engraver (Link to github in the bottom). The image sent must be 512×512 1 bit depth andò vertically flipped. The image mono.bmp  is an example and, any image should be of the same dimension.

 

Best way to use is with gimp. Create a 512×512 image, flip it vertically then save as BMP. Then open it and do Image -> Mode -> Indexed -> 1 bit depth.

In this way you can manually write the dot matrix.

 

A more automatic way is using the python script to control the New laser engraver. This script has limited automation and works with any image (Current version still stretch non square images).

Right now the workflow is like this:

“`python3 printer.py

* Convert image

* Check converted.bmp for the result (It will be vertically flipped)

* Load image to new laser engraver

* Set burning time (Or default will be used)

* Print

It has some python dependencies because I used a couple of fast prototyping libraries.

Why the hell did I make a python script?

Simple! The python script is theoretically able to use the New laser carve to print complex images by dividing it by luminosity and printing overlapped images.

hdr
Burned logo

Links:

Project Gthub: https://github.com/AxelTB/nejePrint

13 thoughts on “Neje Laser Engraver on Linux

  1. Hi. I too am struggling with the Windows software, however I’m not great with understanding Linux. Do you just plug the engraver into the USB port of your Linux machine and then run the code? How does it ‘find’ the engraver (comparing to the COM port setup with the engraver on Windows). Do you think this could work off a Raspberry Pi?

    I’d love more info on this if you have the time.

    Thanks!

    1. I have a similar question, I’m not 100% versed in Linux lore. I’m wondering what the SERIALDEVICE should be perhaps as an example. I noticed that /dev/ttyUSB0 was added to my /dev folder after I plugged the printer in. I used that:

      sudo ./nejePrint.sh /dev/ttyUSB0 mono.bmp

      It didn’t throw any errors, but the printing didn’t start. So I pushed the big red button and it just printed my previous item (not the mono.bmp). Is this SERIALDEVICE supposed to be something else?

      1. Axxx

        Batch version seem to be bugged, try with the python version.

        BTW the command is right, apart from sudo, you shouldn’t need that

  2. Paul

    How did you get the command hex codes that you use to communicate? I have the DK-BL which appears to take the upload code fine, but doesn’t respond to any of the other commands.

    1. Axxx

      I used a sniffing software on the original software. All my annotation are in the command.txt file

      1. Paul

        Thanks for the response. Just to update for anyone else looking: I discovered wireshark had a good usb capture for Windows, so did a capture with it on a test VM. Looks like the DK-BL uses multi-byte command words instead of single byte, but uses the same setup (more or less) for sending the image. I’ll tinker with it and see if I can get communication going from linux. DK-BL is much more different than DK-8-* than I expected.

  3. Jan Stembera

    How can I lookup which type is it?

    If I run your script : data are sent to the engraver and laser is looping in rectangle shape (like a preview) and thats all. If I press the red button nothing happens.

    here is output of your script:
    ./nejePrint.sh /dev/ttyUSB0 mono.bmp
    setting port…
    speed 57600 baud; line = 0;
    -brkint -imaxbel
    done
    Handshake…
    done
    Sending
    done
    home
    Burning Time 0x20
    preview
    All Done

    Could you help me?

    1. Axxx

      Are you using the master or develop branch?

      Bash script is a work in progress, the version on the master branch was only for reverse-engineering purpose. Try the develop one

      1. Jan Stembera

        thx
        output of development version:
        ./nejePrint.sh /dev/ttyUSB0 mono.bmp
        setting port…
        Handshake…
        0+1 záznamů přečteno
        0+1 záznamů zapsáno
        Handshake Failed (Error 0):
        speed 57600 baud; line = 0;
        min = 1; time = 0;
        -brkint -icrnl ixoff -imaxbel
        -opost -onlcr
        -isig -icanon -echo -echoe
        note:
        “0+1 records read
        0+1 records written”
        can I dump it to get what’s wrong?

  4. hi I am having the same problem I think, after sending and all that it just moves in a square around the perimeter over and over and I doubt it will ever stop. Never fires the laser either. have tried with master and develop branch, develop branch does say ‘press button to start printing’ but there is no button at all on my engraver. JZ-5 is my model, as on http://www.trusfer.com/#Download

    1. Axxx

      Hi,
      Neje seems to have totally changed after my machine.

      I don’t even have my old machine anymore so I have no way to test anything.

      I’m really surprised your machine is compatible in the first place…

  5. something itsnt right at all if its just moving in a square over and over. wine runs the software it came with fine but it will not connect to it.. oh well i guess i have to have a windoze desktop for gaming anyways..

    1. Axxx

      My machine (Which is a different model) starts moving on a square when the image is loaded and ready to be printed. You click the print button and it starts.

      I don’t know new neje laser engravers, it seems like they changed the protocol at some point but without having my hands on it there’s nothing I can do.

Wassup?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.