Matrix – recommended pullup and diode configuration - Page 1
Forum section: electronics / projects

author: 3dgeo
author_rank: Frequent Contributor
timestamp: August 26, 2019, 04:33:32 pm
content: 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...

author: rstofer
author_rank: Super Contributor
timestamp: August 26, 2019, 10:12:35 pm
content: 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.

author: thm_w
author_rank: Super Contributor
timestamp: August 26, 2019, 10:51:19 pm
content: 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.htmlBut 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/allQuote from: rstofer on August 26, 2019, 10:12:35 pmDepends 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.pdfRGB ideas:https://github.com/Project-Aurora/Project-Aurora

author: 3dgeo
author_rank: Frequent Contributor
timestamp: August 27, 2019, 12:01:34 am
content: 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 areMMBD4148PLM, 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

author: thm_w
author_rank: Super Contributor
timestamp: August 27, 2019, 10:21:14 pm
content: 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.aspxCheck with seeed as well:https://www.seeedstudio.com/fusion_pcb.htmlWhich 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.htmlAny mechanical parts are probably going to cost more than either of those though.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: August 29, 2019, 04:03:49 pm
content: Quote from: thm_w on August 27, 2019, 10:21:14 pmIt's not a regular keyboard.Quote from: thm_w on August 27, 2019, 10:21:14 pmYes, that was my plan. I decided to go withCS0816, 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.Quote from: thm_w on August 27, 2019, 10:21:14 pmOn 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...Quote from: thm_w on August 27, 2019, 10:21:14 pmCurrently 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.