If I’m gonna be stuck in a hotel room with a 3d printer, at least I could prototype some assistive tech

If I’m gonna be stuck in a hotel room with a 3d printer, at least I could prototype some assistive tech

If I’m gonna be stuck in a hotel room with a 3d printer, at least I could prototype some assistive tech

Instagram filter used: Lo-fi

View in Instagram ⇒

Save money, buy misery: cheap STM32 boards

(I’m still writing this. It will change over time.)

Use an STM32 Blue Pill or Black Pill micro-controller board”, they said. “So cheap, so powerful”, they said. “You’ll love it”, they said.

Dear Reader, none of the above turned out to be true.

For some time now I’ve been looking for a cheap, USB HID micro-controller board that is somewhat more flexible than the ATMega32U4 (Arduinos Leonardo, Micro and Pro Micro; also the impossibly smol Atto) and yet not quite as flexible as the let’s-accidentally-overwrite-our-accessibility-code-with-the-holiday-snaps CircuitPython boards from Adafruit. And for a while it looked like the STM32 boards might do it: they’ve got a 72 MHz ARM Cortex-M3 with at least 64 KB of Flash and 20 KB of SRAM and they’re under $5. Yay?

Not quite. There are three main problems with the STM32 boards that get in the way of inexpensive electronic nerdery.

1: They may not actually be STM32 chips

Slightly grotty photos follow. One day I’ll get a better USB microscope.

First, the chip from a “Black Pill” board bought recently:

flux blobs aside, this is clearly marked STM32 F103C8T6

Compare with a “Blue Pill” bought last year:

the very tentatively marked CS32F 103C8T6 and its possibly fake CKS (“China Key System”) logo

Knock-offs are rife in the cheap end of the market, and at least this chip is honest enough to say that it’s not from STMicroelectronics. While it may be possible to program these things with some heroic faffing about, consider balancing the effort required versus the time cost of doing so.

2: They may not have working USB

moar later (about the Blue Pill’s incorrect resistor)

3: The documentation is everywhere and nowhere and Google is not your friend

even moar later (about a very dedicated amateur’s hosting of the project documentation becoming too successful for him to afford)

(Huge thanks to Andrew Klaassen who provided me his notes for getting some of these boards at least able to run Blink under Linux.)

Schotter on a Tek 4010

Georg Nees’ Schotter, reproduced on a simulated Tek4010 display

Georg Nees (1926–2016) was a pioneer of generative art. His piece “Schotter” (gravel) from 1968 displayed a rectangular array of squares with the position of each square becoming more random as the piece progressed.

The BASIC code for this video is based on Processing code by Jim Plaxco, http://www.artsnova.com/

The Tektronix 4010 display simulator is by Rene Richarz, https://github.com/rricharz/Tek4010

The BASIC interpreter with Tektronix graphics support is Matrix Brandy BASIC maintained by Michael McConnell, https://github.com/stardot/MatrixBrandy

(Higher-quality video at Georg Nees’ “Schotter”, reproduced on a simulated Tek4010 display at YouTube.)

  100 REM Georg Nees "Schotter" reproduction - scruss, 2019-11
  110 REM based on Processing 3 code by Jim Plaxco, www.artsnova.com
  120 :
  130 scrn_wd% = 2048: REM fixed screen size, unlike Processing
  140 scrn_ht% = 1560
  150 columns% = 12
  160 rows% = 22
  170 sqsize% = FN_min(scrn_wd% / (columns% + 4), scrn_ht% / (rows% + 4))
  180 padding% = 2 * sqsize%
  190 randstep = 0.22
  200 randsum = 0.0
  210 randval = 0.0
  220 dampen = 0.45
  230 :
  240 SYS "Brandy_TekEnabled", 1
  250 A$=GET$: REM PLOT 4, 0, 0: PLOT 5, 0, 0
  260 FOR y% = 1 TO rows%
  270   randsum = randsum + (y% * randstep)
  280   FOR x% = 1 TO columns%
  290     randval = RND(1) * (2 * randsum) - randsum
  300     PROC_square((scrn_wd% / 2) - (sqsize% * columns% / 2) + (x% * sqsize%) - (sqsize% / 2) + INT(randval * dampen), scrn_ht% - (padding% + (y% * sqsize%) - (sqsize% / 2) + INT(randval * dampen)), sqsize%, randval)
  310   NEXT x%
  320 NEXT y%
  330 PLOT 4, 0, 0: PLOT 5, 0, 0
  340 END
  350 :
  360 DEF PROC_square(cx%, cy%, side, angle)
  370 LOCAL r, i%, pm%
  380 pm% = 4: REM plot mode - move = 4, draw = 5
  390 r = (side / 2) / (SQR(2) / 2)
  400 FOR i% = 0 TO 4
  410   PLOT pm%, cx% + r * COS(RAD(angle + i% * 90 + 45)), cy% + r * SIN(RAD(angle + i% * 90 + 45))
  420   pm% = 5
  430 NEXT i%
  450 :
  460 DEF FN_min(a%, b%) IF a% < b% THEN =a% ELSE =b%

