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.)
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.