Tue Mar 21 09:18:54 EST 2023
 

Date Created: 2013-12-09 06:18:24 -0600 (Mon, 09 Dec 2013)

Neje Engrave - Web Enabled Laser Engraving

Overview

  This guide shows how to control a Neje DK-8-KZ laser engraver via a Web application.

The software is configured with Ansible on the command line.

As Seen on Adafruit Show and Tell

Hardware

Hardware Connections

Software Prerequisites - Target Host

Software Prerequisites - Control Host

This projects uses Ansible to configure software. The 'control host' is the Linux machine were ansible commands are issued to configure the target Raspberry Pi host.

Use pip3 to install the same Ansible version found on the target machine. In this case the target host (the Raspberry Pi) had ansible version 2.2.1.0.

pip3 install --user 'ansible==2.2.1.0'
            

This project requires a JEE application server. Payara is a good fit and is setup by Ansible.

In this project, ansible uses SSH to communicate between the control and target hosts. If you don't have sshpass installed, then issue this command on the control machine:

        sudo apt install sshpass
                

The configuration software for this project is hosted on github.com. Issue the following commands to download and change directory the project:

git clone https://github.com/onebeartoe/electronics.git

cd electronics/neje-engrave/src/main/provisioning/

Software

Before continuing, update IP address in the file 'hosts/raspberry-pis' to match the actual IP address of the target Raspberry Pi.

The commands in this section install application dependencies as well as the application itself. The commands in this section also require the password of pi user on the Raspberry Pi and the sudo password.

Unless these were explicitly changed, the password for pi user is 'raspberry'. If the default password was changed, then use that password when prompted for the commands in this section.

The following command takes a good while to finish the first time it is run, since it is downloading and installing a bunch of software to the target host's operating system.

$ ansible-playbook install.yml -i hosts/raspberry-pis -vvvv --ask-pass --ask-sudo-pass

While it does take several minutes to finish, no errors should occur when the above command executes.

Use ssh-copy-id to avoid entering credentials (and the "--ask-pass --ask-sudo-pass" parameters) every time.

Once ssh-copy-id is used on the target host, the command looks like this:

$ ansible-playbook install.yml -i hosts/raspberry-pis

Once this command completes, the core application software is installed.

Optional Camera Software

This project also has optional camera features for the laser engraver. This has been tested with Play Station style Webcams, but the official Raspberry Pi Camera should also work.

To install the camera software, issue the following command.

$ ansible-playbook camera.yml -i hosts/raspberry-pis

This command installs motion and adds a cron reboot job to start motion each time the Raspberry Pi boots.

If the camera feed does not show in the user interface, then check the log file on the Raspberry Pi at this location:

/var/log/motion/motion.log

Running the Application

To start the NejeEngrave application issue this command:

$ ansible-playbook start-neje-engrave.yml -i hosts/raspberry-pis

After a bit of time, the application is available at this URL:

http://raspberrypi-host:8080/neje-engrave-0.0.1-SNAPSHOT/controls/

Change 'raspberrypi-host' in the above URL to the IP or hostname of the target Raspberry Pi.

Here is a screenshot of the NejePrint application:

Execute this command to stop the Web application:

$ ansible-playbook stop-neje-engrave.yml -i hosts/raspberry-pis

Usage

Basic usage of the laser engraver involves the following steps:

  1. Use the 'Upload to Filesystem' button to send an image to the Raspberry Pi, which in turn sends the image to the engraver.
  2. Or click one of the 'Upload to Engraver' buttons to select an image already on the Raspberry Pi for engraving.
  3. Optionally set the burn time with the slider input component. The burn time is in milliseconds; around 14-20 works well for wooden coins.
  4. Click the 'Start' button to begin the engraving process.

Other features include reset and pause buttons.

Resources

Going Further