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 …
You could say I overthought this “minimal” ATmega328 µcontroller build: switchable USB/external power, reset button, optional D13 LED for your blink() needs, high efficiency LM2940 LDO voltage regulator …
In the age of cheap 32-bit microcontroller boards available for a couple of dollars, there’s absolutely no reason to build one of these semi-custom 8-bit Arduino clones. I did it because I had all (well, nearly all —the 0.33µF tantalum cap needed on the output side of the the regulator I bought in) the bits in the house, and I wanted to see how few connections a modern microcontroller really needed. Once I’d seen just how few, I thought I’d make this thing easy to use … and got a bit carried away.
I do kind of miss the diversity of form in the µc board market these days. Everything looks like an Arduino now. Tiny variants like the Solarbotics Ardweeny kept creative interest up. But with boards and chips so cheap these days, why bother?
BlockTwo is a spectacularly ugly font mostly for playing about with 3D intersections in OpenSCAD. Not recommended for any but the most extreme display usage. Coverage is only A-Z caps, 0-9, heart and block.
I want to make an edge-lit numeric display. These were a common technology before numeric LEDs were available. They use 10 illuminated slides to display individual numbers. Here’s my first try at the display:
The 74LS42 logic chip (4-Line BCD to 10-Line Decimal Decoder) seems a likely candidate to drive such a display. You feed it a 4-bit binary-coded decimal input, and the chip activates one of ten outputs. It’s a low-voltage version of the old 7441 chip used for driving Nixie tubes. Here’s what I got working as a demo of the 7442, driven by an Arduino:
Because the 7442 will only activate one output at a time, it’s okay to use a single current-limiting resistor for all ten output LEDs. The chip also uses active low outputs: the outputs go from high to low when activated. The negative side of each LED goes to an output pin, and the chip sinks current when an output is selected, lighting the LED.
The components get in the way of seeing the wiring, so here’s another picture from Fritzing with just the wires and the breadboard:
Finally, here’s the Arduino sketch I wrote to drive the chip for the demo video. All it does is cycle through digital outputs 4–7, incrementing a bit every half second.
/*
SeventyfourFortytwo - Arduino demo of a
74LS42 - 4-line BCD to 10-line decimal decoder
Steps through 0-15, two steps per second
Shows the 74LS42's blocking of values 10-15 as invalid
Wiring:
Arduino 74LS42
======== =======
4 - 15 Input A (bit 0)
5 - 14 Input B (bit 1)
6 - 13 Input C (bit 2)
7 - 12 Input D (bit 3)
scruss - 2016-09-23
*/
int n = 0;
void setup() {
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
}
void loop() {
digitalWrite(4, n & 1);
digitalWrite(5, n & 2);
digitalWrite(6, n & 4);
digitalWrite(7, n & 8);
n++;
if (n > 15) n = 0;
delay(500);
}
If you felt really fancy, you could drive the LED inputs through PWM, and come up with just the right of flicker to make this look like a Nixie tube. You should also be able to chain the inputs through some shift registers, too.
That picture might not look much, but it’s doing something rather wonderful. It’s a tiny ESP8266 BASIC script running on a super-cheap ESP8266 wifi module. The code draws a clock that’s synced to an NTP server. ESP8266 BASIC graphic commands are built from SVG, so anything you can draw on the screen can also be saved as a vector graphic:
The runtime includes a simple textarea editor that saves code to the board’s flash:
(and yes, that first line is all you need to set up NTP sync)
Among other features, ESP8266 BASIC has a simple but useful variable display:
I’d picked up a (possible knock-off of a)WeMos D1 ESP8266 board in Arduino form factor a few months ago. The Arduino.cc Software now supports ESP8266 directly, so it’s much easier to program. Flashing the BASIC code to the board was very simple, as I’d noticed that the Arduino IDE printed all of its commands to the console. All I needed to do was download an ESP8266 BASIC Binary, and then run a modified Arduino upload line from the terminal:
ESP8266 BASIC starts in wireless access point mode, so you’ll have to connect to the network it provides initially. Under Settings you can enter your normal network details, and it will join your wifi network on next reboot. I just hope it doesn’t wander around my network looking for things to steal …
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?)
Yup, another highly impractical monospaced font. This one is based on a short-lived 22 segment display made in the early 1980s by Litronix (datasheet).
It’s hard to believe that Paul Carter has been gone ten years. I realized that my original ZX Spectrum BASIC memorial to him had got a bit dusty, in that it ran as an outdated Java applet. So I rewrote the code, and put it here: All the Colours We Have (for Paul Carter).
As Side Door sign v3 seemed to have fallen off, I needed to make a new one. With access to a laser cutter, I can make really permanent things now, so I designed this:
Yes, that’s a pointy thing filled with pointy things (all without thumbs, you’ll notice) and labelled with Cooper Black. Irony, much? Fe!
In order to get the sign to hang correctly, I needed to work out the centroid of the pointy outline. thedatachef/inkscape-centroid: Centroids for Inkscape paths and shapes to the rescue! Well, kinda. First off, the installer had a bug that said a Ruby file was a dependency when the plugin was in Python. So I forked the repo, made the change, tested it, and issued a pull request. So yay, working centroid calculations in Inkscape!
Secondly, the plugin only works well for simple shapes, like these:
But compound shapes? Not so well:
I guess it doesn’t like the negative moments generated by the holes, and does its own thing. Oh well.
My previous adventures with my Sinclair ZX Spectrum 48K in Canada were not resounding successes. I couldn’t get the display to work, and tapes wouldn’t load well, so I’d been using Fuse while the hardware sulked in a cupboard.
I’d previously got a proper power supply (9 V DC, ≥ 1.4 A, centre negative) and bypassed the PAL UHF modulator to give composite video. No television, monitor or converter box that I had tried seemed to give a useful display.
Back in May, Walter Miraglia brought a tiny 7″ composite colour monitor to TPUG‘s Retrocomputing Night. He let me try it with the Spectrum, and it worked very well. Walter said it was an extension monitor for a car DVD player.
I dug around, and found that local surplus clearout store Tech Source Canada had the Philips 7″ portable DVD Player PD7016/37 for $60. This gives you two identical DVD players with composite input. I think my other one will be destined for a Raspberry Pi project somewhere.
To get these monitors running, you’ll need:
a 9–12 V DC power supply able to give ≥ 1 A. I use a regulated supply that gives 9.1 V open circuit and is rated at 2 A. Note that the power connector is slightly smaller than the common 2.1 mm barrel, so you may have to order this one, unless you can solder something up.
A cable like this 3.5mm Stereo to Composite Video + Audio Cable (3 RCA). These are sometimes just called camcorder cables. They use a 3½ mm TRRS jack, and can also — if you don’t mind not quite having the connectors in the right order — work with the composite/audio output of more recent Raspberry Pis. Tech Source had these for under $5.
Connect it up , and — success! Well, slightly qualified success. The screens do not have the greatest resolution, so pixels are slightly smeared together. The screens do have a decently fast refresh, and the whole look is just right. With its colour clash and dot crawl, nobody ever expected great video from the Speccy anyway.
Here are some screen shots taken with my phone, and a couple of pixel-sharp screenshots from Fuse to compare:
Moon Cresta – complete with authentic weird languageMoon Cresta — the same screen from FuseMoon Cresta – nice loading screenManic Miner — a game I am not good atManic Miner – perhaps the (deliberately?) worst game music everDeathchase — OH NOES A TREE!!!!1!! Looks like the Riders of the Big Bikes just lost another memberKnight LoreChuckie EggChuckie Egg from Fuse. We can’t do anything about the attribute clash
So I can now definitely view the screens. Huge thanks to Walter for tipping me off to these DVD players.
[Incidentally, the screens are designed for car use, so don’t stand up properly unless you get creative with some supports. I laser-cut these out of 3 mm plywood:
mini screen feet for 3 mm ply. Cutting template PDF is linked underneath this image
Glue the little sticks on to the flat ends, and they’ll fit into the slots in the back of the monitor. Here are the feet with the sticks fitted:
screen feet with sticks glued in place
There are better-designed feet than these, but they work, mostly.]
I was still having game loading problems. Try as I might, I couldn’t get anything to load reliably. Retrocomputing Stack Exchange came to the rescue, in the shape of mcleod_ideafix’s very helpful answer. If your audio player is running from batteries and you can use a stereo cable, you can convert the normal mono loading audio into stereo with one channel inverted. This gives you effectively double the volume, and works quite well with my audio player, an old Edirol R-1*.
If you want to check your audio levels, sox can also create the 800 Hz header tone used by the Spectrum. Run the output of the command below through the script above, load it onto your audio player and fiddle with the volume until the border flickers steadily:
I was also looking for the games to load fairly quickly. Tapes used to take over three minutes to load, and while retrogaming all is about the experience, I haven’t got time for that. Fuse has some utility programs which will convert a .Z80 game snapshot into an audio file that loads in about 1¼ minutes.
To convert the snapshot to a speed-load TZX tape image:
snap2tzx -o game.tzx -s 3 game.z80
To convert that virtual tape image into audio:
tape2wav -r 16000 game.tzx game.wav
You can then run that WAV file through the stereo/differential script I listed above. Have fun!
I’d tried making several Raspberry Pi Zero enclosures, but none of them quite worked. My needs are pretty simple, but I do need to be able to fit a full 40 pin strain-relieved (possibly keyed) header into the device while keeping questing fingers and dropped conductors off the circuit board.
Conserves material: The Coo~Coo uses just under 80 × 80 mm of 3 mm ply or acrylic, plus four nylon machine screws, nuts and washers.
Takes a full-sized GPIO header with a little headroom.
Provides edge protection for the µSD and connectors.
Has only a single cut layer, with no time-wasting engraved rasters.
Needs only simple tools to make: really only needs diagonal cutters to snip off half of the nylon screw heads. Needle-nose pliers might help too, as there are some fiddly small parts.
Free as in CC0. Yup, since this is derived from the Raspberry Pi Foundation’s copyrighted drawing, my modifications didn’t really add anything of value. Thus I waive all copyright and related or neighbouring rights on my additions:
To the extent possible under law, Stewart C. Russell has waived all copyright and related or neighbouring rights to the “Coo~Coo†Raspberry Pi Zero Case. This work is published from: Canada.
Why the odd “Coo~Coo†name? Well, look at the pattern of spacer washers and half-spacer washers:
To save material, I arranged these washers inside the GPIO cutout. I realised that I could spell COO~COO. It’s even clearer on the cutting document:
Coo~Coo — PDF for cutting is linked under the image
Update: here’s a revised path that cut well with acrylic and probably will work slightly better on plywood, too: coo-coo-rpi_zero-acryl.zip
(If you do use acrylic, let me introduce you to one of the marvels of backing-paper removal: d-limonene. This fruity solvent — present in products like Goo Gone — causes backing paper to slough off with only a few minutes’ soaking. It washes off to a clean shine with water and dish soap/washing up liquid. I have just saved you fingernails from certain damage!)
The cutting path in the PDF could use a little clean up if you want to try this design in acrylic. The base of the design has been flipped so that any laser flare will be hidden inside the case.
You’ll need four M2.5 or M3 nylon screws of 20 mm length, plus 8 washers and 4 nuts. M3 screws of this length are easier to get, but the mounting holes in the Raspberry Pi Zero are only 2¾ mm in diameter. You can thin the M3 screws down slightly by lightly twisting them inside a piece of folded fine sandpaper. You’ll still have to push them through the Raspberry Pi Zero circuit board with a little force, though.
Cutting & Assembly Instructions
If you have it, place some fine wire mesh or sacrificial heavy card-stock between the laser cutter honeycomb bed and the plywood. The spacer washers are just the right size to fall through the cutter bed and be lost inside the discard hopper.
Cut the piece as normal.
Remove the work from the laser cutter. Masking tape applied over the washers will stop them falling out.
Take the top piece, and thread the other two screws through the holes by the HDMI and PWR labels.
(It may be easier to do these one at a time)
Place two of the full spacer washers over each screw.
Push the screws through the Raspberry Pi Zero board. M2.5 screws won’t need any force, but M3 will need some coaxing, possibly even cajoling.
Place a nylon washer on each of the two screws under the Raspberry Pi Zero board.
Take the base and flip it horizontally so the screw holes match the top.
Very loosely attach the nuts to each of the screws.
(You’ll need the slack to fit the top two screws and their C-shaped spacers)
Feed the top two screws through the half-holes by the GPIO cutout in the case and the Raspberry Pi Zero board. Again, coaxing and/or cajoling may be required if you used M3 ones.
Put nylon washers over the screws between the Raspberry Pi Zero board and the base.
Very loosely attach the nuts to the top two screws.
(This is the fiddly bit) Stack two of the half spacers and put them on each screw. You need to get the screws tight enough to just grip the spacers against the case, but not too much or you won’t be able to align them to let the GPIO connector fit in the gap. Tightening the screws at the HDMI and PWR ports can help with this, too.
Nip off half of the heads from two of the nylon screws. This will allow the GPIO connector to fit easily.
Tighten all the screws (finger tight is fine) and make sure the trimmed heads align with the edge of the GPIO cutout.
Raspberry Pi Zero in Coo~Coo case showing GPIO and spacers
The new Raspberry Pi Zero with camera connector should also fit, but I don’t have one to test it.
A mono-spaced font family derived from the HP/Siemens/Litronix DL-2416 17-segment alphanumeric 17 segment LED display matrix.
Design size: appx 19 pt
For maximum fidelity, should be displayed/printed red to match the original’s ~640 nm wavelength. This corresponds to RGB #ff2100
Weights
Regular only.
Note that this has a very slight skew (5°) built in.
Coverage
ASCII only, upper case.
Author
Stewart C. Russell – http://scruss.com/blog/
Licence
Dual-licensed CC0/WTFPL (srsly)
All of the segments. I’ve stashed this glyph at character code U+007f so you can make up new ones.
also: numbers.zip — just 00-99 as PNG images, after this, made with Pango, like this:
for f in {00..99}
do
pango-view --no-display --background=black --dpi=112 --align=right --foreground='#ff2100' --font='TwentyfourSixteen Regular 48' --hinting=full --output="$f.png" -t "$f"
done
Pen plotters were pretty expensive and complex pieces of electromechanical equipment. While they often earned their keep in the CAD office, they also had a function that’s almost forgotten: they could be used as input devices, too.
As a kid, we sometimes used to drive past the office of Ferranti-Cetec in Edinburgh. They specialized in digitizers: great big desk or wall mounted devices for capturing points from maps and drawings. Here’s one of their 1973 models:
While the technology and size have changed a bit, these huge bits of engineering kit are the ancestors of today’s track pads and touch screens.
Realizing that their plotters had very precise X-Y indexing and that they had two-way communications to a computer, HP made a drafting sight that fitted in place of a pen on their plotters:
HP drafting sight, part no 09872-60066.
This is a very pleasing piece of kit, all metal, thick plastic and polished optical glass. They show up on eBay occasionally, and aren’t cheap. With a bit of coercion, it fits into my HP plotter like this:
Drafting sight in HP7470A plotter
The image is very bright and clear:
Drafting sight near an axis labelDrafting sight over a point, showing cursor dot
If one has a digitizing sight, one needs to find something to digitize post haste. I’m sure everyone can sense the urgency in that. So I found this, a scan from my undergraduate project writeup (centrifugal pump impeller design ftw, or something), which was probably made on an Amiga or Atari ST:
It’s a graph, with pointy bits on it
I printed this as large as I could on Letter paper, as it’s the only size my HP7470A plotter can take. Now all it needed was a small matter of programming to get the data from the plotter. Here’s a minimally-useful digitizer for HP and compatible serial plotters. Although I ran it on my little HP grit wheel plotter attached to a Raspberry Pi, I developed it with my larger Roland plotter. The only fancy module it needs is pySerial.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# a really crap HP-GL point digitizer
# scruss - 2016
from time import sleep
from string import strip
import serial
ser = serial.Serial(port='/dev/ttyUSB1', baudrate=9600, timeout=0.5)
lbl = ''
points = []
labels = []
k = 0
retval = 0
ser.write('DP;') # put in digitizing mode
while lbl != 'quit':
ser.write('OS;')
ret = strip(ser.read(size=5), chr(13))
print ('Retval: ', ret)
if ret != '':
retval = int(ret)
if retval & 4: # bit 2 is set; we have a point!
print ('Have Point! Retval: ', retval)
retval = 0
ser.write('OD;')
pt = strip(ser.read(size=20), chr(13))
print ('OD point: ', pt)
lbl = raw_input('Input label [quit to end]: ')
points.append(pt)
labels.append(lbl)
k = k + 1
ser.write('DP;') # put in digitizing mode again
sleep(1)
ser.close()
f = open('digit.dat', 'w')
for i in range(k):
f.write(points[i])
f.write(',')
f.write(labels[i])
f.write('\n')
f.close()
In the unlikely event that anyone actually uses this, they’ll need to change the serial port details near the top of the program.
The program works like this:
Move the drafting sight to the point you want to capture using the plotter’s cursor keys, and hit the plotter’s ENTER key
Your computer will prompt you for a label. This can be anything exceptquit, that ends the program
When you have digitized all the points you want and entered quit as the last label, the program writes the points to the file digit.dat
I didn’t implement any flow control or other buffer management, so it can crash in a variety of hilarious ways. I did manage to get it to work on the lower trace of that graph, and got these data:
The first two columns are X and Y, in HP-GL units — that’s 1/40 mm, or 1/1016 inches. The third column will always be 1 if you have the sight down. The last columns are the label; if you put commas in them, opening the file as CSV will split the label into columns. I used it to fudge axis points. You’ll also note that the last three lines of data are my valiant attempts to quit the program.
Assuming the axes are not skewed (they are, very slightly, but shhh) some simple linear interpolation gives you the results below:
(For prettier things to do with plotter digitizing commands, Ed Nisley KE4ZNU has made some rather lovely Superformula patterns)
If you don’t have a plotter, or even if you do and you don’t have hours to waste mucking about with Python, obsolete optics and serial connections, Ankit Rohatgi’s excellent WebPlotDigitizer (or Engauge, as I found out when this article hit HackerNews in 2021) gets numbers out of graphs quickly. It handles all sorts of graphs rather well.
Update, 2025: eek, but WebPlotDigitizer is now login-only and has been infested by AI shite. Run away now, run away fast … or try to find an old mirror online, such as WebPlotDigitizer at utk.edu.
A couple of months back at the GTALUG Graphics session, someone asked if Inkscape – the 2D vector graphics workhorse that everyone seems to use – could be scripted. We pretty much said that it couldn’t. Recently, I found out that it does support a limited form of scripting, and wish to pass this on.
The key to it is understanding Inkscape’s command verbs. These can be listed using:
inkscape --verb-list
These verbs map to Inkscape commands, and often have names linked to the menu they live in (such as “FileQuit†doing what you’d expect).
I had a task I had to repeat on many files: convert all the stroked lines to filled paths. You’d need to do this if you are laser engraving a simple drawing, but there are other applications for this too. Here’s a command that would do this for all objects in a drawing, and overwrite the input file:
Selects everything, and ungroups all objects (×3, to break up most nested groups);
Selects everything, and converts all objects to paths (so text, circles, polygons, spirals become paths, the lowest-level SVG object);
Selects everything, and combines everything into one path;
Selects everything, and converts all strokes to filled paths (so a two node straight line 1 mm wide would become a four node filled rectangle 1 mm thick);
Overwrite the input file, close it, and quit.
The process has some disadvantages:
It opens a window everytime. You can’t execute verbs without the GUI opening.
You can’t have another copy of Inkscape open while you do this.
Realistically, you can’t really do anything at your computer until this is done, as it’s popping up windows and shifting focus like crazy. (ssh types can say “heh!†in a smug manner now)
You can’t set parameters to verbs.
It will overwrite the input file.
It clogs up your “File / Recent†menu with all of the files you scripted.
Following on from FifteenTwenty, I made a hairline/single stroke version of the font especially for CNC use. This is a slight misuse of the OpenType format, but if you’re plotting/CNCing/laser cutting, the filled paths of standard fonts don’t work so well. Single-line (or stroke) fonts used to be possible in PostScript — the version of Courier shipped with early Apple LaserWriter printers was composed of strokes, rather than filled paths — but have fallen out of favour. If you have a device with a defined tool width, it’s better to let the tool make the width of the mark/cut. Here’s the hairline font plotted with a 0.7 mm pen to illustrate what I mean:
This font is almost invisible on screen or on a regular printer, so I don’t recommend installing it unless you have specific CNC/plotting needs. Please note that the font will cause your device to follow the tool path of each letter twice.
Update, September 2016: this font was officially squee‘d over by Josh “cortex” Millard on the Metafilter Podcast #120: Hard Out There For A Nerd. I had the great pleasure of meeting Josh at XOXO 2016, too.
The Commodore 1520 was a tiny pen plotter sold for the Commodore 64 home computer. It looked like this:
I never owned one, but it seems it was more of a curiosity than a useful product.
From a nerdy point of view, however, this device was rather clever in that it packed a whole plotter command language, including a usable font, into 2048 bytes of ROM. Nothing is that small any more.
Based on my work with the Hershey font collection, I thought it would be fun to extract the coordinates and make a real OpenType font from these data. I’m sure others would sense the urgency in this task, too.
Since Commodore computers used a subset of ASCII, there’s a barely-usable set of characters in this first release. Notable missing characters include:
U+005C \ REVERSE SOLIDUS
U+005E ^ CIRCUMFLEX ACCENT
U+0060 ` GRAVE ACCENT
U+007B { LEFT CURLY BRACKET
U+007C | VERTICAL LINE
U+007D } RIGHT CURLY BRACKET
U+007E ~ TILDE
I’ll get to those later, perhaps.
Huge thanks to all who helped get the data, and make the bits of software I used to make this outline font.
(Note: although the Project 64 Reloaded contains some extraction code to nominally produce an SVG font, it doesn’t work properly — and SVG fonts are pretty much dead anyway. I didn’t base any of my work on their Ruby code.)