Thursday, 31 December 2015

Build Your Own AZ15

Why not round out the year be building your AZ15, the Raspberry Pi, Arduino and ZX81 keyboarded wonder of a mini computer.

There have been a number of requests asking where to get the case, all the parts etc, so after ironing out a couple of minor issues I've made the Case available on Shapeways, and below is detailed most of everything else you'll require to complete your own AZ15 project.

This little is adventure has always been about achieving a fun build in the spirit of  "just because it's possible I think I'll give it a go", so please  don't expect this thing to be a cheep enterprise (3D Printing the case is the largest single cost factor here). This project is a learning experience and one undertaken to just see what could be achieved with 3D printing, off the shelf Arduino components and some hard graft.

Before you rush of and purchase everything, keep in mind that this is also not a professional product and doesn't come with a warranty, though if you ask nicely I'll do my best to provide some help along the way, should you decide to give it a go.

Major Case Components List


These are the major components, the ones responsible for all the heavy lifting, style substance and the impress (or not) your friends bits at the heart of the AZ15. 

Major& Miscellaneous Parts Shopping List


Amount Part Type Properties
1 AZ15 Computer Case Main AZ15 Case to hold the Raspberry Pi2 and Keyboard Converter Board etc
1 AZ15 Computer Case Lid For a Complete case the lid component is also required
1 Raspberry Pi2 Specifically a Raspberry Pi2 is required to fit inside the AZ15 Case.
1 LeoStick Freetronics LeoStick (Arduino Compatible)
1 ZX81 Keyboard ZX8-KDLX - PCB replacement keyboard for ZX81. These can be purchase fully assembled or un-assembled depending on preference. There is also a ZX80 variant available, compatible with the AZ15 project, if you're feeling super retro. (some minor changes to Arduino code to match the layout may be required).
1 Rubber Feet Rubber Feet, Small Stick On, Size: 12 x 12mm- Height 6mm
1 Compact Right Angled USB Cable This goes inside the AZ15 case and connects the Pi to the Leostick. A 15cm length of cable should be plenty. I got one of these from Ebay.
1 Mini USB WIFI Dongle Optional, for plugging into the internal USB port.
1 Double Sided Tape Black Double sided tape for mounting the ZX81 Keyboard into the case keyboard tray.
1 Hot Glue Hot glue and glue gun, used to permanently attach LEDs to case.


Converter Board Components and Minor Case Furnishings


In this section is listed everything required to build the Converter Board. I've linked to the exact components I used in my original board for clarification. You should be able to match the linked components to you're local supplier if needed.

Shopping List


Amount Part Type Properties
1 Molex 22-02-3053 header - 5 pins hole size 1.0mm,0.508mm; row single; package THT; pins 5; form ♀ (female); variant variant 4; pin spacing 0.1in (2.54mm)
1 Molex 22-02-3083 header - 8 pins hole size 1.0mm,0.508mm; row single; package THT; pins 8; form ♀ (female); variant variant 5; pin spacing 0.1in (2.54mm)
4 Locking male header - 2 pins 2 Pin 0.1 Straight Locking Header - 2.54 pitch - Single; form ♂ (male); pin spacing 0.1in (2.54mm)
2 Generic male header - 14 pins hole size 1.0mm,0.508mm; row single; package THT; pins 14; form ♂ (male); pin spacing 0.1in (2.54mm)
4 Header with Crimp Pins - 2 pins 2 Pin 0.1 Header with Crimp Pins - 2.54 pitch (2.54mm). Connect LEDs and switch to Board
3 Red (633nm) LED color Red (633nm); package 5 mm [THT]; leg yes. Use hookup wire and Header to Connect to Board and Mounting in Case
1 LeoStick As above, don't panic, you don't require 2 of these. Assemble separately with female header at bottom. Plugs into J7 and J8
3 220Ω Resistor tolerance ±5%; package THT; bands 4; resistance 220Ω; pin spacing 400 mil
1 10kΩ Resistor tolerance ±5%; package THT; bands 4; resistance 10kΩ; pin spacing 400 mil
1 Round Pushbutton switching circuit SPST; default state Normally Open. Mounting hole 12mm
1 Hook Up Wire Various Colours, For connecting LEDs and Switch to Board via Headers
1 Heatshrink For isolating LEDs, prevent contact with Raspberry PI etc


Converter Board Assembly


ZX81 Keyboard Converter Board PCB Layout.
There is not a great deal to assemble on the
Converter Board, just a couple of resistors, pin headers and the Molex sockets, over all is a very basic solder job.

All the files required files for ordering a PCB from a fabrication house are contained in AZ15_PCB_layout.zip. Or do as I did, and use the same files to to create your own PCB. I outlined the basic process earlier in the blog. Extra details on construction of the Converter Board have also been documented previously.

Of course you'll nee the latest Arduino sketch to fuel the Leostick, and that can be found in the zx81usbkeyboard_20151.tar.gz file.

Components highlighted in bold green, under Properties, are not soldered / attached directly to the converter board. These components are for attaching via hookup wires and headers to the board, and are mounted in or on the AZ15 Case.

Assembly List


