Atari ST disks were weird. Although they were nominally FAT format 3½″ double density disks, they wouldn’t read on a PC. You could format a disk on a PC, however, and the Atari would read/write it just fine.
I had a (virtual) stack of roughly 170 Atari ST disk images that I wanted to access from Linux. mtools, the FAT image reading suite for Linux, could only read 4 of the disks. It didn’t help that some of the images had 82 tracks, or 11 sectors per track, where 80 tracks and 9 sectors per track were standard. I knew that the Hatari emulator could read the images, but the ST’s graphical interface made automation difficult.
I sought help years ago, but that didn’t come to much. I tried again the other day: hatari’s hatari-prg-args combined with the gulam shell made it work.
You’ll probably need EmuTOS so that Hatari can emulate hard drives. I used the current etos512us.img ROM image throughout.
First, I made a folder structure for the emulated hard disk:
If you’re transferring a lot of disk images, you probably want to add some speed-up options to the Hatari command line. For my batch conversion job, I added:
--fast-forward 1 --cpuclock 32 --fast-boot 1 --fastfdc 1 --protect-floppy on
The whole disk contents are now in the gemdos/bclip folder:
This process allowed me to batch-convert most of FaST Club’s Mono Clip Art collection and put it up on the Internet Archive in a readable format: FaST Club Mono Clip Art Selection
… Other than hats or pins I find there is rarely a good reason for a pi these days. You can get cheap x86 thin clients that beat the pants off them – the dell wyse ones are very cheap on ebay and excellent, the 5070 has an m2 slot and upgradable ram.
I’ve had Raspberry Pis since they were launched. I used to work for an Official Reseller. I’ve been hired for my expertise with them. They’re so much part of the woodwork around here that I’ve never really considered them expensive. So how do they compare to an ex-corporate thin client box?
Dell Wyse 5070
I found one on eBay from a local reseller, GREENSTAR💻⭐. For $68.44 including sales tax (that’s €42), I got a used thin client box including:
a great big power supply brick;
Intel j5005 quad core cpu, fanless;
8 GB of DDR4 RAM (dated 2021);
128 GB SATA M.2 SSD;
3× DisplayPort video ports, 1920×1080 at 60 Hz;
5× USB 3 ports, 1× USB C port and 2× USB 2 ports;
a real 9-pin serial port;
no wifi!
This isn’t a detailed hardware review: for those, I suggest you read Gough Lui and David Parkinson. To get this machine up to a usable spec, I added:
a DisplayPort → HDMI cable (about $20);
a replacement BIOS backup battery ($1);
a cheap USB wifi adapter. I’m still finding old RTL8188CUS dongles about the house from the early Raspberry Pi days, some still in original packaging. These work, but aren’t great, but I can’t beat the price.
All in — excluding monitor, keyboard and mouse — I’ll say I brought it in for $100 inclusive (about €61).
Raspberry Pi 5
To come up with an equivalent system (bought from an Official Reseller that I didn’t work for) I’d need:
Description
Price
Raspberry Pi 5 8GB
$114.95
Raspberry Pi 45W USB-C Power Supply
$21.99
Case (with fan)
$13.95
MicroHDMI to HDMI Cable (2 m)
$9.95
128GB SD Card
$24.95
RTC Battery
$7.00
Subtotal
$192.79
Sales Tax
$25.06
Total
$217.85
(or €134)
Not all of these items are available from the one reseller, particularly the 128 GB SD Card and RTC battery. I’ve included the RTC battery so you can do timed power-on tricks as with a regular PC. All the parts are from Raspberry Pi themselves. Curiously, you can pay more for non-official accessories with the CanaKit Raspberry Pi 5 Starter Kit at $224.95 + tax.
Raspberry Pi 4
An equivalent 8 GB Raspberry Pi 4 system breaks down like this:
Description
Price
Raspberry Pi 4 8GB
$104.95
Raspberry Pi 15W USB-C Power Supply
$10.95
Case
$6.95
Case fan
$6.75
MicroHDMI to HDMI Cable (2 m)
$9.95
128GB SD Card
$24.95
DS3231 Real Time Clock Module for Raspberry Pi
$9.95
Subtotal
$174.45
Sales Tax
$22.68
Total
$197.13
(or €121.)
This is surprisingly expensive, and unless you must have this particular SoC, likely better to go with a Raspberry Pi 5. Again, the RTC is optional, but timed power-on can be handy in a small computer. Most of the “RTC for Pi” boards use a cheaper DS3231M clock chip which can’t issue alarms for power control. You might have to shop around a bit to get this particular part.
(As a former employee of a reseller, I suspect I’m permanently blocked from sharing why official resellers bundle third-party bits with their kits, always with a considerable price bump. Let’s just say that, during the Pandemic Chip Shortage, it was very galling to get a rare shipment of Raspberry Pi boards, go to extreme lengths to cancel multiple orders [oh the javascript injection hack attempts that I saw] and hurry to ship the boards out. The next day, we’d see what had to be the same hardware appearing on eBay at a 300% markup. And there was nothing we could do about it …)
Testing
I’m not interested in testing:
Network throughput — Beyond having a working connection, I don’t have the skill or attention span to test networking stuff
Video performance — I don’t really do video things. Raspberry Pis and thin clients are going to struggle with full screen 60 fps video anyway, and optimizing this is not my jam
Power consumption — I don’t have the right kit for this. All I have is a 20 year old Kill-a-Watt clone which doesn’t have the necessary resolution.
I’m going to have to rely on benchmarks. Benchmark results are notoriously easy to fiddle and give only a rough idea of how a system will perform in real life. I’m going to present the results of three systems (Raspberry Pi 4 and 5, Dell Wyse 5070: all running stock but up-to-date Raspberry Pi OS or Debian) in three tests, in decreasing order of arbitrariness.
1: MP3 Encoding
The time, in seconds, to encode Aphex Twin’s minimalist opus aisatsana [102] (5′ 21″) from a 55MB WAV file to a 6.8MB MP3 with:
time lame -V 2 aphex_twin-aisatsana.wav
System
Time
Raspberry Pi 4
14.2 s
Dell Wyse 5070
8.6 s
Raspberry Pi 5
5.7 s
The thin client comes out between the two Raspberry Pis. It’s not a bad result at all: 8.6 s is still 37× real-time encoding.
2: pichart
pichart is a processor benchmark developed by Eric Olson for ranking numeric processing power of various computers against Raspberry Pi boards. It’s documented here: A Pi Pie Chart.
It’s possible to tweak this benchmark endlessly with compiler options, but I stuck with whatever version of gcc the system came with. I also used exceptionally conservative compiler options of -O2. I reckon that if your compiler has got to version 12, it won’t be producing terrible code with simple options. Anyway:
All of these are OpenMP multi-core, multi-thread results. The Wyse 5070 holds a pretty solid second place to the Raspberry Pi 5.
3: UnixBench 6.0.0
byte-unixbench must be a very serious benchmark because it wraps a whole suite of results into one impenetrable number. We’re supposed to believe that This Number has some respectable heft. It certainly takes a long time to run (almost half an hour) and if your computer has fans, things can get loud.
Since all three machines have four cores, it’ll save a lot of words to report only the multi-core System Benchmarks Index Score:
For all its purported repeatability, this set of scores surprised me most. The Wyse 5070 doesn’t feel much slower than either Raspberry Pi board. Could the small SATA SSD be a bottleneck? I’d have to spend money to find out.
(I also ran sbc-bench, but the results are even less enlightening. The only thing I could discern was that the Wyse 5070 was running some kind of custom thermal regime. Since it has no fan and only a modest heat-pipe cooler, this is no surprise. My results, have at ’em: sbc-bench)
Conclusions
I can get two Wyse 5070 systems for the cost of one Raspberry Pi 4 or 5. This is what makes the decision for me, and every other issue is window dressing. So much of “I made a thing with a Raspberry Pi!” is really “I made a thing with a small Linux computer!” these days, and the 5070 and other thin clients excel at this.
Yes, the Raspberry Pi 5 is likely to be slightly faster that the Wyse 5070. And if you’re locked-in to their cameras, HATs or GPIO layout, you’re probably going to stick with Raspberry Pi. Likewise, if you’re kitting out a classroom, Raspberry Pis are all repeatable, from the same vendor, and have a proper warranty. Nobody in education got fired for buying Raspberry Pi — even if the micro:bit is the STEM board of choice round these parts.
Even if the supply can be a bit variable, and you can’t be quite sure you’ll be able to get the same spec every time, the Wyse 5070 represents great value for money. I’ll definitely think twice about buying a Raspberry Pi next time.
… about those GPIO pins
If you’re not constrained to using Raspberry Pi’s 40-pin header or specific HAT hardware, you’ve still got options, including but not limited to:
an FT232H Breakout and PyFtdi. It may be possible (with some fiddling) to make the FT232H appear as a Linux gpio chip directly;
and of course, Firmata running on an Arduino is exactly where you left it in 2011. It still works, it hasn’t gone away, and is still at the heart of many custom interactive installations.
Parting thought
“raspberry pi computer” is an anagram of “temporary price burps”. This, I feel, is important for you to know.
“It amazes me how you manage to live in anything that small“: actual size Mac Classic II screenshot
So I’m refurbishing the Mac Classic II I got in 2016 now that I’ve found that BlueSCSI is a fairly cheap way of providing large replacement storage. The 40 MB (yes, 40 MB) drive from 1992 can finally be replaced.
Hit a snag, though: DiskCopy won’t copy a disk with errors, which this drive seemed to have. DiskCopy also won’t repair the boot disk, so you have to find a bootable floppy or some other way to work around this limitation. The only readily available bootable disk image I could find was the System 7.1 Disk Tools floppy — which reported no errors on my drive! Later versions of Disk First Aid would fix it, but weren’t provided on a bootable image.
Here’s the 7.1 Disk Tools floppy with all of the apps replaced by Disk First Aid 7.2. Both of these were found on the Internet Archive’s download.info.apple.com mirror and combined:
Disk duly repaired, DiskCopy was happy, backup complete. Eventually: the Classic II is not a fast machine at all.
I love the old Mac icons, how they packed so much into so few pixels:
Disk First Aid icon
It’s a stylized ambulance with flashing light and driver, the side is a floppy disk, it’s got motion lines and the whole icon is slanted to indicate speed/rush. Nice!
Vaguely related: most old Mac software is stored as Stuffit! archives. These don’t really work too well on other systems, as they use a compression scheme all their own and are specialized to handle the forked filesystem that old Macs use. Most emulators won’t know what to do with them unless you jump through hoops in the transfer stage.
Fortunately, the ancient Linux package hfsutils knows the ways of these hoops, if only you tell it when to jump. The script below takes a Stuffit! file as its sole argument, and creates a slightly larger HFS image containing the archive, with all the attributes set for Stuffit! Expander or what-have-you to unpack it.
#!/bin/bash
# sitdsk - make an HFS image containing a properly typed sit file
# requires hfsutils
# scruss, 2021-07
if
[ $# -ne 1 ]
then
echo Usage: $0 file.sit
exit 1
fi
base="${1%.sit}"
# hformat won't touch anything smaller than 800 KB,
# so min image size will be 800 * 1.25 = 1000 KB
size=$(du -k "$1" | awk '{print ($1 >= 800)?$1:800}')
dsk="${base}.dsk"
dd status=none of="$dsk" if=/dev/zero bs=1K count=$((size * 125 / 100))
hformat -l "$base" "$dsk"
# note that hformat does an implicit 'hmount'
hcopy "$1" ':'
# and hcopy silently changes underscores to spaces
hattrib -t 'SIT!' -c 'SITx' ":$(echo ${1} | tr '_' ' ')"
hls -l
humount
What this does:
creates a blank image file roughly 25% larger than the archive (or 1000 KB, whichever is the larger) using dd;
‘formats’ the image file with an HFS filesystem using hformat;
copies the archive to the image using hcopy;
attempts to set the file type and creator using hattrib;
lists the archive contents using hls;
disconnects/unmounts the image from the hfsutils system using humount.
Notice I said it “attempts” to set the file type. hfsutils does some file renaming on the fly, and all I know about is that it changes underscores to spaces. So if there are other changes made by hfsutils, this step may fail. The package also gets really confused by images smaller than 800 KB, so small archives are rounded up in size to keep hformat happy.
There are a million variations on the simple “use sox to play masking pink noise“, such as:
play -n synth pinknoise gain -3
This will play synthesized pink noise until you hit Ctrl-C.
But it you want two independent noise channels rather than mono, that’s a little more complex. It’s probably easier to download/play the MP3 file above than show you the command line.
Note that MP3s really aren’t designed to encode such random data, and it’s likely that your player will cause the audio to clip in a couple of places. I’m not quite sure why it does this, but it does it repeatably.
If you want to create this for yourself (and create a bonus lossless FLAC, which was far too large to upload here), here’s what I did to make this:
If you need to ship things, you’re probably not too keen on queuing at the post office right now. Canada Post’s Ship Online service is pretty handy if you have a printer. The PDFs it produces are okay to print on plain paper, but if you’re using full-sheet labels like Avery 5165 you’re going to waste half a sheet of expensive labels.
If you’ve got two parcels to mail, this shell script will extract the right side of each page and create a single 2-up PDF with both your labels on the same page. You will need:
On my Ubuntu system, you can get good-enough¹ versions by doing this:
sudo apt install poppler-utils netpbm img2pdf
The code:
#!/bin/bash
# cp2up.sh - fits the important part of Canada Post print labels 2 per sheet
# scruss, 2021-05 - CC-BY-SA
# hard-coded input name (document.pdf)
# hard-coded output name (labels-2up.pdf)
# accepts exactly two labels (sorry)
dpi=600
width_in=11
height_in=8.5
# png intermediate format uses pixels per metre
dpm=$(echo "scale=3; $dpi * 1000 / 25.4" | bc)
# calculated pixel sizes, truncated to integer
half_width_px=$(echo "$width_in * $dpi / 2" | bc | sed 's/\..*$//')
height_px=$(echo "$height_in * $dpi" | bc | sed 's/\..*$//')
pdftoppm -mono -r "$dpi" -x "$half_width_px" -y 0 \
-W "$half_width_px" -H "$height_px" document.pdf labels
pnmcat -lr labels-1.pbm labels-2.pbm |\
pnmtopng -compression 9 -phys "$dpm" "$dpm" 1 > labels.png \
&& rm labels-1.pbm labels-2.pbm
# fix PDF time stamps
now=$(date --utc --iso-8601=seconds)
img2pdf -o labels-2up.pdf --creationdate "$now" --moddate "$now" \
--pagesize "Letter^T" labels.png \
&& rm labels.png
# saved from:
# history | tail | awk '{$1=""; print}' |\
# perl -pwle 'chomp;s/^\s+//;' > cp2up.sh
It’s got a few hard-coded assumptions:
input name (document.pdf);
output name (labels-2up.pdf);
accepts exactly two labels (sorry).
Clever people could write code to work around these. Really clever people could modify this to feed a dedicated label printer.
Yes, I could probably have done all this with one ImageMagick command. When ImageMagick’s command line syntax begins to make sense, however, it’s probably time to retire to that remote mountain cabin and write that million-word thesis on a manual typewriter. Also, ImageMagick’s PDF generation is best described as pish.
One of the issues that this script avoids is aliasing in the bar-codes. For reasons known only to the anonymous PDF rendering library used by Canada Post, their shipping bar-codes are stored as smallish (780 × 54 px) bitmaps that are scaled up to a 59 × 19 mm print size. Most PDF viewers (and Adobe Viewer is one of these) will anti-alias scaled images, making them slightly soft. If you’re really unlucky, your printer driver will output these as fuzzy lines that no bar-code scanner could ever read. Rendering them to high resolution mono images may still render the edges a little roughly, but they’ll be crisply rough, and scanners don’t seem to mind that.
fuzzy vs crisply rough: scaled image (top) vs direct-rendered (bottom), at simulated 600 dpi laser print resolution
¹: Debian/Ubuntu’s netpbm package is roughly 20 years out of date for reasons that only a very few nerds care about, and the much better package is blocked by Debian’s baroque and gatekeepery packaging protocol. I usually build it from source for those times I need the new features.
20 years ago, this was one state-of-the-art brick:
Sony Mavica FD-91: a camera with a floppy drive, or a Sovet brutalist monument? Discuss (briefly)
The only way to get pictures from it is via the floppy disk drive on the side. Then you’ve got a bunch of images with 8.3 filenames and the only metadata being the date saved from the camera’s clock. I’d written about it before, but I had an event that I wanted to record with a suitable camera, so adding some metadata to the pictures became important.
Printing from computers goes through waves of being difficult to being easy, then back to difficult again. This is likely due to the cycles of technology, complexity and user demand flow in and out of sync. I think we’re at peak annoyance right now.
It’s even harder with Raspberry Pis, as when printer drivers support Linux, 90% of them are for x86 or x86_64 computers only (Canon: ಠ_ಠ). ARM doesn’t get a look in. But one technology does actually seem to help: network printers that support IPP — Internet Printing Protocol.
We had an old Brother laser printer that just got slower and crankier and less useful as a printer, so yesterday I got a new Brother DCP-L2550DW to replace it. It says it supports Linux in the spec, but I knew not to be too optimistic with my Raspberry Pis. And indeed, it was seen on the network but no driver was found. I had a sad.
What turned my frown upside down was finding out about Raspbian’s cups-ipp-utils package. For desktop use, install it this way:
(leave off system-config-printer if you’re running from the terminal.)
Update: while you’re here, you might also want to install the print-to-PDF driver too. This allows you to print without wasting paper. Install it (and the IPP driver) with:
In many cases, this might be all you need to do: the network printers should be automatically found and added as devices.
Adding the new printer
On the desktop, open up Preferences → Print Settings and add a new printer. Yes, it prompts for your user password which you may have forgotten. I’ll wait while you try to remember it …
Now under Network Printers, you should see a device you recognize. Pick the one that says IPP network printer somewhere:
IPP network printer
Here’s where the magic happens: you actually want to pick the generic driver for once:
Select Generic (recommended) manufacturer
And again, the IPP utilities package will have picked the right driver for you:
Just go with what the driver suggests
Changing the name and location is optional:
Your new printer’s almost ready to go!
Hit Apply, and you should be printing!
(Hey, printer manufacturers have been known to be evil and make good, working stuff suddenly not work. IPP is supposed to make everything sparkly again, but I can’t guarantee that something wicked won’t come this way.)
Update: After a few months of using the Brother DCP-L2550DW, I don’t recommend you buy it. It’s a perfectly capable printer, but it takes ‘chipped’ toner cartridges that:
stop dead when you hit their page count limit, wasting toner and preventing you from finishing the print job;
can’t easily be refilled by local technicians, so are wasteful of resources.
To get around (1), select Continue instead of Stop in the Toner Out configuration menu.
Update, January 2020: with sales and all needing a printer for work, the DCP-L2550DW will go with me to the office. I now have a MFC-L2750DW at home that scans to network, amongst other things. IPP proved it was magic yet again by the new printer being found and justworked with all my machines as soon as I added it to the network.
SoX can do almost anything with audio files — including synthesize audio from scratch. Unfortunately, SoX’s syntax is more than a bit hard to follow, and the manual page isn’t the most clear. But there is one example in the manual that gives a glimpse of what SoX can do:
While it plays a nice chord, it’s not obvious how to make audio files from this process. I have a project coming up that needs a few simple guitar chords, and with much trial and error I got SoX to spit out audio files. Here’s what I keyed into the shell:
G : G2 B2 D3
C : C3 E3 G4
D : D3 F#4 A3
F : F3 A3 C4
A : A3 C#4 E4
E : E2 G#3 B3
Em : E2 G3 B3
How the SoX command line breaks down:
-n —use no input file: SoX is going to generate the audio itself
-r 16000 -b 16 “chord-${chord}.wav” — with a sample rate of 16 kHz and 16-bits per sample, write to the output file “chord-….wavâ€
synth pl “$first” pl “$third” pl “$fifth” —synthesize three plucked tones read from the file
delay 0 .05 .1 —delay the second tone 0.05 s after the first and likewise the third after the second. This simulates the striking of guitar strings very slightly apart.
remix – —mix the tones in an internal pipe to the output
fade 0 1 .095 —fade the audio smoothly down to nothing in 1 s
norm -1 —normalize the volume to -1 dB.
The chords don’t sound great: they’re played on only three strings, so they sound very sparse. As my application will be playing these through a tiny MEMS speaker, I don’t think anyone will notice.
Update: well, now I know how to do it, why not do all 36 autoharp strings and make the “magic ensues†sound of just about every TV show of my childhood?
Update: this is old and, like most good things in X, likely has been broken by Wayland.
I wanted to have a “Hey, be here now!” ping throughout the working day. Something loud enough to hear, but not irritating.
Doing this with cron was harder than you might expect. It seems that sound is typically part of the X11 display infrastructure, so you need to give the command permission to make a noise on this particular machine’s display. Here’s the crontab line I came up with:
# m h dom mon dow command
0 9-17 * * 1-5 export DISPLAY=:0 && /usr/bin/play -q /home/scruss/sounds/ting/ting.wav
That translates as: at 0 minutes past the hours of 09:00 to 17:00 on any weekday (day of week = 1-5, and we don’t care about day of month or which month it is), execute the command play (part of the sox package) with no text output (-q). cron needs environment variables like DISPLAY set, and prefers full command paths. It may trigger a second or so after the turn of the hour; this is good enough for me.
As for the alert, I wanted something distinctive — percussive, short, bright — but with a tiny bit of modulation to stop it sounding like a bland computer-generated sine wave. This is what I made; click on the image and the sound should play or download:
It’s essentially a 2093 Hz (C₇) sine wave, mixed with itself frequency-modulated at 7 Hz. Why 7 Hz? Apart from sounding about right, 2093 is exactly divisible by 7, 13 & 23, so I used a factor for neatness.
There was some later messing about in Audacity (mostly fades and length edits; I forget exactly what). The two components were generated using sox:
sox -n ting-plain.wav synth 1 sine C7 fade l 0 1 1
sox -n ting-vibrato.wav synth 1 sin C7 synth 1 sine fmod 7 fade l 0 1 1
Yes, sox does have pretty horrible syntax, doesn’t it?
The frequency-modulated one seems to be pretty close to the final result. It would be less time spent trying to save time …
micro – https://github.com/zyedidia/micro – is a terminal-based text editor. Unlike vi, emacs and nano, it has sensible default command keys: Ctrl+S saves, Ctrl+Q quits, Ctrl+X/C/V cuts/copies/pastes, etc. micro also supports full mouse control (even over ssh), Unicode and colour syntax highlighting.
micro is written in Go – https://golang.org – so is very easy to install:
If your running under Linux, you probably want to have xclip installed for better cut/paste support.
Overall, I really like micro. It’s much easier to use than any of the standard Linux text editors. It uses key commands that most people expect. Creating code should not be made harder than it needs to be.
(I was about to suggest FTE, as it appears to be the closest thing to the old MS-DOS 6 editor that I’ve seen under Linux. While it’s a great plain text editor, its Unicode support isn’t where it needs to be in 2016.
micro suggestion came via MetaFilter’s Ctrl + Q to quit. Need I say more?)
I bought a CD-ROM, The World of Patterns. It’s supposed to work on ‘Any computer with an Internet browser and a CD-ROM drive’. Guess I don’t just have any computer, then …
The disk — an interesting mathematical/artistic study of patterns — is arranged as a tree of HTML files, with internal links and images. This is how the folders appear on my computer:
├── art
│ ├── islam
│ ├── preislam
│ └── pstislam
│ ├── latt
│ ├── other
│ └── quilts
│ ├── modern
│ │ ├── large
│ │ ├── patch3
│ │ └── patch4
│ └── usa
├── info
├── maths
All neatly lower case, as one might expect. Unfortunately, the internal links are hard-coded to access links such as /art/Islam/over.htm, and Linux, being good and literal, can’t find the upper case ones.
Unfortunately, the majority of computers quietly ignore the case of letters on removable media. Linux’s insistence on being correct is at odds with what is generally considered useful. But there’s a way around this. You can give the mount command options to tell it to be more chill about case:
sudo mount -t iso9660 -o loop,check=relaxed,map=normal,norock,nojoliet disk.iso /mnt/scratch/
This works for me quite well:
The CD-ROM is interesting, if a little dated. The author has gone on to produce the website tilingsearch.org, a huge database of historical tile patterns.
This might be my last post on mini-printers, as I’ve found a driver that just works with CUPS on Raspberry Pi. It also works on Ubuntu on my laptop, and should work (though untried) on Mac OS. You’ll have to build it from source, but it’s not too hard.
The hard part is working out if your thermal printer will work or not. There are many out there, and they’re all slightly different. If they support the ESC/POS bitmap command GS v 0 on 58 mm wide paper, they should work. The ones I’ve tested are:
Catex POS5890U — USB, cheap, fast.
“701” control board panel printer — fairly generic, decent quality printer with serial input. A bit slow for daily use at 9600 baud.
Xiamen Embedded Printer DP-EH600 — as above.
The following should also work, but haven’t been tried:
Sparkfun thermal printer — which now appears to be identical to the Adafruit unit, and is referred to as the “A1 (or A2) micro panel printer” in the documentation.
Known not to work:
BTHT-V6 printer — which uses a completely different command set. (Roughly that of an Epson FX-80 for image commands, if you care.)
If you have a manual for your printer, check it to see if it prints bitmaps by sending a three byte header of 29 118 48 (or 1D 76 30 in hexadecimal). If you’re not sure, try it with a small test image, and be ready by the power switch …
Getting and building the driver
The driver is meant for a ZiJiang ZJ-58 printer, and lives here on Github: klirichek/zj-58.
Now read and follow the Building & Installing section of the README, and do what it says. I’ll wait …
Setting up the printer
This bit is much more graphical. You’ll need the system-config-printer package:
sudo apt install -y system-config-printer cups
Open up the printer settings window (Preferences → Print Settings):
Select the Add icon, and the New Printer window opens:
The POS5890U shows up as “Unknown” on my USB port, as Linux doesn’t know the name of this device from its USB ID.
Update (for the slightly desperate): In the land of “Things have changed!“, my Catex printer isn’t/wasn’t showing up at all. I had to resort to this in the Enter URI option:
(hey, this image doesn’t quite match the flow. Look only at the the Device URI bit please)
parallel:/dev/usb/lp0 seems to work. Another option might be looking at the output of
sudo /usr/lib/cups/backend/usb
which suggests that usb://Unknown/Printer might work too. (All of this might need to have been preceded by
sudo usermod -a -G lp pi
and a logout or reboot; I did say this was for the slightly desperate …)
If the above doesn’t apply, your printer might have an known ID, or show up as a serial port. Select the right one, and click Forward:
Here, I’m really pleased that the driver is for a Zijiang unit, as it’s conveniently at the end of the list. Click Forward …
No options here, so again, Forward …
I changed the name from the default ZJ-58 to the more unixly zj58. You don’t have to, but either way, Apply the changes.
And there it is, registered as a printer!
Printer Options
Most printers expect paper wider than 58 mm, but mini-printers can’t do that. To tell the system about paper sizes, right click on the printer’s icon, and change the printer settings:
A test page might print properly now, but you should probably go into Printer Options first:
You do want to set the media size to at least 58 × 210 mm. This is just the longest strip it will print in one ‘page’; if your print is shorter, it won’t waste extra paper. You can choose longer prints, but not wider. The default assume your local standard paper size which —be it A4, Letter, or whatever — will not be what you want here. Hit OK.
Printing something
You could print the self test page, but it’s long and boring. If you’re fairly sure your printer will be supported, try this scaled PDF version of the Raspberry Pi Logo: raspberry-pi-logo. Printed and scanned, it came out like this:
Not the best rendition, but not bad for a $30 receipt printer. My test image came out like this (iffy scan, sorry):
I haven’t covered the intricacies of setting up serial port connections here; maybe another time. Also, there’s a short delay (maybe 10–20 s) between selecting Print and the printer coming to life. CUPS is pretty complex, and is doing things in the background while you wait.
(Seeing as I use their logo prominently up there, I should totes acknowledge that “Raspberry Pi is a trademark of the Raspberry Pi Foundation”. Also, I couldn’t have done all this without the support of Reed Zhao. Though Reed has moved on to bigger things and doesn’t sell printers any more, his help — not to mention the generous gift of a couple of printers — was very welcome.)
I’m really impressed with darktable, a raw photo workflow for Linux. Unlike Gimp, it uses floating point for all image processes, so it doesn’t get caught up in quantization error. It’s a non-destructive editor, too: it assumes your source images are like negatives, and any changes you make are only applied to the exported images. Darktable also has a very intuitive black and white filtering mode (where you apply a virtual colour filter to the front of the lens, and see the results in real time) and some very powerful geotagging features. I’m sold.
It’s not immediately obvious how some of the features work, and it took me a few hours (and some reading of the manual — eek!) to get files to export as I wanted them. It’s not quite perfect yet — the map feature can become unresponsive if you click too much on image icons — but it’s definitely solid enough for my purposes.
Over the last few weeks, I’ve been playing with a few small thermal printers. Meant as POS or information booth printers, they make a diverting project for the lo-fi printing enthusiast. While they all have common features — 58 mm/2¼” paper width, 8 pixel/mm resolution, 48 mm print width, serial connection — they all have their quirks. You may have seen these sold as the Adafruit Mini Thermal Receipt Printer or Sparkfun’s Thermal Printer, but there are many others. I’m going to write more on interfacing these directly to Raspberry Pi, Arduino, and (if I can navigate the documentation) a CUPS driver.
For now, I’m just leaving you a list of things I’ve found helpful for the DP-EH600 and 701 printers. Note that the similar-looking BTHT-v6 printer uses a completely different command set.
Replacement paper is sold as 2¼” — 30′. Staples have a box of 30 rolls for under $25 (item 279096, not on their website). Longer rolls don’t fit.
You’ll need a USB→TTL Serial adapter, preferably one with DTR control. I use one from JY-MCU. In a pinch, you can use a simpler Debug / Console Cable for Raspberry Pi, but you risk serial overruns and dodgy results. Remember that RX on the adapter goes to TX on the printer, and vice versa.
A good solid power supply is needed; these printers draw ~8 W when printing. Some printers only support 5 V (for which a 3 amp adapter would be ideal), others 5-9 V. The higher voltage makes text printing faster. You can’t drive these directly from your Raspberry Pi/Arduino power supply.
Linux serial ports are set to some defaults which may have been historically useful, but now corrupt 8-bit data. A trick I picked up here is to first issue the command stty -F /dev/ttyUSB1 0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
which clears all settings, then set the device up as you need it: stty -F /dev/ttyUSB1 speed 9600 raw cs8
(Most of these printers default to 9600 baud. Your device may be called something different to ttyUSB1.)
I’ve written a couple of Python driver stubs which take an image and produce the relevant binary output:
scruss / esc-pos-image.py – prints an image as a single command. May not work on the SparkFun printer. Does not work on the BTHT-v6.
scruss / esc-pos-image-star.py – prints the image in 24 pixel deep bands. Can sometimes cause visible gaps in the printout, but will work on almost all printers, except the BTHT-v6.
These Python libraries also work, as long as you address the printer properly (right device, right speed):
python-escpos – image support limited to 255 pixels high, for some reason.
Reed Zhao (of Tangram Software) lent me a couple of different printers for testing after I bought a different one from him. He’s put a lot of work into sourcing these printers direct from the manufacturers. Thanks, Reed! NB: Reed doesn’t sell printers any more. Try eBay.
BTHT-V6 manual (Chinese) — probably just enough info to follow the wiring and some of the basic control codes. Looks like the one I had was 5V only, so needs a 5V 3A power supply.
Imagine there’s a really nicely arranged screenshot of elementary OS here. You know, browser arranged just so, dock showing shiny icons, and a coy little dropdown showing that I’m playing music that’s faaaar hipper than you’ll ever be. Got that image? Good. ‘Cos I just spent a ½-hour setting it up, then deleted it in a second of unthought when I cleaned up the elementary OS VM from VirtualBox. Aargh!
elementary OS is a very pretty Ubuntu/Debian distro. It has a very strong visual identity, and is designed and managed by a very small group. This rigidity may annoy the seasoned Linux user, but will likely work in a more logical way if you’re used other OSs. You won’t face jarringly mismatched user interface elements, as still happens with Ubunty/Unity. Linux UX allows too much choice, so you’re never sure which options do what at any given time.
(F’rinstance: Ctrl+Q used to quit programs. Now, Ubuntu wants us to use Ctrl+W, the old close-the-window command. Some programs no longer quit with Ctrl+Q, so you’re left with an awksmash of Ctrl+Q_no-I-meant_W. Don’t make me think!)
A couple of things put me off elementary OS:
You can’t put files on the desktop. In an effort to be tidy, eOS forbids you putting the stuff you’re working on in the place you’ll see it. This is a major annoyance, but worse things are coming.
We had an unscheduled overnight stop in East Lansing last week, and I took the chance to visit the MSU Surplus Store. For $15, they had HP48G calculators, seemingly unused:
They’re maybe not the quickest (the 4 MHz Saturn processor chugs sometimes, and wanders off to clean up memory when it feels like it), the display is downright chunky these days, but they have everything that a scientific calculator should have. The keys have a good action. It just works. Yes, your smartphone has hundreds of times the processing power, but it’s not specialized to the task. The HP48 is.
If you’re feeling really nerdy, you can run an HP48 (a GX, not the G which I have) under Linux using x48. Jeff has some useful tips on installing x48 on newer ubuntu versions (though you don’t have to do the font thing under Ubuntu 13.10).
Building it is a small matter of ./autogen.sh ; ./configure ; make ; sudo make install. To run it, you’ll need to install the GX ROM image to ~/.hp48. The first time you run it, I’d recommend running it from the terminal with:
Oh man, Protext! For years, it was all I used: every magazine article, every essay at university (all two of them), my undergraduate dissertation (now mercifully lost to time: The Parametric Design of a Medium Specific Speed Pump Impeller, complete with spline-drawing code in HiSoft BASIC for the Amiga, is unlikely to be of value to anyone these days), letters — you name it, I used Protext for it.
I first had it on 16kB EPROM for the Amstrad CPC464; instant access with |P. I then ran it on the Amiga, snagging a cheap copy direct from the authors at a trade show. I think I had it for the PC, but I don’t really remember my DOS days too well.
The freeware version runs quite nicely under dosemu. You can even get it to print directly to PDF:
In your Linux printer admin, set up a CUPS PDF printer. Anything sent to it will appear as a PDF file in the folder ~/PDF.
Add the following lines to your ~/.dosemurc: $_lpt1 = “lpr -l -P PDF” $_printer_timeout = (20)
In Protext, configure your printer to be a PostScript printer on LPT1:
The results come out not bad at all:
Protext’s file import and export is a bit dated. You can use the CONVERT utility to create RTF, but it assumes Code page 437, so your accents won’t come out right. Adding \ansicpg437 to the end of the first line should make it read okay.
Colour management is good. It means that what I see on the screen is what you meant it to look like, and anything I make with a colour-managed workflow you’ll see in the colours I meant it to have. (Mostly.) You can spend a lot of money to do this professionally, but you can also get most of the benefits for about $125, if you’re prepared to do some fiddly stuff.
The most important part is calibrating your display. Hughski’s ColorHug (which I’ve mentioned before) is as close to plug-and-play as you’ll get: plug it in, and the colour management software pops up with prompts on what to do next. Attach the ColorHug to the screen (with the newly supplied stretchy band), let it burble away for 10–20 minutes, and the next time you log in, colours will be just right.
Calibrating the scanner on my Epson WorkForce WF-7520 was much more work, and the process could use optimization. To calibrate any scanner, you need a physical colour target to scan and compare against reference data. The cheapest place to get these (unless there was one in the box with your scanner) is Wolf Faust’s Affordable IT 8.7 (ISO 12641) Scanner Colour Calibration Targets. If there are a bunch of likeminded folk in your area, it’s definitely worth clubbing together on a group buy to save on shipping. It’s also less work for Wolf, since he doesn’t have to send out so many little packages.
(I’ve known of Wolf Faust since my Amiga days. He produced the most glorious drivers for Canon printers, and Jeff Walker produced the camera-ready copy for JAM using Wolf’s code. While Macs had the high end DTP sewn up back then, you could do amazing things on a budget with an Amiga.)
The target comes packed in a protective sleeve, and along with a CD-R containing the calibration data which matches the print run of the target. Wolf makes a lot of targets for OEMs, and cost savings from his volume clients allow him to sell to individuals cheaply.
Scanning the thing without introducing automatic image corrections was the hard part. I found that my scanner had two drivers (epson2 and epkowa), the latter of which claimed to support 48-bit scanning. Unfortunately, it only supports 24-bit, like the epson2 driver, so whichever I chose was moot. I used the scanimage command line tool to make the scan:
which looks, when reduced down to web resolution, a bit like this:
It looks a lot darker than the physical target, so it’s clear that the scanner needs calibrating. To do this, you need two tools from the Argyll Colour Management System. The first creates a text representation of the scanned target’s colour patches:
I didn’t quite need to add that much metadata, but I could, so I did. The resultant ICC file can be used to apply colour calibrations to scanned images. Here’s the target scan, corrected:
(I’ve made this a mouseover with the original image, so you can see the difference. Also, yes, there is a greasy thumb-print on my scanner glass near the bottom right, thank you so much for noticing.)
I used tifficc from the Little CMS package to apply the colour correction:
There are probably many easier, quicker ways of doing this, but this was the first thing I found that worked.
To show you a real example, here’s an un-retouched scan of the cover of Algrove Publishing‘s book “All the Knots You Needâ€, scanned at 75 dpi. Mouseover to see the corrected version:
(Incidentally, there are two old but well-linked programs that are out there that purport to do scanner calibration:Â Scarse and LPROF. Don’t use them! They’re really hard to build on modern systems, and the Argyll tools work well.)
The last part of my workflow that remains uncalibrated is my printer. I could make a target with Argyll, print it, scan it, colour correct it, then use that as the input to colprof as above. I’m suspecting the results would be mediocre, as my scanner’s bit depth isn’t great, and I’d have to do this process for every paper and print setting combination. I’d also have to work out what magic CUPS does and compensate. Maybe later, but not yet.
I have an Epson WorkForce WF-7520, and I really like it: excellent built-in duplex large format scanner with ADF, CIFS network storage, giant paper bins, photo quality printing up to 330×482 mm, only slightly expensive print cartridges… Under Linux, though, it’s not so well behaved, especially if you want to print on large format paper. This is the workaround I developed:
Put the B-size/11×17″ paper in Tray 1 (the upper one), and the Letter paper in Tray 2. This, unfortunately, matters — the driver that can print large format can only access the upper tray. On the setup menu on the printer console, tell the printer which tray holds what size of paper.
Install the epson-inkjet-printer-escpr driver; it should be in the standard Ubuntu repos. Define a printer (wf7520-lf, for example) that uses this driver. Set the paper size to “US B 11 x 17 in”.
Ensure that the lsb and lsb-printing packages are installed: sudo apt-get install lsb lsb-printing
Download and install the non-free epson-201115w driver from the EPSON Download Center. Define a printer (I used wf-7520 for the name) using this driver, making sure that the correct PPD (epson-inkjet-printer 1.0.0-1lsb3.2 (Seiko Epson Corporation LSB 3.2)) is used. Set it up to use Letter paper, and (important!) set the source to Paper Cassette 2. You might want to make this printer the system default.
To print to large format, use the command:
lp -d wf7520-lf -o PageSize=USB file.pdf
To print regular size, just send the job to the wf-7520 device.
wf7520-lf.ppd — this is the large-format driver I use. Compare it with the epson-inkjet-printer-escpr PPD in the Debian code repo, and you’ll find all references to many paper sizes gone from it. Hmm …
Copying PPDs from one driver to another may not work, but you’ve likely nothing to lose.
Update 2015-09: Better yet, install Infinality. It makes font rendering pretty.
Switching back to Linux from Mac is still a process of ironing out minor wrinkles. Take, for example, this abomination (enlarged to show texture):—
… No, I’m not talking about Mr Paul’s antics (or the typo in the TP post, either), but the horrid non-matching ligatures (‘attack’, ‘flubbed’, ‘targeting’) in a sea of blocky text. Almost every programme I was running had this problem. Mouse over the image to see how it could look if you apply this easy fix.
Create (or edit) the file ~/.fonts.conf ~/.config/fontconfig/conf.d, and add the following lines: