DMA wrote: ↑01 Oct 2024, 07:31
@pandrew I won't be too concerned about degrading GPIOs - a) usually source current is less than sink current and b) dI/dt kills the transistors, and does that pretty reliably - so you'll either be fine or fry your sourcing GPIO, but long-term not much will happen. Frying the membrane is of more concern.
If you press all the keys on a single input line, then you'll be shorting together up to 24 outputs on the above schematic, only one of which would be driving 0, and 23 would be driving 1. That is almost the same as driving a 0 directly into 3.3V. Well, not quite, the membrane's resistance will limit it somewhat. Probably won't kill the chip immediately, but I think it could degrade things over time, cause the current will most likely be above absolute maximum ratings. That is if you put something heavy on the keyboard pressing all keys, and leave it turned on for a long time. Otherwise probably not a real concern.
DMA wrote: ↑01 Oct 2024, 07:31
Re: diodes on drivers - good idea, but a) 0.7V voltage drop won't really be much of a concern, and b) if it's a concern, just use Schottky diodes, they have 0.15-0.2V drop.
Let's assume we're driving zeros from 74HC595, while the RP2040 runs at IOVDD=3.3V and samples.
VILmax for RP2040 is 0.8V.
(I don't know if they measure it with or without hysteresis. If this is a spec which is measured without hysteresis enabled, then enabling hysteresis makes this worse, 0.6V or lower. But if this is a specification that considers hysteresis, then disabling hysteresis, could make the actual VILmax larger, and improve our headroom. It's not clear from the datasheet which one it is, it would be interesting to do some experiments to see how the real world compares to the datasheets. I think values such as VILmax are most of the time really statistically determined rule of thumb values, so an experiment might not point clearly to either conclusion. Anyway, for now let's ignore the question of hysteresis, and assume VILmax of 0.8V is needed for low levels to be reliably detected.)
If using RP2040 internal pull-ups, each pull-up can be as low as 50 kOhm, and having up to 20 of those in parallel Can result in 1mA of current, that the 74HC595 will need to sink.
I can't find clear graphs for how much the shift register's VOLmax will be at 1mA current, running at 3.3V, but a TI datasheet says at 6mA and running at 4.5V VCC, at 25degC it can be 0.26V and can be worse up to 0.4V at wide temperature range.
So I don't know, let's work with 0.07V for now (i.e. I expect VOLmax to be linearish to the current, so 0.4V * 1mA / 6mA = 0.07V)...
So the equation you'll have to satisfy is:
VOLmax(@1mA current) + Vforward + Vmembrane_drop < VILmax
- Let's say you have a normal diode that drops 0.7V, that leaves you with a maximum Vmembrane_drop = 0.03V. A simplistic Ohm's law calculation results that the membrane can't have more than 30 ohms (with 20 keys connected to 1 driving line pressed). Not sure I'd be 100% comfortable with that. (For reference: on a relatively fresh Mini M I measured around 50 ohm pressing one key, and 35 ohm pressing two keys. Extrapolating to 20 keys, it'd be around 20 ohms, not a very scientific measurement, but this doesn't make me comfortable enough, it's way too close. Resistances could be worse on an aging membrane, or an over-the-numpad style controller.)
- Let's say you have a schottky diode that will drop 0.2V, that leaves you with a maximum Vmembrane_drop of
0.53V. Applying ohm's law, 0.53V / 0.001A = 530 ohms. I think this would be safe, I don't think the membrane
would go to such high resistances unless it got serious water damage.
Now will it work with normal diodes if you try it on a one-off project? I say probably. It's unlikely that you'll end up stretching all of your numbers to the worst case, but I wouldn't trust it to be reliable unless I can come up with some way to reasonably relax some of the above numbers.
Also coming back to hysteresis, it bothers me that it's not very clear from the datasheet how hysteresis is intended to affect all of this. I think with my current knowledge I would say:
- using schottky diodes with hysteresis disabled - will work
- using schottky diodes with hysteresis enabled - will probably work, if hysteresis removes 0.2V of headroom, then the maximum mebrane resistance would have to be 330 ohm, which is still reasonable
- using normal diodes with hysteresis disabled - i don't know, I would assume risky until proven otherwise.
- using normal diodes with hysteresis enabled - way too risky for my taste.