How does a PC read an old school analog joystick?
It might be more interesting than you think.
Or how to make an ADC out of a 555 Timer...
IBM PC Jr Technical Reference Manual:
http://www.retroarchive.org/dos/docs/ibmpcjrtechref.pdf
Tandy 1000 Technical Reference Manual:
https://ia801708.us.archive.org/5/items/Tandy_1000_Computer_Service_Manual_1985_Tandy/Tandy_1000_Computer_Service_Manual_1985_Tandy.pdf
Forum: http://www.eevblog.com/forum/blog/eevblog-1054-how-an-analog-pc-joystick-works/'>http://www.eevblog.com/forum/blog/eevblog-1054-how-an-analog-pc-joystick-works/
EEVblog Main Web Site: http://www.eevblog.com
The 2nd EEVblog Channel: http://www.youtube.com/EEVblog2
Support the EEVblog through Patreon!
http://www.patreon.com/eevblog
Donate With Bitcoin & Other Crypto Currencies!
https://www.eevblog.com/crypto-currency/
EEVblog Amazon Store (Dave gets a cut):
http://astore.amazon.com/eevblogstore-20
T-Shirts: http://teespring.com/stores/eevblog
💗 Likecoin – Coins for Likes: https://likecoin.pro/ @eevblog/dil9/hcq3

Hi. In the previous video, we took a look at the classic IBM PC junior computer and how it was a big flop back in the 80s and I'll link it in that down below and at the end of this video if you haven't seen it. and one of the things I briefly mentioned in the teardown of this is how the game port a joystick controller circuitry actually worked. When I was tearing down the piece of B we saw a five five eight timer in there and I explained that this was quite common back in the day, but I Thought we'd take a deeper look at that because it's rather interesting how this works.

I think it's rather clever. so let's take a look at the classic analog joystick. this is the original IBM joystick from back in the day IBM didn't actually I Don't think they actually made this because the original IBM PC actually didn't come with a joystick or a game controller port as it was called back in the day, but you could actually buy a plug-in card which actually was just the game controller PC card and that became the de facto industry standard joystick interface for the PC from then until the end of time until like USB joysticks took over, so they lasted a long time. this game controller joystick interface and it started out just as that single plug in peripheral car which could control two different joysticks through a D15 connector and a Wye splitter cable.

but of course that took up an entire slot in your PC and will dedicate in the hole slot away. And game controller kind of sucked. So eventually are these multi combo IO IO cards took over where you could. Actually, you know they would integrate a serial port, parallel port, and joystick controller ports, real time clock and all this sort of stuff into the one expansion card to try and save slots.

But the circuitry remained exactly the same for like a long time. And there's probably other brand personal computers back in the day that used a similar type of analog joystick interface. And that's exactly what this is. It's actually an analog joystick.

It It wasn't just buttons, you could actually get real feedback and real fine control. if you moved it just a little bit, then you're you know you're a spaceship and just move a little bit or whatnot. The PC could actually read the position of the joystick on here, and the standard IBM ones had two buttons like this. It was exactly the same on the Tandy 1000, which is a basically a clone of the IBM RPC Jr..

and was massively more popular than the PC Jr.. and I've done a video once again linked in at the end of this where I design a turbo board for the Tandy 1000. That's a real old video, but it's interesting, so stick around and check that one out. But exactly how did these analog joystick controllers work and what circuitry was required to actually read them? Well, let's do the first thing.

Tear this one apart. I Can just move this and you can see that these two rotating arms on here would actually just connect up to just a regular carbon pot in there, a potentiometer, a variable resistor, and it. They'd connect directly onto the shaft in there and simply turn that pot so the resistance value can see that they're only using the to wire one here, so they're not our Center tap in that. but it's fine.
you can do it either way, and that's how they do it. so they need to read the resistance value on this pot. This joysticks actually quite interesting in that it has a a free mode. You see how it actually springs back in both directions, where you can actually move it to the corner and then you could go free like that and then it would be free to sort of stay.

It didn't spring back in that direction, but it would still spring back in that direction and you could do that for both of those or either/or axes like that. So that was actually a really neat thing on the analog. PC Joystick A hundred K Like that, and I'm pretty sure that was just like an industry-standard value and you'll notice that they've got a little bit of a body in here. They've got, uh, some capsules that go into the shield of the cable.