Label Part Type Properties
J1 Molex 22-02-3053 header - 5 pins hole size 1.0mm,0.508mm; row single; package THT; pins 5; form ♀ (female); variant variant 4; pin spacing 0.1in (2.54mm)
J2 Molex 22-02-3083 header - 8 pins hole size 1.0mm,0.508mm; row single; package THT; pins 8; form ♀ (female); variant variant 5; pin spacing 0.1in (2.54mm)
J3 Locking male header - 2 pins 2 Pin 0.1 Straight Locking Header - 2.54 pitch - Single; form ♂ (male); pin spacing 0.1in (2.54mm)
J4 Locking male header - 2 pins 2 Pin 0.1 Straight Locking Header - 2.54 pitch - Single; form ♂ (male); pin spacing 0.1in (2.54mm)
J5 Locking male header - 2 pins 2 Pin 0.1 Straight Locking Header - 2.54 pitch - Single; form ♂ (male); pin spacing 0.1in (2.54mm)
J6 Locking male header - 2 pins 2 Pin 0.1 Straight Locking Header - 2.54 pitch - Single; form ♂ (male); pin spacing 0.1in (2.54mm)
J7 Generic male header - 14 pins hole size 1.0mm,0.508mm; row single; package THT; pins 14; form ♂ (male); pin spacing 0.1in (2.54mm)
J8 Generic male header - 14 pins hole size 1.0mm,0.508mm; row single; package THT; pins 14; form ♂ (male); pin spacing 0.1in (2.54mm)
LED1 Red (633nm) LED color Red (633nm); package 5 mm [THT]; leg yes
LED2 Red (633nm) LED color Red (633nm); package 5 mm [THT]; leg yes
LED3 Red (633nm) LED color Red (633nm); package 5 mm [THT]; leg yes
LeoStick Arduino Assemble separately with female header at bottom. Plugs into J7 and J8
R1 220Ω Resistor tolerance ±5%; package THT; bands 4; resistance 220Ω; pin spacing 400 mil
R2 220Ω Resistor tolerance ±5%; package THT; bands 4; resistance 220Ω; pin spacing 400 mil
R3 220Ω Resistor tolerance ±5%; package THT; bands 4; resistance 220Ω; pin spacing 400 mil
R4 10kΩ Resistor tolerance ±5%; package THT; bands 4; resistance 10kΩ; pin spacing 400 mil
S1 Round Pushbutton switching circuit SPST; default state Normally Open. Mounting hole 12mm

Wednesday, 9 December 2015

AZ15 and a Tale of two Features

Feature One: As seen on the GuardianWitness


A big thanks to the The Guardian and Matthew Holmes in particular, for featuring this humble Raspberry Pi, Arduino and ZX81 keyboard project in the article Best reader Raspberry Pi projects – and some of the most pointless. There are loads of other interesting Pi related constructions to peruse through, the article is a fun sample of all the ways people are finding to enjoy the Pi. I particularly enjoyed the Raspberry Pi hacked into a Holga 120 Film Camera, and its taking of photos old school.

The AZ15, as seen in all the best online newspapers.


Feature Two: New Keyboard Functionality


The nice thing about making something yourself is that you can continue to work on it, even if to all external appearances the project may seem complete.

Having used the AZ15 for almost two weeks now I decided to add a little extra functionality, addressing some minor usability issues, the main one being my forgetting to switch between Emulator and Standard keyboard modes. When using a ZX81 emulator with the keyboard, the button on the right side of the case is pressed, this changes the keyboard mode, and the LEDs on top visually tell you what mode you're in. This is all fine, except I keep forgetting to press the button.

The solution is simple enough, have the keyboard change modes automatically. Nicely the Raspberry Pi can talk to the LeoStick via serial link and vice versa. A couple of commands directed at the serial interface before launching an Emulator automatically selecting the correct keyboard mode and things soon become more user friendly.

For example, emulator mode can be selected and a notification bell passed with the following redirection to the serial port the LeoStick / Keyboard is attached to.

echo emulator bell > /dev/ttyACM0

Putting the above in a start script that launches the emulator and then sets all back to normal after exiting solves my main issues.



#!/bin/bash
# Put keyboard in Emulator Mode
echo emulator bell > /dev/ttyACM0
# Launch the sz80 emulator
sz81
# Set keyboard back to Standard Mode
echo standard > /dev/ttyACM0

If the USB port assignment changes around, "dmesg" could always be used to parse for the correct device.


Command Line, Mode and Options Selection
BELLSound the LeoStick Piezo. Could be used to forward audio system notifications etc. 
BEEP OFFTurn off Keyboard Sounds. Sounds are off by default.
BEEP ONTurn on Keyboard Sounds. Similar to the keyboard clicks made by ZX Spectrum when typing. The keyboard only emits clicks in Standard mode. In Emulation mode sound is always off.
DEVICEReturns message "ZX81_KEYS" to the console. Useful if unsure you have the correct serial port. You must be monitoring incoming streams to get the return message. eg cat /dev/ttyACM0
EMULATORSwitch the keyboard into emulator mode.
STANDARDSwitch the keyboard into standard mode.


The latest Arduino sketch can be downloaded here: http://zx81.dasteph.com/files/zx81usbkeyboard_20151205.tar.gz