All of the Argos Catalogues

The 1974 Argos catalogue has slide rules

A little slice of UK consumer history: The Argos Book of Dreams, scanned Argos catalogues from 1974 to present. (Via b3ta)

It seems that all (?) of these are also up at the Internet Archive. They’re a little harder to find, and some don’t have previews. A decent search for one uploader’s history is “retromash”, though “argos catalogue” finds more. The Book of Dreams site seems only to have autumn/winter catalogues, while the Archive has the spring/summer ones too.

Taxman – a BASIC game from 1973

Back in 1973, the future definitely wasn’t equally distributed. While in Scotland we had power cuts, the looming three-day week and Miners’ Strike I, in California, the People’s Computer Company (PCC) was giving distributed computer access, teaching programming and publishing computer magazines. I don’t think we got that kind of access until (coincidentally) Miners’ Strike II a little over 10 years later.

taxman drawn image from People's Computer Company magazine (1973) , with "1 for you 19 for me" quote from The Beatles song "Taxman"
flares? platforms? centre parting? bow tie? It was 1973 after all

But the People’s Computer Company magazine archive is a sunny thing, overfilled with joyful amateur enthusiasm and thousands of lines of code fit to make Edsger Dijkstra explode. Of course it was written for the local few who had access to mainframes and terminals, but it hardly seems to come from the same world as the dark evenings in Scotland spent cursing the smug neighbours’ house with all the lights on, their diesel generator putt-putting into the night.

Lots of these games from the PCC era are forgettable now. The raw challenge of guessing a number on a text screen has paled somewhat in the face of 4K photo-realistic rendering. One game I found is still a little challenging, at least until you work out the trick of it: Taxman (or as the authors tried to rename it later, Factor Monster). Here’s a tiny sample game transcript:

Hi, I'm the taxman
Do you want the regulations?
(1=Yes, 0=No)? 0

How many numbers do you want
in the list? 6

The list is: 1  2  3  4  5  6 

You take? 5
Your total is  5 
I get  1 
My total is  1 

New list:  2  3  4  6 

You take? 6
Your total is  11 
I get  2  3 
My total is  6 

New list:  4 
I get  4 
because no factors of any number
are left.
My total is  10 

You  11  Taxman  10 
You win !!!

Again (1=yes, 0=no)?

Seems I sneaked a lucky win there, but it’s harder than it looks. The rules are simple:

  • Start with a list of consecutive numbers
  • You choose a number, but it has to have some factors in the list
  • The taxman (or the factor monster, a concept I much prefer as it doesn’t reinforce the Helmsley Doctrine) takes all the remaining factors of your number from the list
  • You get to choose a number from the list, which is now missing your previous choice and all of its factors, and repeat
  • Once the list has no multiples of any other number, the taxman/FM takes the rest
  • The winner is whoever has the largest sum.

For such a simple game (or perhaps, such a simple me) the computer wins surprisingly often. Since I find it fun to play, I thought I’d share the 1973 love as much as possible by porting to all of the BASIC dialects that I knew.

Plain text BASICtaxman.bas —runs under interpreters such as bas. Almost verbatim from the 1973 publication. May not allow you to play again on some interpreters; you might want to try my slightly rearranged 40 column version that should run on systems that don’t allow a variable to be dimensioned twice.

