Author Topic: Matrix – recommended pullup and diode configuration  (Read 1496 times)

0 Members and 1 Guest are viewing this topic.

Offline 3dgeoTopic starter

  • Frequent Contributor
  • **
  • Posts: 289
  • Country: au
Matrix – recommended pullup and diode configuration
« on: August 26, 2019, 04:33:32 pm »
Howdy,

I'm making a commercial (hopefully) product with 35 key matrix (7x5) and just wanted to know best configuration of diodes and pullups.
Currently my diode and pullups setup is below (V1).

I want to optimize circuit as possible and was wondering, is it good idea for this purpose to relay on MCUs (SAMD21) internal pullups and remake circuit as in V2? Also as I understand in V2 there is no need to use current limiting resistors anymore (R16-20) because current will be limited by MCU internal pullup resistor, am I right?

Reason I did't went with the first design from the start is diode arrays – I didn't find any suitable common cathode array and I was avoiding single diodes due to possibly higher Pick and Place price, but now when comparing arrays and single diodes – single diodes cost practically nothing. This bring another question – ruffly how much of a PNP savings I can expect if its 7 vs 35 components to place? Will savings on PNP will be enough to justify 0,045 (array) vs 0.0035 (single) price difference, what would be your advice in this situation?

Also should I worry about EMC from matrix like this (10x20 cm PCB, on same PCB there is RGB matrix for every button)? Will flooding it with ground on two sided PCB will be enough or I should even consider 4 layers?

Talking about RGB matrix – if P mosfets gate is connected to MCU output, is pullup really necessary? Output floats only if MCU is off anyway, so I don't see the need for it...




« Last Edit: August 26, 2019, 07:45:51 pm by 3dgeo »
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9935
  • Country: us
Re: Matrix – recommended pullup and diode configuration
« Reply #1 on: August 26, 2019, 10:12:35 pm »
Typically, internal pull-up resistors don't pass enough current to provide reliable switching.  It's one of the reasons they invented bifurcated gold plated contacts which are pretty much out of the question for a keyboard matrix.

Combine low voltage which will have a problem breaking through any oxidation with low current and you might have a problem.

You might want to research this a bit.
 

Offline thm_w

  • Super Contributor
  • ***
  • Posts: 7183
  • Country: ca
  • Non-expert
Re: Matrix – recommended pullup and diode configuration
« Reply #2 on: August 26, 2019, 10:51:19 pm »
You might pay a few cents for pick and place per component.  I am using BAT54C for example: https://lcsc.com/product-detail/Schottky-Barrier-Diodes-SBD_BAT54C_C181200.html
But I don't know if its really worth the time to worry about right now, I would stick with the array, and focus more on the design/reliability.

There is a lot of good information here: https://learn.sparkfun.com/tutorials/cherry-mx-switch-breakout-hookup-guide/all

Typically, internal pull-up resistors don't pass enough current to provide reliable switching.  It's one of the reasons they invented bifurcated gold plated contacts which are pretty much out of the question for a keyboard matrix.

Combine low voltage which will have a problem breaking through any oxidation with low current and you might have a problem.

You might want to research this a bit.

Depends on the switch I suppose, this datasheet is listing 10uA minimum which should be fine with internal pullups right? (<100k internal).
https://cdn.sparkfun.com/datasheets/Components/Switches/MX%20Series.pdf

RGB ideas: https://github.com/Project-Aurora/Project-Aurora
« Last Edit: August 26, 2019, 10:55:10 pm by thm_w »
Profile -> Modify profile -> Look and Layout ->  Don't show users' signatures
 

Offline 3dgeoTopic starter

  • Frequent Contributor
  • **
  • Posts: 289
  • Country: au
Re: Matrix – recommended pullup and diode configuration
« Reply #3 on: August 27, 2019, 12:01:34 am »
I have already fully working prototype with external pullups and diode arrays. I try to prepare and optimize it for production at the moment.

If PNP price is more than 2 cents per part then it's cheaper to use arrays... Can it be that expensive?
I was looking at  BAT54TW (three parallel diodes) or BAT54CDW (two pairs common cathode). Also there are MMBD4148PLM, they would be almost perfect if not their high price and poor availability, I will dig deeper to find suitable cheap enough 5 diode alternative.

In SAMD21 datasheet: "Pull-up - Pulldown resistance: Min-20K Typ-40K Max-60K", so 165 / 82.5 / 55 microamperes. I guess I'll have to bread board part of the matrix and test if they are enough.

Sidenote – I have made my own MX breakout PCBs, they are way more "advanced" compared to sparkfuns, with pullup/down, hardware debounce, SMD/TH RGB diode and limiting resistors, I think I should sell them too :)
 

Offline thm_w

  • Super Contributor
  • ***
  • Posts: 7183
  • Country: ca
  • Non-expert
Re: Matrix – recommended pullup and diode configuration
« Reply #4 on: August 27, 2019, 10:21:14 pm »
If it has RGB diode thats different enough that some people might be interested in buying it.
What I would do is put the pullups in the schematic and just not populate them for now. Not a huge fan of the package of that MMBD4148PLM, but should be fine for assembly.

PCBway is showing me about 8c per part, a bit high: https://www.pcbway.com/quotesmt.aspx
Check with seeed as well: https://www.seeedstudio.com/fusion_pcb.html

Which SAMD21 are you using, they tend to be expensive. The cost of the key switches is not bad, ~$5.25 for kailh: https://lcsc.com/product-detail/Electrical-Switches_Kailh-CPG151101S13_C404353.html

Any mechanical parts are probably going to cost more than either of those though.
« Last Edit: August 27, 2019, 10:28:01 pm by thm_w »
Profile -> Modify profile -> Look and Layout ->  Don't show users' signatures
 

Offline 3dgeoTopic starter

  • Frequent Contributor
  • **
  • Posts: 289
  • Country: au
Re: Matrix – recommended pullup and diode configuration
« Reply #5 on: August 29, 2019, 04:03:49 pm »
If it has RGB diode thats different enough that some people might be interested in buying it.
It's not a regular keyboard.

What I would do is put the pullups in the schematic and just not populate them for now. Not a huge fan of the package of that MMBD4148PLM, but should be fine for assembly.
Yes, that was my plan. I decided to go with CS0816, same chip can act as a common cathode or common anode, tho it's only 4 diodes per chip in either configuration (5 would be ideal), but it will do.

PCBway is showing me about 8c per part, a bit high: https://www.pcbway.com/quotesmt.aspx
Check with seeed as well: https://www.seeedstudio.com/fusion_pcb.html
On my PCB there are about 150 parts – 12usd per board, that doesn't seems right... Anyway, I will go with 4 diode array mentioned above.
Tho it seems PCB assemblers charges not according to part count, but according to total pads on the PCB...
Which SAMD21 are you using, they tend to be expensive. The cost of the key switches is not bad, ~$5.25 for kailh: https://lcsc.com/product-detail/Electrical-Switches_Kailh-CPG151101S13_C404353.html
Any mechanical parts are probably going to cost more than either of those though.

Currently I'm using SAMD21G18, but hopefully I can "downgrade" to half of it's price brother SAMD21G17 or even SAMD21G16.
I have all other parts mostly sorted out. I'm only interested in reducing resistors count if possible.

Samds Internal pullups seems to work just fine even with 30 step rotary encoder, I'm getting no errors what so ever even when rotating encoder very fast.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf