DIY joystick for the BBC Micro – part 1

My recent PC build was undertaken partly to allow me to play Elite: Dangerous. There was no small amount of nostalgia involved in that decision: the original Elite was one of the few games I played back in the 8-bit days.

Yes, the space station on the left is blurred. It was a 1 second exposure and the bugger wouldn’t stop moving.

But while I can now play the two incarnations of the game – separated by 30-odd years – side-by-side, there was a problem. My new PC has a joystick but my BBC Master Turbo does not. I needed to fix that.

[And yes, I know I said that I would focus on finishing existing projects, but there’s a good reason for this little excursion, discussed later.]

The original Elite became much more playable when I started using a joystick – both combat and docking were nigh-on impossible without one. (In Elite: Dangerous, docking is relatively easy with the keyboard, but combat is another story.)

In the early 1980s, I solved the problem by the simple expedient of buying a joystick. So when I started messing about with Elite again recently, there inevitably followed an Ebay search to get something suitable for the Beeb. But the options were limited and the prices were stupid. And I do remember playing around with the Beeb’s analogue port quite a lot, back in the day, so I figured I’d just make something.

Can’t be hard, can it?

Back to Ebay and I found some analogue joystick modules – essentially just two potentiometers one of which is, presumably, gimballed. I did consider cobbling something together with basic potentiometers, but these modules are sufficiently cheap that it didn’t seem worth the bother. For less than eight quid I could get something that has both pots, the gimbal, an enclosure, mounting hardware and the control stick. Why make life difficult?

The values of the pots is unimportant. (They’re 10kΩ for the record.) All that actually matters is the voltage coming out of the centre pin relative to the voltage going in.

Each pot has three connectors. You attach one of the outside ones to the reference voltage (VREF) supplied by the Beeb’s analogue port. You connect the other outside tab to the analogue ground wire (AGND). And the centre tab gets connected to the input pin on the analogue port for the channel you’re sensing.

In fact, these joysticks are remarkably similar to the ones I had more than three decades ago, maintaining that retro feel.

Ports a-plenty

The BBC Micro was blessed with a large array of interfaces, which made it the superior machine, compared to its 8-bit rivals, if you wanted to move beyond games and actually do something with the computer. It also made it ideal for one of its key markets – schools.

One of these interfaces is an analogue port. Accessed via a DB15 connector, this provides four analogue inputs labelled CH0 to CH3 – enough for two joysticks – with 10-bit resolution. (The chip – an NEC D7002C – is capable of 12-bit resolution but you need to take a lot of extra precautions if you want to achieve that. In most cases, it’s not worth the effort.) Two pins provide a 1.8V output reference voltage. The Beeb’s analogue interface is actually rather hackable, and it is possible to mess with the hardware to provide it with higher-precision reference voltages up to 2.5V – but again, I don’t want to bother with that and also don’t want to mess up my motherboard.

There are also two digital I/O pins that are designed to detect the pushing of buttons (think ‘fire’), which are pulled up to +5V by default. And another pin, also pulled up to +5V, is intended for a light pen. The rest of the pins are connected to +5V (one pin), 0V (three pins) and analogue ground (AGND, two pins).

The pins are arranged in groups – a set of four (VREF, AGND and two analogue input channels) for joystick 1; then a pair of pins for its fire button; then another set of four for joystick 2; then another pair for its fire button; and lastly three pins for the lightpen, with 5V supply, lightpen input (LPSTB) and 0V.

It would have been simple enough to solder four long wires (VREF, AGND, CH0 and CH1) to the joystick at one end and a DB15 plug at the other, but that would have been a tad messy. Plus you’d need two more wires for the fire button. And that’s per joystick.

I wanted a neater solution, so I figured I’d design a PCB to plug into the BBC Master and some kind of connector at the joystick end. There’s almost no electronics involved in this – it’s just an exercise in wiring. But a PCB would be a convenient solution.

I started casting around for six-core wire and couldn’t find any. Then my eyes lit upon an Ethernet cable. Perfect! That has eight conductors, meaning I could double-up on the VREF and AGND. And my PCBs could use standard Ethernet sockets.

Here’s how I assigned signals to cables.

Eth pin Colour Analogue Port Pin No. Description
1 Orange/White PB0 13 Fire button +ve
2 Orange 0V 6 Fire button -ve
3 Green/White CH0 15 Analogue signal channel 0
4 Blue AGND 8 Analogue ground
5 Blue/White CH1 7 Analogue signal channel 1
6 Green AGND 8 Analogue ground
7 Brown VREF 14 Analogue reference voltage
8 Brown/White VREF 14 Analogue reference voltage

Ethernet Cat 5 cable actually consists of four twisted pairs. In this configuration, the analogue signals returning to the Beeb are twisted with ground cables – not that I think it matters that much.

Crack out KiCad

Time to design the main interface board.

I haven’t used KiCad in a while and only very recently tried version 5 for the first time. That was on my SmartParallel project and, while I like what I’ve seen so far, I’m still a beginner with this software and need some practice.

What better way of honing my skills than to hack together a simple project? Lessons learned here can be applied to the more complex SmartParallel board. So, you see, this joystick thing is an example of me getting to grips with existing projects.

I created my own DB15 schematic symbol so that I could label the pins appropriately. Within a few minutes I’d hacked together this schematic for a board supporting two joysticks.

And yeah, I’m aware that this looks as though it was thrown together in a few minutes. I didn’t take much care with it, to be honest, because it’s so simple and I wanted to get to the PCB layout.

You may have noticed that I’ve added a six-pin header row for test points. I can solder in standard headers – or not. There’s a three-pin header for the +5V/0V/LPSTB light pen cluster, which is also optional. And I’ve chucked in three random decoupling caps – for the VREF supplies to the joystick sockets and the +5V line. These are probably unnecessary and I can decide later if I’ll bother to solder them on. If I don’t bother with any of that, building the board will consist of nothing more than soldering on the DB15 plug and two RJ45 sockets.

PCB challenge

The PCB turned out to be more challenging than I’d expected. First, KiCad’s default footprint for the RJ45 Ethernet socket was different to the items I’d ordered via Ebay, which have small metal lugs extending from the outer casing through the board layer. So I’ve created my own. No idea if it’ll work.

And running separate 0V and AGND nets added some complication. I set the back layer copper fill to be AGND and the front layer copper fill to VREF. But that meant routing traces for all the 0V connections. I got there in the end, but not without a couple of ugly hacks.

Having separate AGND and 0V nets got me thinking. I probed around with my multimeter in continuity mode and found a short between all the 0V and AGND pins. Next, I checked out the Master’s circuit schematic and, while the IC has separate 0V and AGND pins, AGND is connected directly to the 0V rail on the motherboard.

The part of the BBC Master’s schematic dealing with the analogue port. I’ve highlighted the connection from AGND to 0V.

I asked about this in the Stardot forums and was reliably informed that separate AGND and 0V nets are often used in analogue circuits as a way of preventing noise coming via the 0V rail from disturbing sensitive analogue circuits. However, that’s hardly going to be the case here.

You can also see that there are already decoupling caps galore in the Beeb itself.

I respun the PCB design, this time using a single net (which I called AGND0v) for both AGND and 0V. This simplified the design considerably. The only snag is that I’d already ordered PCBs via JLCPCB. And because I’m a cheapskate when it comes to shipping, it’s going to take two or three weeks for them to arrive. I’m also still awaiting the RJ45 sockets I bought on Ebay.

So, Part 2 of this project will be posted when everything arrives, I’ve soldered up a board and have figured out why it’s not working…

[UPDATE] The KiCad files are now online at:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.