20 May 2018

Easy add-on Projects for Spectrum ZX81 & ACE (Redux): Part 3

Leave a Comment

Let There Be Light Pen

Now that we have a working Decoder Board from 'Easy Add-on Projects for Spectrum, ZX81 & Ace', it's time to get down to some projects. There are a couple in the book I've really been wanting to try out,  Project 2: Picture Digitser and Project 7: Light Pen. Despite our guide books numeric ordering, the Light Pen is by far the simpler build, so lets start there.

The Light Pen Project

As everybody from the 80s knows, the Light Pen is the control mechanism of the future, mice touch screens and keyboards all redundant when you have a light pen by your side, it's truly the wonder input device for the ages.

Typically light pens work with only on CRT monitors; as lines are drawn on a CRT screen a light pen detects the CRTs scan line once it reaches the pen. The time it takes for the light pen to detect the scan line allows the computer to pinpoint exactly where on the screen the pen is placed.

The light pen featured in Easy add-on Projects for Spectrum ZX81 & ACE does not work in the typical way. Essentially the projects light pen functions as a light detector that doesn't detect CRT scan line progression. Working out where the light pen is on the screen is left entirely up to our BASIC programs. As it turns out (thirty plus years on from the books publications) this simplicity is exceptionally beneficial for the projects light pen, marking it just as usable on LCD monitor as it is every was with a CRT.

Orginal Light Pen Circuit from Easy Add-on Projects for Spectrum, ZX81 & Ace
Building the Light Pen and Circuit is not a difficult. I constructed the majority of the circuit on a breadboard, which sits quite nicely just behind the ZX81's keyboard. The LDR is mounted in the tip of an old pen, with a cable running down through the centre of the x-writing implement.  I hot glued the cable and resistor legs to removable nib holder (is that what it's called?) and the cable again where it leaves the top of the pen. This hold everything together quite firmly.

ZX81 and Light Pen attached to the Decoder Board
I was forced to make some minor changes to the circuit as some components can be harder to come by than others. The local (read Australia) walk in Electronics supplier Jaycar don't stock the projects prescribed ICL7611 CMOS Op Amp. In order to get the Light Pen up an running with minimal fuss I substituted the ICL7611 for a general purpose LM741 Op Amp.

Modified Light Pen Circuit
The IC change also made the addition of a couple of resistors necessary. The Output of the Substitute LM741 Op Amp doesn't lower the voltage close enough to TTL logic levels when detecting variances between the light-dependent resistor and reference potential. Two resistors, a 10k and a 4.7k are added to the IC Output that's feed back to the Decoder Board.

ZX81 Light Pen Test Menu Application
Based on the books listings and general project information I wrote up a simple BASIC application to test out the new pen with my trusty ZX81. The light pens status is read by input 3 of the Decoder Board, lines 10 and 20 of the BASIC listing reflect this. Line 10 also stores the machine code routines required for a ZX81 to read the Decoder Board: Refer to Appendix A of  'Easy Add-on Projects for Spectrum, ZX81 & Ace' for how all that works.

Finally, I've added a short YouTube Video of the Light Pen and the BASIC program in action. As can be seen it's really quite effective for simple input tasks.




See more entries for this project: ForwardPart 1Part 2, Part 3


Read More

12 May 2018

ZeaMouse V2, USB Mice for the ZX81 & Spectrum Revisited: Part 1

Leave a Comment
A year ago I knocked up the ZeaMouse, a USB mouse interface for the ZXpand and ZX81. ZeaMouse is a USB to digital mouse expansion board built around an Adrunio USB host shield. A year on it seems like a good time to revisit the project and make some improvements.

Last time part of the fun was building a simple Arduino clone as part of the ZeaMouse. Unfortunately this kept the size of the end product much larger than it needed to be. This time an Arduino Pro Mini 3.3v has replaced the DIY Arduino, matching this with a USB Mini Host shield and some additional components on a home-brew shield sees significant reductions in interface size.

The USB Mini Host shield forms the core of the project and is designed to fit under an Arduino 3.3v Pro mini. The USB shield has all the abilities of it's bigger brother but does with some but comes with some power supply limitations. By default the combination of 3.3 volt Pro Mini and USB host  combination delivers 3.3 volts to an attached USB device. For some hardware the voltage may not be high enough, although all the USB mice (if a limited selection) I've tested have work without issue.

3.3v Arduino Pro Min, USB Shield and ZeaMouse V2 PCB.
The USB Host shield can be modified to deliver 5v to connected devices if required. Details of the conversion can be found on the Circuits@Home website. The modification bypasses the Arduino's 3.3v regulator, meaning that whatever is used to supply power to the RAW inputs must be rated a 5v or lower else you risk frying an attached USB device. The ZeaMouse is powered from the 5v lines on the digital joystick port, so the modification is fine for our purposes. (But check your Micro Computers Specs first).

I decided against using 4066 switching ICs on ZeaMouse V1 as it made designing the single sided PCB a lot simpler. This time, with design simplicity and ease of build-ability screams for the use of 4066s. With the Arduino Pro Mini operating at 3.3 volts and the ZX81 at 5 volts, 4066s provide a simple way of keeping these conflicting voltages separated.


ZeaMouse V2 Circuit Diagram
Although I got a couple of double sided test PCBs fabricated, the ZeaMouse boards are pretty much designed with home PCB making in mind. Only the bottom of the board really needs to be made up. There are a couple of via's must be connected with some straight wire on the top of the board should you choose to build a single sided PCB.

Building the interface is straight forward. The hardest part is probably soldering the Pro Mini and the USB shield together. Constructing ZeaMouse shield itself is a breeze, and will only take about 20 minutes maximum.

Other than two 4066s, the only other components required are pin headers and IC sockets, although all of these are optional. The Arduino and USB Host along with the ICs could be soldered directly to the shield PCB. The only required header is J4, used to enable or disable RS232 communication with the ZXpand. J4 should be left open if using the ZeaMouse on any micro computer other than a ZX81.

ZeaMouse v2 Shield completed.
The connection pads or pin headers on the far end of the shield board should be wired up to an Atari joystick cable or DB9 socket. I had a cable from a broken controller to hand; care needs to be taken re-purposing cables for fear of sending 5 volts down the wrong line. The TX serial out is the one non-standard connection, it's specifically for the ZXpand+, and should be routed to RX on the ZXpand+.

ZeaMouse v2 interface for the ZX81 & ZXpand / ZX81, the ZX Spectrum and other 8 bit micros
Next time I'll cover the firmware and take a look at the mouse in action. No need to wait until then if you're keen to get going; All the files and firmware required to build the interface are a already available on the ZX81 Projects and Programs to Download Page.

See more entries for this project: Part 1Part 2
Read More