Maker Pro
Maker Pro

Just a quick check of my circuit

upload_2018-10-15_17-28-22.png
Here's a circuit I've came up with for my keyboard. Before I go any further, can anyone see any obvious mistakes? I'm most worried about the crystal, since most of the schematics I see have a three- or four-pin crystal, with ground pins, yet mine has none. Will that still work? Anyway, I'd be very grateful if anyone does find some potential problem with this.
 
You don't need all of those diodes.

If you make the column drivers toggle between input and output driven low, and use the internal pull-up on each row input. You scan by making all the columns inputs, then you make one column an output at a time and read the row inputs for that column.

Bob
 
You don't need all of those diodes.

If you make the column drivers toggle between input and output driven low, and use the internal pull-up on each row input. You scan by making all the columns inputs, then you make one column an output at a time and read the row inputs for that column.

Bob
That definitely seems like a logical idea... I wish I got rid of them before designing my PCB.
 

hevans1944

Hop - AC8NS
Do you have any idea why most of the keyboard schematics I've seen online use crystals with 3 or 4 pins?
Can you upload a keyboard schematic showing crystals with 3 or 4 pins?

Sometimes a complete crystal-controlled oscillator module, with appropriate logic-level outputs and fast-transition edges, is used in lieu of a separate crystal with its required support circuitry. The oscillator module does not (usually) make the crystal terminals accessible, but it does require at least a power lead, a power return lead, and an oscillator output lead for a total of at least three pins.

OTOH, some integrated circuits, such as many microprocessors, accept an external crystal or resonator which, of course, only needs (and has) two pins. There may be some confusion with regard to the schematic representation of a crystal and a crystal-controlled oscillator module, but the parts list should clearly make the distinction.
 
Can you upload a keyboard schematic showing crystals with 3 or 4 pins?

Sometimes a complete crystal-controlled oscillator module, with appropriate logic-level outputs and fast-transition edges, is used in lieu of a separate crystal with its required support circuitry. The oscillator module does not (usually) make the crystal terminals accessible, but it does require at least a power lead, a power return lead, and an oscillator output lead for a total of at least three pins.

OTOH, some integrated circuits, such as many microprocessors, accept an external crystal or resonator which, of course, only needs (and has) two pins. There may be some confusion with regard to the schematic representation of a crystal and a crystal-controlled oscillator module, but the parts list should clearly make the distinction.

Here - I found this guide after designing mine, and it made me think I may be doing something wrong.

https://github.com/ruiqimao/keyboard-pcb-guide

There's a PCB near the bottom of the page with the four-pin crystal, and also in the schematic nearer the top you can see there is a ground connection on the crystal.
 
There is no ground connection on the crystal proper. The ground(s) will go to the crystal can as shielding to give better stability.
 
Im not helping with your circuit, but just a comment about keyboards today - why do the keys always lock each other from turning on, seems like such a dodgy design, that everyone takes as the norm today. how crud are the keyboards we use!?!??
 
Im not helping with your circuit, but just a comment about keyboards today - why do the keys always lock each other from turning on, seems like such a dodgy design, that everyone takes as the norm today. how crud are the keyboards we use!?!??
They only do that on cheap designs. Note the diodes in my schematic, and then go and read about how to prevent N-key-rollover using them.
 
They only do that on cheap designs. Note the diodes in my schematic, and then go and read about how to prevent N-key-rollover using them.
My keyboard does not do this if I understand you correctly. I can press and hold the a key, then press the b key and it will send a b.

It is made by Logitech.

Bob
 
You don't need all of those diodes.

If you make the column drivers toggle between input and output driven low, and use the internal pull-up on each row input. You scan by making all the columns inputs, then you make one column an output at a time and read the row inputs for that column.

Bob

I've been thinking about this again, since I've just realised how much money I can save by getting rid of the diodes. Then I realised I may not understand quite what you mean. My understanding is: "For each scan, make two scans instead, one where the columns are outputs and the rows are inputs, and one where the rows are outputs and the columns are inputs". Correct?
 
No.

First, put a pull-up on each row and each column to V+. If this can be done internally in the microcontroller, as it can on PICs, then use that, otherwise you will need to add a pullup resistor for each column.

Now, to read a row, set that row as an output and output a 0. Read the column inputs. Any column input that has the key in the activated row pressed will read zero. All other column inputs will read a 1.

Turn the row back to an input, and go on to the next row.

Note that since the other rows are inputs, you do not get a short when two keys in a column are pressed like you would if the rows were all outputs, which is why the diodes were there.

Bob
 
No.

First, put a pull-up on each row and each column to V+. If this can be done internally in the microcontroller, as it can on PICs, then use that, otherwise you will need to add a pullup resistor for each column.

Now, to read a row, set that row as an output and output a 0. Read the column inputs. Any column input that has the key in the activated row pressed will read zero. All other column inputs will read a 1.

Turn the row back to an input, and go on to the next row.

Note that since the other rows are inputs, you do not get a short when two keys in a column are pressed like you would if the rows were all outputs, which is why the diodes were there.

Bob
Thank you very much, that was very helpful. So to implement this into the circuit, I would simply remove the diodes?
 
Yes, connecting the switch directly between the row and column. And don't forget to enable the pullups.

Of course, I would try a prototype before designing a PCB.

Bob
 
Top