

Model: Moose Head for Materio3D by Morena Protti (modified)
Clear PLA with manual colouring using ShinHan Touch markers
Model: Moose Head for Materio3D by Morena Protti (modified)
Clear PLA with manual colouring using ShinHan Touch markers
For it-seemed-like-a-good-idea-at-the-time reasons, I’ve ended up with a couple of tubes of the big dome LEDs. A tube is a lot; something over 20 pieces. Oh well, I’ll find uses for them eventually.
It seems these are LEDTronics 806 Series ‘Super Intensity 20mm Big Dome 6-Chip LEDs’. The datasheet shows they are configured as a DIP-12, with LED cathodes and anodes alternating around the pins:
The six LEDs are enough to use all of the available PWM pins on a regular Arduino. The green LEDs I have look like they’re supposed to take a current-limiting resistor of ≥ 75 Ω or so at 5 V. The 100 Ω resistors I used did pretty much max out the weedy regulator on the cheap Arduino Nano I was using, so you may want to use bigger resistors if you want to avoid having your USB disappear.
No Fritzing model of the part yet, but here’s a sketch that works, but quite fails to use any interesting PWM functions at all:
// do a whirly thing with the 6 LEDs inside a LEDTronics L806T_UG-LIME 20 mm Big Dome unit // scruss - 2020-04 // https://www.ledtronics.com/Products/ProductsDetails.aspx?WP=281 // each thru 100R resistor - which might be rather small #define MAXPINS 5 int pwmpins[] = { 3, 5, 6, 9, 10, 11 }; int i = 0; void setup() { // pwm pins as output, all initially off for (i = 0; i <= MAXPINS; i++) { pinMode(pwmpins[i], OUTPUT); analogWrite(pwmpins[i], 0); } } void loop() { if (i > MAXPINS) { i = 0; } analogWrite(pwmpins[i], 255); analogWrite((i > 0) ? pwmpins[i - 1] : pwmpins[MAXPINS], 0); delay(30); i++; }
or if you must: Ender-3 plays LG on YouTube.
I’ll admit that this version is strongly influenced by Washing Machine Sheet music for Percussion, which seems to have a couple of off notes.
Midi, MuseScore, gcode and PDF file:
But this is mostly about the discovery of I wrote a program that converts MIDI files to G-Code, enabling my printer to play music with its LCD buzzer on reddit, with the converter at: MIDI to M300
So here’s the gcode to play this:
M300 P632 S554
M300 P35 S0
M300 P222 S740
M300 P222 S698
M300 P222 S622
M300 P632 S554
M300 P35 S0
M300 P632 S466
M300 P35 S0
M300 P222 S494
M300 P222 S466
M300 P222 S494
M300 P222 S415
M300 P222 S466
M300 P222 S494
M300 P632 S466
M300 P35 S0
M300 P632 S554
M300 P35 S0
M300 P632 S554
M300 P35 S0
M300 P222 S740
M300 P222 S698
M300 P222 S622
M300 P632 S554
M300 P35 S0
M300 P632 S740
M300 P35 S0
M300 P222 S740
M300 P222 S831
M300 P222 S740
M300 P222 S698
M300 P222 S622
M300 P222 S698
M300 P2532 S740
One of the quirks of the SBC6120-RBC boards I just built is that its serial port talks a protocol that’s very rarely seen these days: 7 bits, mark parity, 1 stop bit. minicom supports it, but seemingly can’t set it from the command line.
Kermit, of course, can. Kermit (not the frog, but named after him) is the connect-to-anything, with-anything comms package. It’s been in constant development since 1981, and there’s hardly a computer system that exists that it won’t run on. The Unix/Linux variant, C-Kermit, has an incredibly intricate hand-crafted makefile that predates autoconf or cmake or any of those newfangled toys. Unfortunately, though, this means it may need a lot of reading and a little hand to compile.
There may be some additional dependencies, but to build a simple version of C-Kermit 9.0.304 Dev.23 on Ubuntu 19.10 and Raspbian Buster you need this patch, and do something like:
mkdir ckermit
cd ckermit
wget http://www.kermitproject.org/ftp/kermit/test/tar/cku304-dev23.tar.gz
tar xvzf cku304-dev23.tar.gz
wget https://src.fedoraproject.org/rpms/ckermit/raw/master/f/ckermit-9.0.302-fix_build_with_glibc_2_28_and_earlier.patch
patch < ckermit-9.0.302-fix_build_with_glibc_2_28_and_earlier.patch
make linux
and it should build correctly. There are many, many options: make linux+ssl gives some extra network security features; make install puts it in the system path.
The command line I use to connect to the SBC6120-RBC is:
kermit -l /dev/ttyUSB0 -p m -b 38400 -m none -c
That drops you straight into a connection. To get you back to Kermit’s command mode, type Ctrl + \ + C.
A couple of years back, I said I was building a single board computer and then things went quiet. Yes, I screwed up. A mix of dry joints and possibly burning through traces caused by following old instructions, impatience and a very unforgiving solder type made the original board almost unusable. I finally got a replacement board (thanks, Andrew!) and put in a humongous Digikey order for all the projects that I want to finish, and got going.
I took quite a bit more care building this, but it was still only a couple of evenings to put it together. While I still used lead-free solder, I hardly needed extra flux at all. The nice ($$$) turned-pin sockets hold the chips much more securely than the cheaper plain sockets I used before.
After a minor hiccup (homebrew null modem cable needs both RX and TX to be useful), it lives!
SBC6120 ROM Monitor V320 Checksum 3752 6072 3515 09-APR-10 21:15:39 Copyright (C) 1983-2010 by Spare Time Gizmos. All rights reserved. NVR: Not detected IDE: 489MB - LEXAR ATA FLASH IOB: Not detected B -IDA0 .BASIC NEW OR OLD--OLD FILE NAME--ASCART READY LIST ASCART BA 5B 100 FOR Y=-12 TO 12 110 FOR X=-39 TO 39 120 C1=X*.0458 130 C2=Y*.08333 140 A=C1 150 B=C2 160 FOR I=0 TO 15 170 T=A*A-B*B+C1 180 B=2*A*B+C2 190 A=T 200 IF (A*A+B*B)>4 GOTO 240 210 NEXT I 220 PRINT " "; 230 GOTO 270 240 IF I<=9 GOTO 260 250 I=I-57 260 PRINT CHR$(48+I); 270 NEXT X 280 PRINT 290 NEXT Y 300 END READY RUN ASCART BA 5B 000000011111111111111111122222233347E7AB322222111100000000000000000000000000000 000001111111111111111122222222333557BF75433222211111000000000000000000000000000 000111111111111111112222222233445C 643332222111110000000000000000000000000 011111111111111111222222233444556C 654433332211111100000000000000000000000 11111111111111112222233346 D978 BCF DF9 6556F4221111110000000000000000000000 111111111111122223333334469 D 6322111111000000000000000000000 1111111111222333333334457DB 85332111111100000000000000000000 11111122234B744444455556A 96532211111110000000000000000000 122222233347BAA7AB776679 A32211111110000000000000000000 2222233334567 9A A532221111111000000000000000000 222333346679 9432221111111000000000000000000 234445568 F B5432221111111000000000000000000 864332221111111000000000000000000 234445568 F B5432221111111000000000000000000 222333346679 9432221111111000000000000000000 2222233334567 9A A532221111111000000000000000000 122222233347BAA7AB776679 A32211111110000000000000000000 11111122234B744444455556A 96532211111110000000000000000000 1111111111222333333334457DB 85332111111100000000000000000000 111111111111122223333334469 D 6322111111000000000000000000000 11111111111111112222233346 D978 BCF DF9 6556F4221111110000000000000000000000 011111111111111111222222233444556C 654433332211111100000000000000000000000 000111111111111111112222222233445C 643332222111110000000000000000000000000 000001111111111111111122222222333557BF75433222211111000000000000000000000000000 000000011111111111111111122222233347E7AB322222111100000000000000000000000000000 READY
It compiles and runs a slightly modified ASCIIART.BAS Mandelbrot set benchmark in 144 seconds. This is comparable to many 8-bit computers. The modifications were:
I went out for a very soggy bike ride this morning just to get out of the house. There were a few more people out than I expected, as it’s a regular work day for most people in Ontario. COVID-19 meant that most workplaces were shuttered.
Splashing through the puddles at Centennial College’s deserted Ashtonbee campus (round about here, if you need a precise location) I heard this mockingbird giving its very best performance. I only got a little over a minute of it, but in that time there was some American Robin, Gull, hawk of some kind and best of all (starting just after 40 s) car alarm.
Centennial’s got a big automotive section, and the empty parking lot’s usually full of cars. Mimus was just repeating what it usually heard. I wonder how long they’ll remember and replay car alarms after we’re gone?
Back in the mid-80s — right around the “computers are the future, innit?†phase of history — Strathclyde University decided that every student should have access to a computer. Unfortunately, the computer they chose was the Sinclair QL:
In UK computing, the QL is basically a punchline. With Clive Sinclair’s legendary lavish spending and attention to detail, it shipped late, was initially fiercely buggy, had a keyboard that was 100% nope and used microdrives (an endless loop of magnetic tape in a tiny cartridge) to provide occasionally-retrievable data storage.
My brother was at Strathclyde while these computers were available, so he plunked down the deposit and brought one home. It looked good — especially hooked up to a TV through its SCART port. But it didn’t have much software, outside the tools that were homebrewed for my brother’s course.
One piece of software that has stuck with me in the ~35 years since then was a fractal graphics creator. I remembered you could draw segments and overlay them on shapes to make geometric figures. I thought this was magic, especially with the QL’s (at the time) quite nippy 68008 processor.
I don’t know what prompted me to look for it today. I’d half-heartedly looked in the past, but found nothing. But today I remembered it was written by a software company based at Strathclyde, and that got me to the Talent Graphics Toolkit:
I remembered the “windowed†layout and even the pinstripes. Maybe the graphics were a bit plainer than I remember, but it still delighted me:
The emulator (uQLx) was not particularly easy to install, but I so wanted to run this again that I persevered.
By the time I got to Strathclyde a few years later, the QLs were history. It was rumoured that there was a storage room full of ’em, and there may even have been a thriving market in not-entirely-legit sales of liberated machines. But that wasn’t my jam back then: we had Atari STs with FaST BASIC cartridges in the engineering lab, and a couple even had connections to the VAX cluster …
I love the ingenuity that goes into making very tiny projects do very big things. I also love chiptunes. So when I read the metafilter post about PROTODOME’s compositions for the ATtiny85, I was very much there for it.
The circuit to play this is no more than a $2 microcontroller, a lithium coin cell and a speaker or piezo buzzer. The microcontroller has 8 KB of program space and 512 bytes of RAM. The output is a single pin, but with very clever pulse width modulation tricks, sounds like three channels plus percussion.
The album is cool enough on its own, but Blake “PROTODOME” Troise has not only published the source code, but also written an academic article on 1-bit music: “The 1-Bit Instrument: The Fundamentals of 1-Bit Synthesis, Their Implementational Implications, and Instrumental Possibilities.” Journal of Sound and Music in Games 1.1 (2020): 44-74.
I remembered I had bought a tube of ATtiny microcontrollers a while back. I knew I had a coin cell and tiny speaker. “I can do this!”, I thought.
So what follows is tutorial on compiling embedded code for an ATtiny85 microcontroller on Linux. There are larger tutorials out there, there are better tutorials: but there are also many out-of-date and misleading tutorials. This isn’t a general ATtiny development tutorial, but one specialized on getting PROTODOME’s tunes playing on your microcontroller.
The very minimum you will need to play the music is:
But that’s not all: you’ll need much more kit to program these tiny chips:
There are two separate toolchains involved — one to build the mmml-compiler to convert PROTODOME’s compositions to µc embedded C code, and another to compile that to ATtiny85 instructions. We can install it all in one go:
sudo apt install avrdude gcc-avr binutils-avr avr-libc build-essential git
Building mmml-compiler is easy enough:
git clone https://github.com/protodomemusic/mmml.git
cd mmml/mmml-compiler
gcc -o mmml-compiler mmml-compiler.c
You can then run the compiler on each of the songs; the album title track, for example:
cd ../demo-songs/4000ad/
../../mmml-compiler/mmml-compiler 4000ad.mmml
⚠️ If you get [ERROR 14] Too few channels stated! instead of Successfully compiled! it seems that the compiler isn’t too happy running on some 64-bit systems. I did all my compilation on a Raspberry Pi 4 running Raspbian and all was well. If you can’t get them to compile, I’ve pre-compiled them for you and they’re at the end of this article. (Update: this has been fixed. If you still have the problem, are you running old code?)
You should now have a musicdata.h file that contains all the tune data. Copy it to the same folder as the mmml-player C code:
cp musicdata.h ../../mmml-player/
cd ../../mmml-player/
That folder now contains the player and one tune data file. Now you need to compile it into AVR instruction to write to your chip:
avr-gcc -g -Os -mmcu=attiny85 -DF_CPU=8000000 -o mmml.bin mmml.c avr-objcopy -j .text -j .data -O ihex mmml.bin mmml.hex rm mmml.bin
The end result of what that just did is create a single small file mmml.hex containing the ATtiny85 program instructions for the 8+ minute track 4000AD. If you’re compiling for a different µc, you’ll need a different avr-gcc line:
→→→ aside
If you find yourself compiling a few simple AVR projects but want to stop short of a fine-but-overly-complex Makefile project for AVR development, this script to create a hex file from a single embedded C source file might be useful:
#!/bin/bash # avrbuild.sh - build a simple AVR project - scruss, 2020-04 # usage: avrbuild.sh file.c mcutype freq # eg: avrbuild.sh mmml.c attiny85 8000000 b="${1%.c}" rm -f "$b.bin" "$b.hex" avr-gcc -g -Os -mmcu="$2" -DF_CPU="$3" -o "$b.bin" "$b.c" avr-objcopy -j .text -j .data -O ihex "$b.bin" "$b.hex" avr-size --format=avr --mcu="$2" "$b.bin" rm -f "$b.bin"
In addition to creating a hex file, it also runs the avr-size tool to show you much memory your program uses. The 4000AD tune uses 98% of the ATtiny85’s 8192 byte program space — not quite enough to include that 14 minute extra bass solo, sorry …
←←← end aside
So now we do some wiring. If you’re using a dedicated programmer, use jumpers to connect its ICSP port to the ATtiny 85 like this:
________ |o A | Reset -+ 1 T 8+- VCC | t | -+ 2 i 7+- SCK | n | -+ 3 y 6+- MISO | 8 | GND -+ 4 5 5+- MOSI |________| MISO o1 2o VCC SCK o3 4o MOSI Reset o5 6o GND ICSP Connector
Wire VCC to VCC, MISO to MISO, MOSI to MOSI, SCK to SCK, Reset to Reset and GND to GND. If you’re using an Arduino, you want to do this:
The wiring for that is:
You’re almost there!
If you haven’t used one with your computer before, you need to do a little bit of prep so your computer recognizes it. These are modified from a gist:
sudo vi /etc/udev/rules.d/41-usbtiny.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="1781", ATTR{idProduct}=="0c9f", GROUP="plugdev", MODE="0666"
sudo udevadm control --reload
then sudo udevadm trigger
Your system should automatically recognize the device and give you permission to use it without sudo privileges.
#define USE_OLD_STYLE_WIRING
To program the mmml.hex you created earlier, you’ll need one of these avrdude commands:
For USBTinyISP:
avrdude -c usbtiny -p attiny85 -U lfuse:w:0xe2:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m -U flash:w:mmml.hex:i
For ArduinoISP:
avrdude
-c arduino
-P /dev/ttyUSB0 -b 19200
-p attiny85 -U lfuse:w:0xe2:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m -U flash:w:mmml.hex:i
What all that means:
-c usbtiny
or -c arduino
: programmer type. In addition, the arduino programmer takes additional parameters -P /dev/ttyUSB0 -b 19200
which specify the port (usually /dev/ttyUSB0
or /dev/ttyACM0
) and the baud rate (always 19200, unless you changed it in the source of ArduinoISP)-p attiny85
: the chip type, as used in the avr-gcc compiler call way up the top-U lfuse:w:0xe2:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m
: fuses are AVR’s confusing name for configuration bits. You might just have to take my word that this sets an ATtiny85 to use the internal 8 MHz oscillator (as opposed to an external crystal) we told the compiler to use further back. A guide to fuse settings is available at the Engbedded AVR Fuse Calculator-U flash:w:mmml.hex:i
: the hex file we prepared, mmml.hex
.If everything went right with your flashing process, you should see lots of “avrdude: verifying … done. Thank you”. If you don’t, likely you missed a connection somewhere.
I already described all of the bits in the bill of materials in the Hardware section. If you want it in ASCII art, here’s all there is to it:
________
|o A |
VCC--(10kΩ)--+ 1 T 8+--VCC
| t |
-+ 2 i 7+-
| n |
-+ 3 y 6+- (
| 8 | ((
GND--+ 4 5 5+--(SPKR(--GND
|________| ((
(
Pin 1: RST - held high through pull-up to prevent reset
Pin 4: GND
Pin 5: PB0 - through speaker/buzzer to GND
Pin 8: VCC - can be a CR2032 Lithium coin cell
Not shown: 100 nF decoupling capacitor between VCC and GND
Short Pin 1 to GND to restart song
If you weren’t able to compile the tunes, I’ve included (with Blake’s permission) source for any AVR µc plus hex files for ATtiny85s here: protodome-mmml-examples.zip
Last but not least, there are a couple of tracks included in the source that aren’t on the 4000AD album. Blake gave me permission to include them here, too:
These weren’t recorded from a tiny speaker (that went badly), but directly to a Marantz solid state recorder. The rig’s the same as the playback one, with the speaker replaced by a potentiometer (for level control), a 100 µF capacitor (to take off some of the DC bias and also to cut some of the very high frequencies) and a headphone socket. Have fun!
https://www.thingiverse.com/thing:4241697
(since Thingiverse’s markdown parser seems to be broken)
A weighted, non-slip, non-wobble soldering third hand.
Huge thanks to Modular Hose for giving me the Loc-Line samples I used to make this!
Why is it called TRex? It’s got really short arms …
Despite what Thingiverse might say, this is not a Customizer project. Opening that link will disappoint.
Note that Modular Hose promotional Loc-Line keyrings each have 3 segments plus a threaded connector and nozzle, so four keyrings provide enough parts.
Dan Kirshner’s Thread-drawing modules for OpenSCAD were used to make a nice ¼” NPT taper-profile thread. Thanks, Dan!
Data archive: TRexSolder3rdHand.tar.gz