Skip to content

Raspberry Pi as SnD Server

Daniel S edited this page Jan 2, 2023 · 3 revisions

⚠️ Outdated!

Just download one of the pre-build releases for the Raspberry Pi (e.g. snd_linux_arm6_headless_rpi, snd_linux_arm7_headless_rpi) and run that.

Using a Raspberry Pi as SnD Server with attached printer

There are two main reasons why you might want to connect the printer to a Raspberry Pi.

  • Chinese unsigned drivers on Windows machine
  • Making the printer wireless

You can use a dedicated RPi, or an existing, as SnD does not use much ressources. A RPi3 is recommended for the integrated Wifi, faster compiling and responsiveness of the GUI. It is tested on a RPi B, compiled on a RPi3 and worked fine.

Preparations:

To get started, a installed and running RPi is needed. A Debian buster lite installation is assumed, because it is most likely that there are the most steps to get it running. How to get a SD card prepared can be found here and is not part of this tutorial. There are two useful additional information:

  • Setting up Wifi before first boot
  • Enabling SSH before first boot

GO installation:

Once the RPi is up and running, use the console or SSH to log in and start by installing the go programming language:
Go to the go download page and look for the latest version for Arch ARMv6. In this example it is go1.14.linux-armv6l.tar.gz.

wget -c https://dl.google.com/go/go1.14.linux-armv6l.tar.gz

Then extract the archive:

sudo tar -C /usr/local -xvzf go1.14.linux-armv6l.tar.gz

This will create the folder /usr/local/go and put all the files there. Now a working directory should be created. Go expects a certain structure, which can be created with this command:

mkdir -p ~/go/{bin,src,pkg}

To easily acces the go command, a path variable has to be added:

export PATH=$PATH:/usr/local/go/bin

This only adds the path for the current terminal, to make it permanent execute this command:

echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.profile

This will add the path to the profile of the logged in user and makes it available after each login.

Sales'n'Dungeons installation:

First some tools and dependencies have to be installed. Do that with this command:

sudo apt-get install git libusb-1.0.0

The next step is to pull the sourcecode from GitHub. Since this tool is in an early development, there are no releases yet, so pulling the latest sourcecode is probably a good start. That can be done like this:

cd ~/go/src
git clone https://github.com/BigJk/SnD

This will copy the sourcecode to the local folder ~/go/src/snd
There are some more dependencies to download, get them with:

go mod tidy
go mod download

The next step is to get the frontend downloaded. Find the latest one here. Copy the link and download it like this:

wget -c http://snd.ftp.sh:2015/frontend-only/03.04.2020%20frontend%20%5Bf3d261ae%5D.zip

Then extract it into the snd folder like this:

tar -C ~/go/src/snd/ http://snd.ftp.sh:2015/frontend-only/03.04.2020%20frontend%20%5Bf3d261ae%5D.zip

That's it, ready to go! Switch to snd and compile+run by

cd ~/go/src/snd
go run cmd/headless-libusb/main.go

The first time, this takes a few seconds because the sourcecode is compiled for the first time. When it is done, the snd logo will be shown

_____        _____
/ ____| ___  |  __ \
| (___  ( _ ) | |  | |
\___ \ / _ \/\ |  | |
____) | (_>  < |__| |
|_____/ \___/\/_____/
________________________________________

This means the webinterface should be available with any brower on the same network.

http://%IP-OF-YOUR-RASPBERRY%:7123

If the webinterface shows up, the server can be stopped again by hitting CTRL+C.
Next, the HW address of the printer. lsusb will return all the USB devices connected to the RPi3

Bus 001 Device 004: ID 0416:5011 Winbond Electronics Corp. Virtual Com Port
Bus 001 Device 005: ID 0424:7800 Standard Microsystems Corp.
Bus 001 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Find your printer, in case of the ZJ-8330 it will be identified by Winbond Electronics Corp. Virtual Com Port. The address is 0416:5011. An other way to find out the address is to plug the printer in and execute dmesg. There will be a line like

usblp 1-1.1.3:1.0: usblp0: USB Bidirectional printer dev 6 if 0 alt 0 proto 2 vid 0x0416 pid 0x5011```

With the vendor and product IDs, find the endpoint ID with lsusb -v -d 0416:5011 | grep bEndpointAddress

bEndpointAddress     0x81  EP 1 IN
bEndpointAddress     0x03  EP 3 OUT

The last line is of interest, 3 OUT states that the endpoint ID is 3.
Now with the ID complete the user pi has to be able to use the printer, for that it has to be added to the system group lp.

sudo usermod -a -G lp pi

Fire up the server again:

go run cmd/headless-libusb/main.go

Open up the webinterface again, go to settings and select the Printer Type Raw USB Printing
Put in the Endpoint 0416:5011:03 , or your systems version of it.
Enable Explicit Initialization and Force Standard Mode.

Thats it, everything is in order. Try printing something now.
How to set up templates is covered in this wiki (or will be in the future).