It’s not really in a useful form factor, but it’s got some sensors and outputs:
an LDR on the ADC channel
RGB LED for PWM on pins 15, 12 & 13
red LEDs pins 16, 14, 5, 4, 0, 2 with inverted logic: set them low to light them.
My board can’t quite be the earliest of the early, as it has 1 MB of flash. This is enough to install MicroPython, so I wrote a tiny test program for the outputs:
run a binary counter every second on the six red LEDs;
cycle through a colour wheel on the RGB LED while this is happening.
Here’s the code:
# esp8266 old explorer board
# see https://www.esp8266.com/wiki/lib/exe/detail.php?id=esp8266-dev-boards&media=esp8266-12_mod.png
from time import sleep
from machine import Pin, PWM
# LEDs are 16, 14, 5, 4, 0, 2 - L to R
# inverted logic: 1 = off
leds = [Pin(2, Pin.OUT, value=1), Pin(0, Pin.OUT, value=1), Pin(4, Pin.OUT, value=1), Pin(
5, Pin.OUT, value=1), Pin(14, Pin.OUT, value=1), Pin(16, Pin.OUT, value=1)]
# RGB for PWM on [15, 12, 13]
rgb = (PWM(Pin(15)), PWM(Pin(12)), PWM(Pin(13)))
# LDR on ADC
def cos_wheel(pos):
# Input a value 0 to 255 to get a colour value.
# scruss (Stewart Russell) - 2019-03 - CC-BY-SA
from math import cos, pi
if pos < 0:
return (0, 0, 0)
pos %= 256
pos /= 255.0
return (int(255 * (1 + cos(pos * 2 * pi)) / 2),
int(255 * (1 + cos((pos - 1 / 3.0) * 2 * pi)) / 2),
int(255 * (1 + cos((pos - 2 / 3.0) * 2 * pi)) / 2))
i = 1
while True:
i = i + 1
i = i % 64
w = cos_wheel(4 * i)
for j in range(3):
rgb[j].duty(4 * w[j])
for k in range(6):
if i & (1 << k):
leds[k].value(0)
else:
leds[k].value(1)
sleep(1)
The PC I put together a few years ago (well, Scott Sullivan told me which bits to get, I bought them and assembled it) is still working really well. It was quite spiffy in its day — i7-4790K, 32 GB DDR3, Asus H97M-E — and is quite fast enough for me.
One thing, though, has never worked. The hardware serial port (the old kind, not the USB kind) refused to do anything. Only in the last day or so did I work out why and managed to fix it.
PC serial ports for roughly the last 25 years connected to the motherboard like this:
The important thing about a switch is that it has two electrically isolated parts that come together to close a circuit. And that’s exactly what the Swingline® 747® stapler doesn’t have: its entire metal body and mechanism is electrically conductive. So we have to rig something up …
Tape, paperclip and alligator clip make up one half of the switch… while a handy ledge at the back of the staple dispenser provides a connection for alligator clip #2
Did I say take the staples out yet? No? Take the staples out of the stapler. Possibly even before doing anything else.
The code we’re going to run on the Circuit Playground Express is very simple:
Set up pin 1 (helpfully named A7 on the board) as an input. Turn off all the LEDs
If pin 1 is shorted to ground, increase a counter and light successive numbers of LEDs round the CPX’s face
If the counter reaches 10, play the sample, reset the counter and turn off all the LEDs
repeat from “If pin 1 is shorted to ground …” until too bored to continue.
Here’s the code:
# SIM-SimStapler / RealStapler - scruss, 2020-04
# circuitpython on CPX - stapler between D1 (A7) and GND
from adafruit_circuitplayground import cp
import board
from digitalio import DigitalInOut, Direction, Pull
import time
# set up stapler on pin D1 (port A7): goes LOW when pressed
stapler = DigitalInOut(board.D1)
stapler.direction = Direction.INPUT
stapler.pull = Pull.UP
# set up pixels - not too bright
cp.pixels.brightness = 0.1
# turn all pixels off
for i in range(10):
cp.pixels[i] = (0, 0, 0)
count = 0
while True:
# stapler pressed, so increase count
if not stapler.value:
count = count + 1
# only count first press, not if held
while not stapler.value:
pass
time.sleep(0.1)
# light up pixels clockwise for each press
for i in range(count):
cp.pixels[9 - i] = (0, 255, 0)
# get a bonus Penelope Keith every ten presses
if count == 10:
cp.play_file("splendid.wav")
# turn all pixels off after bonus
for i in range(count):
cp.pixels[i] = (0, 0, 0)
# and reset counter for next time
count = 0
Here’s the code and sample ready to be copied to your CIRCUITPYTHON drive:
(The sample is a slightly tweaked version of Freeverse’s original Bonus.wav. I ran it through an equalizer to make it sound less awful through the CPX’s tinny little speaker. I was also today years old when I found out that the sample wasn’t Penelope Keith from To the Manor Born, but Jen Krasinski, a staffer at Freeverse.)
The connection (singular) is simple:
Alligator clips to A7 (in reality, D1) and GND
Have an appropriate amount of fun!
I suppose I could also have done this on the BrainPad, but I haven’t set it up with MicroPython yet, and I don’t have time to drag coding blocks around. Also, this is not any project to associate with the word “brain” …
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.
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++;
}
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 swapped out the 5 MHz crystal for a blazingly fast 8 MHz one
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
If WordPress’s line wrapping has mangled the above, it should look like this
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:
PDP-8 BASIC doesn’t quite use ASCII. Its six-bit character set has digits 0-9 at decimal 48-57 like ASCII, but characters A-F are at decimal 1-6 (instead of 65-70). The manual claims that CHR$() works modulo 64, so maybe I didn’t need to make this change.
Variable names can be called Letter+Number at most, so the original’s CA and CB had to become C1 and C2.
PDP-8 BASIC doesn’t support a familiar IF … THEN … structure, but only effectively an IF … GOTO …. I mean, sure, you can use THEN if you want, but only a line number or a GOTO … following it will avoid the dreaded terse NM error. ELSE? Who needs it?!