Need help reading a vintage calculator keyboard with modern hardware - Page 1
Forum section: electronics / projects

author: rea5245
author_rank: Frequent Contributor
timestamp: July 02, 2019, 02:08:07 am
content: Hi,I'm trying to read an old keyboard from the Wang 300 series calculators. These calculators from the '60s used nixie tubes, diode-transistor logic, and power supplies of -11V, 0V, and +11V. -11V was logic True, 0V was logic False, and +11V was just used as a pull up for the PNP transistor bases.I want to read this keyboard from a PIC32 using 3.3V and GND. I'm getting some good results, but I'm also seeing behavior I don't understand.I've attached the keyboard's schematic. My understand of DTL logic is weak and my understanding of what happens when I try to substitute voltages is even weaker.My approach is to set the keyboard's "-11V" line to GND and leave the "0V" and "+11V" unconnected. I set KBE (Keyboard Enable) to GND. KBC is also unconnected. I'm hoping that by not driving the transistors, I'm just leaving that part of the circuit disabled and keeping things simpler. I need to read the key press from KB1, KB2, KB4, KB8, KB16, and KBI. I thought the way to do that was to connect those to the PIC32's inputs with the internal weak pull ups (WPU). When a button is pressed, it would connect the cathode of certain diodes to the keyboard's -11V line (which I have set to GND) through a 33K resistor. That would pull selected pins down to GND.That was the plan anyway. What happens is that the inputs all remain high even when I press keys.(The diodes are FD1684. I can't find a data sheet for them, so the forward voltage is unknown.)So I tried turning off all the WPUs except one, on the KBI line. That works a little better. When no key is pressed, I read 0x3f. When the Change Sign key (which has diodes on all the inputs) is pressed, I read 0x00 (the schematic says the key code is 63, or 0x3f, so I'm reading the complement of that). When I press the 0 key, I get 0x0f (which is also good: the schematic says the 0 key is code 48, or 0x30. When I read 0x0f, I'm getting the complement of that.) I was happy until I pressed the 1 key (code 49, 0x31) and I read a value of 0x00. In fact, most keys read as 0x00. The 5 key (code 53) reads as 0x3f but maybe it's just broken. The Enter key (code 33, 0x21) sometimes reads as 0x1e (which is good - the complement of 0x21) but I've also seen 0x00, 0x20, and 0x02.I don't understand why having a WPU on all the lines does not work. I don't understand why having a WPU on only one of the lineseverworks. And given that it sometimes works, I don't understand why it always works for some keys, never works for others, and intermittently works for some. Can anyone explain it?As a last resort, I could generate +/-11V for the keyboard, but then I'd need level shifters for the PIC32. I'd love it if I could just drive this keyboard with 3.3V. Is it going to be possible?Thank you,Bob

author: duak
author_rank: Super Contributor
timestamp: July 02, 2019, 03:03:41 am
content: I would tie the PIC ground directly to the net tying all the bottom ends of the micro switches together, ie., the collector of the righmost 2N404. This should remove the effects of the 33K resistor and other possible sneak paths.The Weak Pull Up (WPU) still may not source enough current to assert a logical 1 on the inputs. Also, I see the term "micro switch". It's possible these switches were made by Honeywell and, if memory serves, the switch contacts were a couple of gold plated wire springs arranged at right angles. These were very good, but after a few years crud may build up and they become intermittant. You might want to try something like 10K pull up resistors to ensure there's enough current to give a solid high level. If the diodes are silicon, the logical 0 voltage into the PIC will be OK but won't have much noise margin.

author: rea5245
author_rank: Frequent Contributor
timestamp: July 02, 2019, 05:16:07 am
content: Tying to PIC to the net connecting the switches is not an option. It doesn't come out to the edge connector.

author: duak
author_rank: Super Contributor
timestamp: July 02, 2019, 05:13:42 pm
content: So any modification of the keyboard is out? If so, then the switch common has to be held close to 0V. I think this can be done by using +-0 as the ground to the PIC and applying -11 V to the -11V net. The 33K resistor will pull the switch common to -11 V but the rightmost 2N404 will be turned on pulling the switch common up towards ground. The 2N404 is germanium with a low saturation voltage so the switch common will be a few hundred mV negative. This is OK because the diode matrix will introduce a positive voltage offset of a few hundred mV thus compensating for it. The +11V net can be connected to +-0V.If you want to get the other switches working too, then this will have to be reconsidered. Are you trying to re-use the calculator with more modern internals?Experimentation may show that the whole shootin' match could be operated from +/-5 V. Unfortunately, a negative voltage is required unless the assembly can be modified.

author: rea5245
author_rank: Frequent Contributor
timestamp: July 02, 2019, 09:33:03 pm
content: Do you have any theories to explain the behavior I'm seeing? When I have only one WPU enabled, all the KBx nets read as one, so not only is the single WPU strong enough to read as 1, it's somehow getting through all the diodes and causing all the the KBx nets to read as one. And when a key is pressed, it brings the KBx nets down to 0, but it doesn't always bring the right nets down. I don't get it.I'd strongly prefer not to modify the keyboard. And I want to be able to read the other switches.The Wang 300 calculator had a separate keyboard and computing unit ("Electronic Package"). The EPs are rare, expensive, and usually in need of repair. The keyboards are cheaper and a little more common (one EP could support multiple keyboards). My idea is to make a modern board that brings a keyboard to life and emulates the original EP's behavior. I could make them available to the dozen or so people on the planet who would care enough to want one. So I want something that's as easy to install as possible. That means not modifying the keyboard.

author: bsccara
author_rank: Contributor
timestamp: July 03, 2019, 01:29:03 am
content: Have you measured the voltages at the PIC32 input pins ? That should shed some light into the problem...Remember that an input without a pull up/down is just floating and the PIC can read any value at any time. Even leakage currents in a breadboard can create crosstalk between inputs.A weak pull up can be thought of as a variable resistor dependant on multiple factors, with a resistance range of tens to low hundreds of KOhms. Having that being pulled down with a 33K resistor and a diode puts a voltage on the input pins that most likely is between the high and low thresholds so it keeps registering as 1.So you'll probably need to condition the signals from the keyboard, using opamps to implement your own Schmitt triggers. That way you'll be able to set the trip voltages to accomodate the voltages from the keyboard. Since its a keyboard pretty much any opamp that can work at 3.3V will do since it does not have to switch that fast. Some PICs even have comparators built-in that could be used for this.

author: duak
author_rank: Super Contributor
timestamp: July 03, 2019, 02:03:08 am
content: I haven't used a PIC since the 90's - the I/O pin structure is now a lot more capable and complicated. I understand the WPU source current can vary over a range of 80 uA to 400 uA. This current can develop anywhere from 2.64 V to 13.2 V across the 33K resistor. I'd say the switches and diodes cannot guarantee a logical 0 signal (< 800 mV) into the PIC. It looks like there might be a sneak path through the 22 R & 1 uF cap to +-0V and thence to -11V (your ground) that allows for a short time where the input signal might be interpreted as a logical 0.Since this calculator is from the 60's and uses germanium 2N404 transistors, I wouldn't be surprised if the diodes in the matrix are germanium too. These diodes can have significant leakage current that are contributing to some of the input bit crosstalk.I wonder too if some of the transistion detection circuitry on the I/O isn't being enabled and is holding the pin in a state longer than expected.I've suggested a way to operate the keyboard; you could try it and see what happens.

author: rea5245
author_rank: Frequent Contributor
timestamp: July 12, 2019, 08:13:09 pm
content: In case anyone cares, I've figured out a good (best?) way to do this.Connect the -11V net to GND, the 0V net to 3.3V, and the +11V net to 12V. Pull the KBx outputs up to 3.3V through a 1M resistor. That results in logical true being 0.4V and logical false being 3.0V. The toggle switches can also be read safely by a microcontroller.Thank you to the people here who responded. You put me on the right track to figuring this out.- Bob