Perhaps just some noise suppression there. I Don't remember my Tandy 1000 joystick ever having that. So how do we read the value from this pot? Well, that's where it gets a bit interesting. Now, of course you might be thinking that the obvious solution? You've got your potentiometer here.

Just hook it up to your 5 volt rail and your ground. and then you just, you'll get 0 to 5 volts depending on the location of the joystick there. And then you'd simply feed it into an analog to digital converter and you get your 8 bit or whatever value out. And Bob's your uncle, right? Well, you've got to remember that this was like the late 1970s, early 1980s, and IDC's These were actually quite expensive back then, and you'd need four of them.

You'd need at least a four channel one to read a dual joysticks in the PC two pots per thing. And of course, there was no such thing as microcontrollers back then. Essentially what we take for granted these days of our pick our AVR microcontrollers and they've got building a DC's up to 12 bits. And like all these peripherals, building basically microcontrollers didn't exist.

Back then. we had micro processors, which is what all these pcs ran on and if you wanted ad says you had to buy a separate ADC chip and they'll quite expensive because you've got to remember something like say, the first sort of reprogrammable microcontroller, the Pic 16 C 84 which used a squared prom. None this stuff less rubbish that didn't come out until 1993 and that didn't even have a built in ADC So you know you take these things for granted these days, but you haven't always had these micros with all these peripherals and a DC's built in, especially back then, so the clever designers went well. We've got a cut: cost doesn't get much cheaper than a Triple Five timer.
Let's take a look so you should be familiar with the classic Triple 5 timer and the various building block circuits that come along with that, and it's been popular for what? four decades or something and they still must produce this thing. Found a Triple 5 timer doing little one-shot and other timing type applications in a lot of the older vintage pcs from the 70s and 80s. in this case, the classic one-shot monostable circuit. And you know, familiar with this classic building block circuit.

We've got our resistor up here. you connect the discharge and the threshold pins. I won't go through how the triple five of our timer works. Triple Five timer t-shirt my hand-drawn t-shirt linked in down below.

By the way, if you want to check it out either, recommend you do. And then a cap go into ground and basically we have a negative going trigger pulse coming in. so when your trigger pulse goes low like that, it starts the timer which will produce a single pulse, the pulse width of which the time of the pulse, width is determined via the RC time constant here. And of course, if you're a place the resistor here with the pot used inside the joystick here.

Bingo! You've got yourself a proportional time pulse variable time pulse that will vary based on the position of the joystick. And because you've got a PC which has various timers and things built-in we can actually time in software how long that pulse takes. It's neat, so there's no need to convert an analog value into a digital value using an ADC. You can simply do it using a timer based approach.

and PCs are really good at doing timing, but of course, you need four of these triple five timers. Well, you didn't want to use for separate chips. Bugger that. But of course the Triple Five time is available in both the single one which is a triple five also the Five Five Six which is the dual triple five, and Tada the Five Five Eight, Quad Triple Five time.

I'm not very often used these days and this is what you saw in the teardown of the IBM PC Jr.. which has the original IBM game card or whoever made the design the IBM game card. It used a Five Five eight timer which is four triple five timers in the one chip and it was super cheap and there's basically not much more you had to add to it, so it had the four channels we could hook up the four joystick pots here. a four capacitors going to ground, they'd all be the same value.

might be typically 10 nano farad's or something like that. depends on the the speed of the PC and the timing and the hundred K used up here and stuff like that and Bingo! You would actually tie all the triggers together like this because they were independent timers in here. but if you tied them all together then then they all start at once as we'll see in a minute why. And then you would get the different pulse links out depending upon the position of each one of the joysticks.
The X&Y on joystick one and the X&Y Enjoy! Stick to beautiful and all the PC has to do is read the time period from there to there that are there that are there and that are there. Easy Peasy Lemon Squeezy. But of course the PC being the PC. It uses a data bus in the case of the IBM PC.

Of course, because it used the 8 O 88 processor, it had an 8-bit data bus instead of the 8 O 86 processor which had a full 16-bit data bus. We have to somehow get this hooked up to the data base so that we can use the timer's in the PC to actually time it. So how do we do that? Easy. We just hooked it up to a latch here, buffer / latch and then we would of course do the address decoding.

I won't go into architectures of PCs and stuff like that, but basically every every peripheral everything. every I/o port or memory port on the PC needed a particular address so it'll have an address decoder here typically using discrete and you know NAND gates and or whatnot stuff like that so that the and decode the address which is specific to the joystick. It did enable the chip and you could read back the values on all the on all four of these timer outputs here. but of course the joystick also had two buttons on so you could use the other four inputs here for the two buttons.

And of course you'd have an 8-bit data latch which then would go off to the PC bus. But how do you trigger it? Well, you use the address, same address decode but instead of reading back the data, you would actually write it. Some PC right pin would actually go to the trigger so you just write something to that address. It doesn't matter what data you wrote cuz the data was useless.

All you wanted to do is trigger these so you'd write to the particular joystick address and then you continually read back and until the end of the time period. But the problem with this approach of course is that it requires software timing loops and that ins a real problem to Pcs as they got faster and everything else. So there were very I believe there were various schemes eventually to compensate for that sort of thing, and ultimately all of this stuff would be built into the motherboards instead of add-on cards to be built in to the motherboard chipsets and things like that. But of course you still used the classic Five Five Eight on the output.

But you know all this stuff typically started to get integrated into the chipsets as time went on. So there you go. I Think that's a rather cheap and clever way to do it. All you needed was a five five a a couple of hours and C's hooked it up to your D 15 connector for your joystick and your buttons over here and Bob's your uncle.

You could just have a little address decode and read it back. Very simple and of course if you want to degrade a precision in reading the position of the pot, you had to do finer and finer reads on your port so that you could read the pulse-width there with greater precision. and we can actually see the value change here if we move the joystick. but of course you could trim it.
You had these little trimmers on the front that you can move back and forth to Center that and you can see the physically the joystick actually sorry, the pot actually moving back and forth as I tweak that trimmer on the top so you know you might want to trim it to the center or something like that. And if I move the joystick, you can see that it went all the way with LBJ up to 120 K The spots weren't very precise back in the day and then they go down to zero like that so you'd get the fool mostly the full range of the pot there. And if we actually have a look at the IBM PC Jr. motherboard, we can actually see the triple 5 timer up in there as we saw in our previous teardown.

There it is the classic National Semiconductor genuine. None of that ripoff rubbish Five, Five, Eight quarter, Triple Five timer. You'll notice some some of the time in caps there because of course you didn't want your PC shorting out and having no resistance at all in series with your cap. so they'd put some resistors in series for that just to give you and like, a restricted n stop type value on your joystick when your joystick shorted out and went to zero.

And of course, due to the proximity to the 508 there, that's almost certainly the buffer right. Used to go onto the PC bus. your absolute classic Sim 4 LS are 2, 4, 4 and they'd have probably some of your decoding stuff up here as well. And of course I'd love to show you the timing on this.

Unfortunately, if we have a look at the outputs here, of course then it actually does nothing. It's actually not triggering the output. It's not giving any pulses whatsoever on there because those timers wouldn't actually turn on our trigger unless the software was actually writing to that address. So you're running a game or something that was continually polling the joystick.

So in this case, this PC Jr. doesn't work. Oh, now the Tandy 1000 is interesting in that it actually uses a slightly different Hardware implementation. It doesn't use the triple 5 timer, so let's actually take a look at how it actually does it.

Here's the block diagram here. It's essentially doing exactly the same thing as what we were doing with the triple 5 timer. It's producing a proportional pulse with timer output based on a trigger signal. But it's doing it using an integral here.

and that's what that little fancy symbol is integral of IDT there. What that means is that it's just producing a ramp which starts at 0 when you trigger it and that voltage ramps up. and if we have a look at the schematic here, you can see that that little ramp generator there with the J FET There it just generates a ramp voltage which then goes into our comparators there which then the joists. The voltage from the joystick just goes into these four comparators and then of course once the ramp voltage gets up and reaches each individual joystick position, the comparators flip over and produce a zero instead of a vice versa.
and then the PC can actually read that as a time period. Exactly the same as a triple five timer, except the hardware implementations. A little bit different, but it works exactly the same and you can see the seven four, LS, two four four buffer on there and the right and the address decoder and the right signal. and the read signals work as well.

