Human input device - reducing pin count
JBWolf
Posts: 405
Hello,
I have a prop running as the controller on my latest project which is very tight for space (12mm diameter casing).
Had to design and CNC my own boards using the QFP chip to just barely squeeze in there, but it works great!
It's been just a standalone system that has to be taken out and re-programmed for any kind of software changes.
What I would like to do is add a port for connecting the prop (without removing from the case) a control pad so I could interface with the controller when changes are needed
I wish I had the room to use a keypad system such as the one offered in the parallax store... but I just dont have the room for that many pins on the PCB.
I have managed to get 3 output pins available on the prop for external use... but I could really use more than just 3 buttons for input.
Is there a device or method that I can use with 3-pins or less to get say 6+ buttons?
Ideally I would like to enter a code that will correspond to preset functions I have pre-programmed into the controller software.
for example if the buttons were labeled 1 through 6.... I could use button 6 for entering/exiting 'user input mode' and then proceed to enter a numerical value such as 2534253.
There are thousands of possible configuration permutations, which is why I could use more than 5 buttons.
The key is that the input device can only use 3 prop pins. Since it would be connecting externally, only the connector need be small (which I have plenty of tiny 3 and 4 pin connectors).
Any ideas?
Heres a pic of the controller... as you can see, the width of the board is exactly the width of the QFP chip pins. A delicate soldering task indeed!
The crystal and eeprom are on the other side of the board (through hole)... everything else is right here including resistors, caps & 3.3v regulator.
I already have started on a new revision that uses SMC eeprom and crystal to get all components on one side.
I have a prop running as the controller on my latest project which is very tight for space (12mm diameter casing).
Had to design and CNC my own boards using the QFP chip to just barely squeeze in there, but it works great!
It's been just a standalone system that has to be taken out and re-programmed for any kind of software changes.
What I would like to do is add a port for connecting the prop (without removing from the case) a control pad so I could interface with the controller when changes are needed
I wish I had the room to use a keypad system such as the one offered in the parallax store... but I just dont have the room for that many pins on the PCB.
I have managed to get 3 output pins available on the prop for external use... but I could really use more than just 3 buttons for input.
Is there a device or method that I can use with 3-pins or less to get say 6+ buttons?
Ideally I would like to enter a code that will correspond to preset functions I have pre-programmed into the controller software.
for example if the buttons were labeled 1 through 6.... I could use button 6 for entering/exiting 'user input mode' and then proceed to enter a numerical value such as 2534253.
There are thousands of possible configuration permutations, which is why I could use more than 5 buttons.
The key is that the input device can only use 3 prop pins. Since it would be connecting externally, only the connector need be small (which I have plenty of tiny 3 and 4 pin connectors).
Any ideas?
Heres a pic of the controller... as you can see, the width of the board is exactly the width of the QFP chip pins. A delicate soldering task indeed!
The crystal and eeprom are on the other side of the board (through hole)... everything else is right here including resistors, caps & 3.3v regulator.
I already have started on a new revision that uses SMC eeprom and crystal to get all components on one side.
Comments
I think this will do what you want:
Each group of two switches is connected to a different pair of pins. By raising one pin high and reading the other, you can tell if the switch is closed.
-Phil
I'm pretty sure I heard about it in this thread though I didn't see the reference from a quick glance through the posts.
-Phil
HHH
HHL
HLH
HLL
LLL
LLH
LHL
LHH
given that LLL (all low) would be a base condition and HHH could be the 'user input mode' activator... thats 6 independent buttons
Good point. That makes perfect logical sense. A few years ago I did an 5 button RCDecay setup but never had mis-reads. I can't find my project code, but I think I may have experienced this so my project was set up so that a "valid button press" required two consecutive readings in the same value bracket. I guess my version of RCDecay Debouncing? My Cap/Resistor values were such that an RCDecay cycle was very quick, so a button press didn't take an unnatural amount of time and worked very well. I think it's somewhere in my garage still.
Now there has been some mention of RC inputs and this is a technique I used to couple switches on vending machines back in the 90's as it simplified the harness having only to run two wires around the door and back. This method works well enough assuming you do multiple reads until you have a stable reading and it also helps if the end of the line has a reference resistor so the system can calibrate and check itself.
BTW, I also used RC technique for sensing cards being dispensed from machines as I would have a 1"sq copper that the cards would pass underneath between that and the chassis and I could tell how far the card was under as well, it was that sensitive.
Hey, nice find, and they are only around $1 a piece 100off, sweet.
BTW, the INT pin is optional as it's easy enough to poll whenever so effectively zero I/O as it would be dumb to use other I/O as I2C is a bus so it would just share P28 & P29.
do you have any more info on using one of those? I am new to that
Thank You.
I agree with you there.
@JBWolf, So that would offer a GPIO, and still have your 3 pins from the Prop.
I only knew about as much as you do, but Google is a great equalizer.
Even though these things have quite a number of registers it is straightforward enough. You can have an 8x4 keymatrix and 4 PWM LED lines with this chip and of course you can just connect a 4x4. The sweet thing about this chip as opposed to a dumb I2C GPIO is that it scans and buffers the keys for you so whenever you are ready you just poll the chip for another key. Once you have written your configuration into the chip you only need to read register 0 in the device by the look of it, pretty simple.
Personally I would just do a very small pcb and mount it to the keypad so that you only need a 4-pin connector to mate up to your controller (I2C+PWR).
EDIT: The other way I might do it is to program a small PIC chip and just run two wires in 1-wire bus fashion.
Requires resistors and capacitor
http://obex.parallax.com/object/715
Being able to use the 4x4 keypad available in the store on one prop pin by making a small adapter to include the resistors and cap is very very nice!
Thanks Duane and Ron!
A keypad that needs to be calibrated? Spend a buck and save yourself all that trouble unless this is a one-off.
That is a really slick object for the 4x4 keypad!
Which way were you referring to achieve this? using the PCF8574 I2C port expander?
edit: ah my bad, you mean the MAX7370 correct? sorry im a bit tired at the moment.
I will have time to look at the datasheet and get into more detail tomorrow.
One question about using the max370...
I plan to write PC software (either just a basic display with the PST, or maybe VB when i get more time to create a nice graphic display) to allow the controller to interface through the prop clip to a PC for more complex manipulations prior to use in the field.... for example creating multiple 'profiles' that contain very large groups of configurations. I will be using the keypad (while in the field where a pc/laptop is not available) to quickly make basic manipulations and also choosing from the many custom profiles.
would using the MAX370 interfere with PST communication?
edit again: oh duh... no it wouldnt because it would be on the keypad.
ok im goin to take a nap lol
... and then again this is still not the way I would do it either. It's easier for me to hang one of my Bluetooth serial modules off the coms port and just use Blueterm on my smartphone to talk to the system. Since I use Forth then that means I have complete access and I can even change the software.
But If I did use a keypad then the MAX7370 would be a good choice, but then with a keypad you really need a display etc.
Letcha know how these turn out
5
1
27899PAR-ND
4X4 MATRIX MEMBRANE KEYPAD
1
Immediate
0
6.99000
$6.99
6
1
MAX7370ETG+-ND
IC CTRLR KEY-SW I2C 24TQFN
1
Immediate
0
2.16000
$2.16
7
10
RMCF1206FT200RCT-ND
RES 200 OHM 1/4W 1% 1206
10
Immediate
0
0.04400
$0.44
8
10
RMCF1206FT300RCT-ND
RES 300 OHM 1/4W 1% 1206
10
Immediate
0
0.04400
$0.44
9
10
RMCF1206FT390RCT-ND
RES 390 OHM 1/4W 1% 1206
10
Immediate
0
0.04400
$0.44
10
10
RNCP1206FTD604RCT-ND
RES 604 OHM 1/2W 1% 1206
10
Immediate
0
0.06500
$0.65
11
25
311-100FRCT-ND
RES 100 OHM 1/4W 1% 1206 SMD
25
Immediate
0
0.02280
$0.57
12
10
P1.10KFCT-ND
RES 1.1K OHM 1/4W 1% 1206 SMD
10
Immediate
0
0.10000
$1.00
13
10
311-1.60KFRCT-ND
RES 1.60K OHM 1/4W 1% 1206 SMD
10
Immediate
0
0.03000
$0.30
14
10
1276-3085-1-ND
CAP CER 1UF 25V 5% X7R 1206
10
Immediate
0
0.14000
$1.40
I'm sure both resistors will work fine with calibration... but I went ahead and added 620ohm resistors to my order.
Digikey pn: RMCF1206FT620RCT-ND
You have somewhat skipped over the issue of Power and Ground ?
If you are limited to 4 pins on a connector, that's only 2 IO lines, unless you use signal-line powering.
The PCF8574 mentioned is usable, but they always seem expensive for what they are.
A modern small 8 bit Micro in SO16, can cost about the same.
The simplest expander device, is the HEF4014,
http://www.nxp.com/documents/data_sheet/HEF4014B.pdf
which can connect CLK, PE, and join DS.Q7 to a Bidirectional Prop pin, for a 3 IO wire reader, that can read up to 32 buttons.
In use, you shift in to define Q5,Q6.Q7 output pins, and then PE and CLK to load the IPx pattern, and repeat that for new Q5..7 values, until you have scanned all needed buttons. At 3V the 4000 series CMOS has very light drive, so a Prop Pin can over-rule Q7 in IP mode, Tristate the Prop pin to read.
After calibrating the ranges, I am getting a >95% answer rate, the only misses I am getting are occasionally on the '0' and '#' buttons.... but I believe I can refine their range values a bit more and i think it will be 100%... might change some of the resistors to create a larger difference.
JB has asked that same question in another thread. Please answer it there.
-Phil