2
\$\begingroup\$

I am trying to do read the key presses from a calculator via a parallax propeller board (it's actually a DefCon 20 badge) into my computer via USB. I want the calculator to remain fully functional as it is, but I want to get a "copy" of the key press signal into the parallax board.

(From there I have software to take serial/USB data and process it and do other stuff with it - so after the signal gets to the propeller chip, I'm good from there, I've written the Spin code to read the pin on/off states and write out serial data to the USB, etc.)

The calculator board looks like this. (The lower image is flipped horizontally so I could see where the holes line up easier, and thus the numbers are backwards. And I've arbitrarily labelled some of the contacts so I can refer to them below.)

enter image description here

These are the data I'm working off of (please let me know if I've run aground somewhere here):

  • The calculator runs at 1.5v (it's printed on the board and the LR44 battery is 1.5 volts)
  • The propeller board runs at 3.3v per the docs.
  • After looking at this board, I assume that something similar to a "keyboard matrix circuit" (http://en.wikipedia.org/wiki/Keyboard_matrix_circuit) is what is being done, i.e. the calculator has 25 buttons, and so instead of needing 25 pins on the microcontroller it can do it with less (10?) by looking at a combination of pins and shorts (I would assume one set for rows and one set for columns, but it doesn't appear to be that simple.)
  • I was going at this with the assumption that I could put a set of transistors between the calculator and the propeller and thus detect when 1.5v is coming from the calculator and have this allow 3.3v to pass through the transistor and thus cause one of the pins on the propeller to be on (at the right voltage - 3.3). But I'm missing something on how this matrix circuit is supposed to work.
  • In the picture above, from what I see:
    • pressing the "1" button shorts A and Z.
    • pressing "2" shorts A and Y.
    • pressing "3" shorts A and B.
    • pressing "4" shorts A and C.
    • pressing "5" shorts A and D.
    • ...
    • pressing "7" shorts E and Y.
    • ... and so forth ...

(Somewhat) specific questions:

  • Can someone shed some light on how that key matrix thing is supposed to work - and any info on how I could tap into that for my purposes?

  • More specifically - how does the microcontroller detect the specific pin shorts? And how would I "translate" this into something I can read on my propeller? The propeller board seems to operate off of "if you apply 1.6v+ to pin N then it's on", but it does not seem to have a concept of "output M volts on pin N and the check if that voltage has been 'sunk'"... - which I imagine is what the microcontroller on the calculator is doing, i.e. if pin Q is outputting 1.5v and it's 'sunk' and pin R has an input of 1.5v (i.e. Q and R are shorted by the key press), then that means the "=" button was pressed - something like that - from what I can tell. So do I need to build a simple circuit to translate this matrix circuit into something I can read with the propeller? (I think I only have about 12 free pins to work with on this propeller board, as a note.)

  • Do I need to connect the ground of the propeller board to the ground of the calculator. A friend of mine mentioned that this was necessary - I'm not tracking on that.

Disclaimer: In case it wasn't obvious from the above, I'm a software guy trying to learn electronics. I've done a fair amount of reading and googling before even making this post, but I'm still fairly lost, as you can probably tell. If the answer to some of this is "you need to learn about blah, here is a link to a good tutorial" then by all means...

EDIT: So after a bit of work, I was able to get it so I can see the strobes coming from the calculator's microcontroller to my propeller. (I programmed the propeller to loop over and read the pins and report what it's getting). Luckily the clock speed on the parallax is sufficiently faster that I can "see" the strobes for about 5-6 input samples before it changes. The key things I was doing wrong previously:

  • I did not connect the two grounds (the parallax board and the calculator). When I didn't have these connected, it would seem to work for a bit and then I would get random noise. I don't totally understand why, but connecting the two grounds (negative terminals) seemed to resolve that.

  • After measuring the voltage on the two devices, I tried testing all this without transistors and it worked fine (and was simpler). The calculator seemed to run at about 2v instead of 1.5v as advertised, and the propeller was running a bit over 4 (instead of 3.3v). So figured if there's that much variance, it may work fine to just use them without converting the voltage. That worked - connected directly from the calculator board to the propeller pin and nothing melted and it seems to work.

So at this point, the hardware basically works and I'm mainly back into the software aspect of decoding the strobes and turning this into something I can use.

Thank's for the answer(s) and comments, it did help.

\$\endgroup\$
  • \$\begingroup\$ fairchildsemi.com/pf/MM/MM74C922.html \$\endgroup\$ – Ignacio Vazquez-Abrams Aug 20 '13 at 19:43
  • \$\begingroup\$ @Ignacio - thanks, I get the general idea. Perhaps there is a board that has one of these, or a similar chip - preferably something geared toward a hobbyist/learning application - that would make this whole task simpler? \$\endgroup\$ – bgp Aug 20 '13 at 20:11
  • \$\begingroup\$ One thing you will need to be aware of is that the buttons will not act like perfect switches. When they're in the "closed" position (when you are pressing the button), the resistance across the switch may still be as high as several hundred ohms or more. \$\endgroup\$ – Connor Wolf Aug 21 '13 at 4:55
  • \$\begingroup\$ @ConnorWolf - thanks for that. Am testing some things out and assuming I can figure out something meaningful I will post with my results. \$\endgroup\$ – bgp Aug 22 '13 at 3:28
1
\$\begingroup\$

The key matrix works by "strobing": apply power to one line briefly, see if it's shorted to another one. Normally I'd expect to see pullups or pulldowns to avoid floating lines, but I can't see them; they might be inside the chip.

You're on the right track with your transistors to convert 1.5V to 3.3V. You can get logic level converter ICs to do this all in a nice package. Given that you don't have a scope, you might just as well get the propellor to do the data reading, if you can write an app that just reads pins, looks for changes, and sends timestamped results to a PC for visualisation. Connect this to the A-Z lines. Power on the calculator. You should find that it's strobing some of the lines, and some of the other lines will become connected when keys are pressed.

\$\endgroup\$
  • \$\begingroup\$ I see, so if I deal with the voltage using transistors (maybe just rig this up on a breadboard), I could just try hooking up each key contact point on the board and read it with the propeller and see what I get. I guess that's worth trying. \$\endgroup\$ – bgp Aug 20 '13 at 21:07
  • \$\begingroup\$ Btw, I did get this basically working. Was a little funky in terms of the data being fuzzy, presumably due to some lines being left floating in various places. But the above approach is essentially what I did. Thanks! \$\endgroup\$ – bgp Sep 21 '13 at 11:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.