This script prints to a printer using the serial port of a Raspberry Pi, and plays a sound when printing.
- Download the files from GitHub by clicking on the green "Code" button, and "Download ZIP"
- Extract the ZIP, and copy
start-printing
,printer.service
andprinter.config
to the home folder on your Pi* - In your terminal, run
sudo cp printer.service /etc/systemd/printer.service
(*) The home folder can be accessed by running cd ~
. On a default Pi install, it will probably be in /home/pi
.
Open the printer.config
file in a text editor. The file contains options, in the format option name: option value
.
Change the text-path
and sound-path
options to point at your files.
You can use ~
to refer to the home folder, e.g. ~/mysounds/sound.wav
.
Change the baud rate to match the rate of your printer.
Simply open your Terminal, go to your home folder (cd ~
) and run ./start-printing
.
- The text file should be a plain
.txt
- The printer will print one line of the text file at a time. So format it so that each paragraph is entirely on one line.
- Make sure the sound file is a valid WAV file. You can export it as WAV for example in Audacity (File > Export > Export as WAV).