sgmne / AnalogKeypad

Simplified design of an analog keypad matrix interface and demo thereof
GNU General Public License v3.0
16 stars 0 forks source link

circuit suggestions... #1

Open sbridger opened 3 years ago

sbridger commented 3 years ago

You might well know and have considered these, but anyway...

Use a pnp mirror, then the kbd is grounded, which makes emc/filtering and static discharge resistance easier to manage. (also means that VCC is not going to kbd , so kbd-gnd shorts are current limited by the current mirror)

If you measure the V(Q1b) you can correct for variable Vcc and Vbe(temp) and get a true ratio. i.e. Ratio= Nadc.vbe / Nadc.kbd

Alternatively, and better , is to connect Vref+ to Q1be (pnp) , and then the adc value is a true R value completely compensated for VCC and temperature changes, with no software effort. [depends on whether adc ref pin draws significant current, how vef muxing works on your micro etc]

sgmne commented 3 years ago

Thanks Sbridger!

Both of the emc/static and the more safer handling of shorting the keypad or its wiring to ground are excellent improvements. I did not think of them when comparing low and high side current mirrors.

When comparing PNP and NPN current mirrors, typically NPN is more linear. As an example, a design with BCV61C (NPN) and BCV62C (PNP) but otherwise identical (150Ω at measuring side emitter, 150 kΩ at reference, and 3x4 keypad with 12 kΩ spacing) the droop in the middle is 80 mV for NPN but 140 mV for PNP (LTSpice simulation, Infineon models for BCV6xC). In that case this is likely not an issue though, and I think the benefits of the high-side current mirror may be more important in many practical applications.

Measuring the base voltage or using it as a reference and using those for temperature compensation I thought of. That is a trade-off of another pin from the microcotroller vs. the emitter resisitor. The same applies to feeding the base voltage to the ADC Vref, but that requires, besides the second pin of the microcontroller, also an additional resistor to distinguish the no-key-pressed case. In some cases those may still be worth considering, so it is good to keep them in mind.