It works exactly the same as the original IBM PC game adapter. In fact, the software as long as you kept the read and write address the same software wouldn't even know the difference. Wouldn't know whether using the integrator there like the ramp generator and the comparator or whether or not you using the triple five timer still going to work exactly the same software wouldn't notice the difference I accept if there's some variations in there in the actual timing itself. but apart from that not you get the same thing and I'd love to show you the Tandy 1000 working as well.

This is the IBM PC Jr. 1000 down in my storage bunker, but I can't find my five and a quarter inch boot floppies. so I just can't get the thing going. and without that software, there's nothing to trigger the polling or whatnot without even being able to boot up DOS to then you know, be able to write to the joystick address to trigger the damn thing so that we can see the time and stuff like that.

But I hope they gave you a good idea of how the IBM PC joystick game adapter actually works. It's not the greatest solution because it is, you know, software timing-dependent You've got to be able to accurately measure the time periods and do it fast enough to respond to all the joystick controls and of course Pcs. Back then they had to share all the same bus and they were all doing. You know they had to do everything at once, but you know it, it actually worked back in the day and that was a fairly cheap and simple solution to bring the component cost down instead of using an ADC or something like that.

So anyway, I hope you enjoyed that and found it useful. If you did, please give it a big thumbs up. As always, discuss down below in the YouTube comments or on the EEV blog forum and there's a couple of videos here at the end you should check out and faced all my patrons and supporters who are keep this channel going. You can probably find a link here at the end somewhere too if you want to join anyway.

catch you next time.

Avatar photo

By YTB

