Shop OBEX P1 Docs P2 Docs Learn Events
How to: Wire 4x4 Keypad to work with PCF8574A I/O expander chip? — Parallax Forums

How to: Wire 4x4 Keypad to work with PCF8574A I/O expander chip?

SteveWoodroughSteveWoodrough Posts: 190
edited 2013-03-02 20:48 in General Discussion
I am trying to duplicate the setup given in this link, using a standard 4x4 key pad (same as sold by Parallax), and the PCF8574AN I/O expander chip.

http://www.instructables.com/id/CHIP-8-and-the-Pocket-Mini-Computer/step5/DIY-4X4-Keypad-Required-Parts/

For software I am using the driver: http://obex.parallax.com/objects/search/?q=pcf8574&csrfmiddlewaretoken=9f407a2d35db5b615c53fd64f0384712


The good news is that the chip and the driver, Craig Webers PCF8574 Driver Test.spin, v1.0, work just fine. By that I mean I ground any input to the PCF8574 chip, I get a corresponding result on the PST.

The question I have is exactly how to wire the 4x4 keypad? In the example shown in the link above, the keypad is wired directly to the I/O expander one for one. Each keypad pin out is assigned to an input on the I/O expander. This is not working, and that result makes sense since there is nothing driving the input to the I/O expander low. With the keypad connected to the I/O expander, each keypad press simply connects one input with another.

There is some simple bit of engineering I’m missing.

Thank YOU

Steve

Comments

  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2013-03-02 14:07
    Steve,

    Is this the circuit you are replicating?
    http://www.instructables.com/id/CHIP-8-and-the-Pocket-Mini-Computer/step11/The-PCF8574A-I2C-Circuit/

    Do you have a PFC8574 chip or a PFC8574A chip? I discovered a difference in the address $38/$20 that made all the difference when I did that project. I also discovered that Taiwanese vendors don't always know the difference.

    Jeff
  • doggiedocdoggiedoc Posts: 2,243
    edited 2013-03-02 14:14
  • SteveWoodroughSteveWoodrough Posts: 190
    edited 2013-03-02 14:38
    Jeff,
    THANK YOU for the response. I am using an PCF8574AN chip from DigiKey. The address I am using is 56 (same as 38 in Hex, all address lines pulled low) . Using the standard OBEX 8574 driver and test program the chip works. If I was going to simply monitor 8 switches going to ground, life would be easy. Iith the above object I get a binary result with each pin I ground. If I ground P0 I get 01111111. If I ground P3 the result is 11101111. The part I cannot figure out is how to ground a pin when the membrane keypad is not connected to a ground. If I use the setup shown, all I am doing is connecting one I/O expander input pin to another each time I press a switch.

    STOP! I think I see the problem. I'm using the PCF8574 object and that is WAY different than your object to read the 4x4 keypad. Let me play with that a while and I'll post a result one way or the other.

    Thank You!!!
    Steve
  • SteveWoodroughSteveWoodrough Posts: 190
    edited 2013-03-02 14:46
    Paul,
    Will any old PNP's work? What size resistors? 10K?
    Thank you
    Steve
  • doggiedocdoggiedoc Posts: 2,243
    edited 2013-03-02 14:58
    Steve, I used 1k resistors and 3906s but pretty I'm sure any PNP will work. PM me your address and I'll send you one of the prototype boards (bare) at no charge.

    Paul
  • doggiedocdoggiedoc Posts: 2,243
    edited 2013-03-02 15:01
    Here is the board I ordered in this post: http://forums.parallax.com/showthread.php/144862-My-First-ExpressPCB-order...-help-review-please!?p=1153611&viewfull=1#post1153611


    I've improved the design some, with ground plane and another shorter board to fit the Propeller Platform standard. I haven't done much with it since the holidays. Perhaps I should finish. :D

    The revision that I submitted works flawlessly, however.
  • SteveWoodroughSteveWoodrough Posts: 190
    edited 2013-03-02 16:20
    SWEET design Doc! I would NEVER have figured this out. I breadboarded your design and it worked the first time with some old PNP's. I like how it makes the nominal output 00000000 too. I also ran with some 10k's just for grins. Seems to work fine. I'll PM tonight.

    THANK YOU!!!
    Steve
  • doggiedocdoggiedoc Posts: 2,243
    edited 2013-03-02 16:25
    Did you see my Prop code in that thread? I'm pretty sure it's attached somewhere. I don't know if I would call it a driver or not but....


    BTW- the credit really should go to Beau Schwabe. He came up with the idea for the transistors. My original design used optoisolators!@!
  • doggiedocdoggiedoc Posts: 2,243
    edited 2013-03-02 16:27
    Here is the original thread where I started the design concept:

    http://forums.parallax.com/showthread.php/143382-4x4-Keypad-Decoder-the-Hard-Way
  • SteveWoodroughSteveWoodrough Posts: 190
    edited 2013-03-02 16:56
    Paul,
    No, I did not. Thank you for redirecting me there. Keypad mapping was to be tomorrow's project!

    I looked at your original post earlier while researching my problem, but it seemed to the inexperienced gearhead (me) that you were going around about things in a difficult manner.

    Your post with the pcb and circuit never came up when I searched "keypad" or "8574" so I could not associate your solution to your original work.

    Excellent work, thank you for sharing.

    Steve
  • doggiedocdoggiedoc Posts: 2,243
    edited 2013-03-02 18:53
    I should probably unify the two threads with a summary thread.
  • NWCCTVNWCCTV Posts: 3,629
    edited 2013-03-02 19:40
    Doc, Are the boards made up and ready to use? I wiould buy one from you if they are.
  • doggiedocdoggiedoc Posts: 2,243
    edited 2013-03-02 20:48
    It wasn't my intention to sell these. I had a some prototypes made to verify the basic concept. My plan has been to refine the design and make a kit. I was hoping I could get OBC to stock them on Propellerpowered.com when I get a finalized board. The prototype I built works fantastic.

    I have one more bare board I can send you. Jeff (OBC) stocks the chip and other parts you need to build it. It builds easily. The hardest part is trimming the header pieces neatly. :D

    PM me your address and I'll send you my other bare board at no charge.
Sign In or Register to comment.