Using a Pipsta (or similar) wireless printer
The Pipsta is a small thermal printer powered by a Raspberry Pi, which uses rolls of standard till receipt paper. The standard text width is 32 characters per line, so this seems like an ideal modern equivalent of the Sinclair ZX Printer!
The easiest way to get your ZX Spectrum Next talking to a printer like this is to install the optional ESP8266 wireless module in your Next.
NOTE: Since this tutorial was written, D Xalior Rimron-Soutter has provided a more comprehensive set of scripts to run on your Pipsta (or a similar printer), including support for screendump printing. Check these out at https://github.com/StalePixels/PrintShop/.
Setting up the Pipsta
To assemble your Pipsta, follow the instructions at:
https://bitbucket.org/ablesystems/pipsta/wiki/Pipsta%20Assembly%20Instructions/
If you are using a Raspberry Pi without a built-in wifi module, don’t forget to plug a wifi adapter into one of the USB ports.
Preparing your SD card
Download the most recent Raspbian release based on jessie (at the time of writing, the Pipsta firmware update utility did not work on stretch or later versions), then unzip it and write it to an 8GB or larger SD card using the Etcher utility (or the dd
command-line utility if you prefer):
http://downloads.raspberrypi.org/raspbian/images/raspbian-2017-07-05/2017-07-05-raspbian-jessie.zip
Updating Raspbian
Insert the SD card into the Raspberry Pi, attach a keyboard, mouse and monitor and then power it up.
Once Raspbian has booted to the desktop, click the network icon in the panel at the top of the screen and join the Pi to your wireless network.
Open a Terminal application and enter the following commands to update Raspbian with the latest software:
sudo apt-get update
sudo apt-get upgrade
Installing the Pipsta software
Open the web browser and download the following files from https://bitbucket.org/ablesystems/pipsta/downloads/ :
- pipsta-printer-utilities-1.1.1-Linux.deb
- V9_2_09.able
- pipsta-cups-driver-0.3.0-armhf.deb
- pipsta-0.3.0-armhf.deb
Open a Terminal and enter the following commands to install the Pipsta software. (Don’t worry about errors with the dpkg
commands, as these will be resolved with the following apt-get
commands).
cd ~/Downloads
sudo dpkg -i pipsta-printer-utilities-1.1.1-Linux.deb
sudo apt-get -f install
sudo dpkg -i pipsta-cups-driver-0.3.0-armhf.deb
sudo apt-get -f install
sudo dpkg -i pipsta-0.3.0-armhf.deb
sudo apt-get -f install
Updating the printer with the latest firmware
In the same Terminal , enter the following command and follow the prompts to update the printer’s firmware to the latest version:
sudo fpu V9_2_09.able
You can press the printer’s feed button twice to produce a test print and verify that the firmware has been updated.
You can also test that printing from the Raspberry Pi works by typing the following command:
lp ~/.profile
Installing the scripts
Download the following scripts from https://gitlab.com/garrylancaster/pipsta-next/tree/master:
- pipsta-server.py
- .profile
Move the files into your home directory with the file manager, or with the following commands in the Terminal:
mv ~/Downloads/pipsta-server.py ~/
mv ~/Downloads/.profile ~/
The .profile script will automatically start up the pipsta-server.py script when the Pipsta boots (or when you login). The pipsta-server.py script listens for a connection on port 65432 and forwards the data received directly to the printer as text.
Final setup
It’s also recommended to run the Raspberry Pi Configuration program from the Preferences section of the applications. Set up the following items which will make it possible to run the Pipsta without requiring a monitor, keyboard and mouse:
- Set Resolution… Select a suitable resolution (this allows the Pi to run headless)
- Set the hostname to pipsta so it can be easily found on your network
- Change the password (the original password is raspberry)
- In Interfaces, enable SSH (this allows you to login to the pi from another computer with ssh in order to shut it down properly etc)
Using the Pipsta from the Next
Once your Pipsta is up and running, you can connect to it from your Next if you have the optional ESP8266 wifi module installed.
If you haven’t already done so, first connect your Next up to your wifi network by following the instructions at https://specnext.dev/tutorials/setting-up-wifi-on-your-next/, or by running the c:/demos/esp/wifi.bas program. You’ll only need to do this once as the ESP module will remember the network settings.
The next step is to load the ESP driver. This is most easily done by running the c:/demos/esp/ESPINS.BAS program (by selecting it in the Browser). You’ll need to do this every time you turn on or reset the Next, unless you add the necessary commands into your c:/nextzxos/autoexec.bas.
Finally, open a stream to the Pipsta; this can normally be done by referring to it as pipsta.local
but if this doesn’t work for you then you’ll need to specify it’s full IP address instead:
OPEN #3,"D>N>TCP,pipsta.local,65432"
If you open stream 3, the LPRINT
and LLIST
commands will work directly; otherwise you will need to use PRINT #n;
or LIST #n
etc.
Most other commands which normally output to the screen can also send their results to any stream. eg for output to stream 3:
CAT #3
COPY "file.txt" TO #3
BANK 20 LIST #3;PROC setup()
Using the printer from ZXZVM
Add the following lines to the c:/games/Z-Machine/zxzvm/nxzxzvm.bas program:
392 ON ERROR GOTO 400
395 OPEN #3,"D>N>TCP,pipsta.local,65432"
425 CLOSE #3
Re-save the program with SAVE "c:/games/Z-Machine/zxzvm/nxzxzvm.bas" LINE 730
. You will then be able to send a copy of your adventuring progress to your Pipsta printer by turning on the game’s transcript (this is performed in most games with the script
command).