20 thoughts on “Eevblog #1054 – how an analog pc joystick works”
  1. Avataaar/Circle Created with python_avatars Jim Leonard says:

    5 years too late, but you actually didn't need a boot floppy to test the joysticks: The PCjr has built-in diagnostics, including a joystick routine. Hit CTRl-ALT-INS after POST, and then press spacebar until the cursor is by the picture of a joystick, then hit ENTER. At that point, the ports will be constantly triggering to show an image you can use to calibrate the joystick positions.

  2. Avataaar/Circle Created with python_avatars Mark Harrington says:

    Don't see engineers like this any more do you ??

    Very Interesting and they say engineers of the modern world are good … Mmmmm

    In those days , and not that long ago , you had to work to component level even up until the late 1990's early 2000's which meant smt ( surface mount components)

    There was not to much of this , Oh just throw it away and buy a new one or swap the board story

    You had to be able to read a schematic , draw and assemble test etc

    What a joke this is now with most of the supposed technical experts on front line desks who only can answer from a script and they do not have a clue at all

    You may well ask and rightly so as to , "Do you call that training or producing professionals ?" , because I dont !!

    Excellent by the way !!

    I thoroughly enjoying watching and listening to someone whom knows what they are talking about and what a change that makes !!

    On that note I'm going to let the rest of you work out what they have done with this including how your supposed experts you elected tell you how good they have been with training as this become more and more evident in Industry over all particularly in the UK which is quite disgusting as to what they have done never mind a few other factors surrounding this

    These are jokers you have had power , controlling business for years as I stated on Instagram , they have actually taught you nothing which is why your imports etc are failing , and you have very few UK made exports

    Its been sealed throw away junk which of course you wouldn't open being advised its too expensive Is it now I wonder and who is paying the price as usual which also now leaves you without people of this category that have that know and how and where suppliers can easily rip you to smithereens

    See it doesn't work does it or produce professional engineers , designers , installers and many other factors but who am I to repeat all that many other professionals said years ago

    Could you do one of the Ps2 and how that all works Id be interested to see that too

    Thank you by the way , very good explanations

  3. Avataaar/Circle Created with python_avatars Ron Monks says:

    I'm not educated in electrical circuits at all. I want to learn enough so that I can build a joystick control system which will control a 12v trolling motor on my kayak. I want to increase the speed as I push the stick forward and go in reverse as I pull the stick back. At the same time I want to be able to steer the kayak by rotating the motor by moving the stick left and right. And finally, if I fall overboard, the motor should stop as the stick automatically goes to the neutral position. I'm guessing the type of analog joystick shown in your video might be able to do this when connected to servos or actuators to rotate the motor. Am I on the right track?

  4. Avataaar/Circle Created with python_avatars rovpilot1 says:

    Man your comment is uplifting, great video thx

  5. Avataaar/Circle Created with python_avatars Trending Live says:

    Great videos, add some specific topics also to have some deeper knowledge. Although all your videos are great. 😀👌👍

  6. Avataaar/Circle Created with python_avatars 13lake says:

    Could you do an in-depth study of how a modern Xbox or Dualshock analog stick works? And why my Joystick tester on PC shows shaky analog axes and drift sometimes?

  7. Avataaar/Circle Created with python_avatars savirien says:

    Yeah I remember how clever these old joysticks were. I remember fiddling around forever trying to get them to zero out properly (without randomly drifting in one direction). Then you finally get it right and on the next reboot it was back to drifting again! Thank the guy that came up with rotary encoders instead.

  8. Avataaar/Circle Created with python_avatars Retro Box Room says:

    Would it be possible to make an external adapter to convert any PC analogue joystick to a BBC micro?

    I don't know enough about electronics

  9. Avataaar/Circle Created with python_avatars KeithMinnicksRacing says:

    Hello, do you repairs? I am a 1 handed gamer. I have 2 of the old edimensional access ben heck designed controllers. It uses like 4 universal boards so you can move these little pods into different locations. I have 1 arrangement (eventually i like to make my own permanent controller, because i think the universal boards cause issues.) Anyways all 4 of my joysticks (both lefts and rights [use as lefts sometimes with remapping]) ill show input when not being touched or not resetting to 0 after letting go of joystick. Makes playing ro oncket league really hard. I order a ps2 potentiometer but the one that is in the access controller pod has a small 32 pin connector on bottom of it that connects it to the board. I cant even figure out how to get it out of the pod, im guessing you need to pop off the joy stick pad somehow or remove board from potentometer. I be willing to pay for getting new potentiometers in my access pods

  10. Avataaar/Circle Created with python_avatars jimmi henry says:

    Holly smoks you can buy a 5 1/4 Floppy Brand new!!!
    Guess i need a Floppy drive now. Good old times!

  11. Avataaar/Circle Created with python_avatars foo says:

    The joystick port in the SoundBlaster, which later became the PC standard, was directly connected to the bus with a single I/O address. There was no timer, only capacitors. To read the axis positions, software would write to the port to reset the capacitors, and then read the port in a tight loop until the bits flipped. There was no precise enough timers on the PC, so the time was measured using a counter in the loop. Of course this doesn't allow any inference during the loop, which meant disabling all interrupts for devices like the keyboard and soundcard. Which doesn't work that well in a modern multitasking operating system…

  12. Avataaar/Circle Created with python_avatars Network XIII says:

    The amazing 555, is there anything that it can't do?

  13. Avataaar/Circle Created with python_avatars Axel Werner says:

    Dave, you should start upload your stuff on dtube too.

  14. Avataaar/Circle Created with python_avatars Gerff says:

    I HAD ONE OF THOSE!!

  15. Avataaar/Circle Created with python_avatars Peter Schmidt says:

    It was interesting to see how these little guys worked and explains a lot about how inaccurate the joysticks were back then! I can remember playing games on similar PC's back in the day and all of sudden your character would start walking in the opposite direction to what you'd selected on the joystick. I always thought the software was the cause, but I reckon it was just the slow speed's of the PC and not being able to scan the joystick ports quick enough with the shared resources.

  16. Avataaar/Circle Created with python_avatars Peter S says:

    Woz invented that circuit in 1976 and used it in the whole AppleX series.

  17. Avataaar/Circle Created with python_avatars ajar says:

    I wonder how much of a delay the timing of the 555 signal width causes to the input signal

  18. Avataaar/Circle Created with python_avatars BlackEpyon says:

    Fun fact: The Tandy 1000 series, up to the RLX (which was, I think, the last model based on the PC-Jr) could use a joystick in lieu of a mouse in DeskMate.

  19. Avataaar/Circle Created with python_avatars Jonathan Fadden says:

    Steve Wozniak (Apple II) first came up with the RC design. In a presentation, he said something about this being cheapest way he could think of. The timing was all done in software.

  20. Avataaar/Circle Created with python_avatars Shawn Hicks says:

    I recall that joystick being branded "CH Products" and "Kraft".

Leave a Reply

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