taxman on Amstrad CPC: starting with numbers 1-6, player has taken 4, so taxman takes 1 & 2, leaving 3, 5 and 6
taxman on Amstrad CPC: how BASIC programs look to me, yellow on blue 4 lyfe

Amstrad CPC Locomotive BASICtaxman.dsk — or as I call it, BASIC. 40 columns yellow on blue is how BASIC should look.

taxman on BBC Micro, showing games tart for 1-6. Adjacent numbers are a full column apart
taxman on BBC, Mode 7: dig the weird spacing

BBC BASICtaxman.ssd — for all the boopBeep fans out there. You can actually play this one in your browser, too. Yes, the number formatting is weird, but BBC BASIC was always its own master.

taxman: Commodore 64 showing the instructions
taxman on C64

Commodore 64taxman.prg — very very upper case for this dinosaur of a BASIC.

taxman running on Apple II: loaded from disk, started with 6 numbers
taxman running on Apple II

Apple II AppleSoft BASICTAXMAN.DSK — lots of fiddling with import tools and dialect weirdness because Apple.

taxman: end of game on ZX spectrum
taxman: end of game on ZX spectrum

ZX Spectrum (Sinclair BASIC)taxman.tap — 32 columns plus a very special dialect (no END, GOTO and GOSUB are GO TO and GO SUB, …) meant this took a while, but it was quite rewarding to get going.

taxman - BASIC program listing on ZX-81 running under sz81 emulator, Linux window borders visible
Taxman on ZX81: more SCROLLs than the Dead Sea

Sinclair ZX81 (16 K) — taxman.p — this one was a fight. The ZX81 didn’t scroll automatically, so you have to invoke SCROLL before every newline-generating PRINT or else your program will stop. For some reason this version gets unbearably slow near the end of long games, but it does complete.

Nionics Atto – Arduino on a dime #smol

Nionics Atto – Arduino on a dime #smol

Nionics Atto – Arduino on a dime #smolUnfortunately — and you can see it here on the completely dry five USB pins — the soldering on the USB connector of the Nionics Atto I just got wasn’t good. When I soldered on the weentsy pitch headers the heat of the iron melted the one joint that was holding the connector on. It’s impossible to repair without thermal rework equipment.

I really wish that Nionics had pre-soldered those 1.27 mm / 1⁄2₀″ headers as it was a nice board. Since it breaks out only a few of the ATmega32U4‘s pins, instead of a single LED it has an RGB LED for an indicator. Otherwise, program it like an Arduino Leonardo.

Instagram filter used: Lo-fi

View in Instagram ⇒

crude lithophane with OpenSCAD

small lithophane made from photographic portrait of Muhammad Ali in 1967. World Journal Tribune photo by Ira Rosenberg (source)

After reading I didn’t know lithophanes were so simple. They were hiding in Cura all along. : 3Dprinting, I thought I’d give OpenSCAD a shot at generating a lithophane image. It did not badly at all, considering this was my first try.

This isn’t a fast process and generates huge STL files, but it’s fairly simple. Here’s how I did it:

  1. Download your image. I used this 479 × 599 pixel preview.
  2. Convert your image to PNG, preferably grey scale
  3. Run it through the OpenSCAD script below, changing the parameters according to the instructions
  4. Render it in OpenSCAD (slow)
  5. 3D print the resultant STL in 0.05 mm layers (very slow)
//  somewhat rough OpenSCAD lithophane - scruss, 2019-10
 infile  = "479px-Muhammad_Ali_NYWTS.png";    // input image, PNG greyscale best
 x_px    = 479;  // input image width,  pixels
 y_px    = 599;  // input image height, pixels
 z_min   = 0.8;  // minimum output thickness, mm
 z_max   = 3;    // maximum output thickness, mm
 y_size  = 50;   // output image height, mm
 // don't need to modify anything below here
 translate([0, 0, z_max])scale([y_size / y_px, y_size / y_px, (z_max - z_min)/100])surface(file = infile, invert = true);
 cube([x_px * y_size / y_px, y_size, z_min]);

I used Makerbot warm white PLA. It looks decent at viewing distance, but close up it’s a bit stringy.

closeup of lithophane eye

There are better packages, but OpenSCAD does this better than I expected.