Jump to content

diy mechanical keyboard

Vikas.

so im pursing electronics and vlsi design engineering im in first year as a engineer i have to use scientific calculator a lot and now i want to make diy calculator with mechanical switches any one knows how to make custom keyboards 

Link to comment
Share on other sites

Link to post
Share on other sites

Well ... it's not rocket science dude. 

 

A key is just an on/off switch ... you press the button and voltage from one pin of the button can go out the other pin and into a IO pin of your chip or whatever you use. 

From there, there are various tricks one could use to reduce the number of wires  with a small increase of complexity. 

 

If you want to make a small 10-12 key keyboard, and you have 10-12 IO pins, then you could have each button connected to one of the IO pins and simply read if there's voltage or not on that pin, and if there's voltage you know the button is pushed down. 

 

You can use parallel to serial shift registers to take the state of 8 or 16 buttons and send it to a controller/chip using only two or three wires (clock , data, optional enable/cs).  The parallel-serial shift register takes the voltage on it's 8 or 16 inputs and stores it in memory as 1 or 2 bytes (8 or 16 bits), the microcontroller then can read these bits one bit at a time using i2c or spi or other protocols. 

 

Another way of doing it is by reading an analogue voltage on the IO pin, if the microcontroller or whatever you use is fast enough to sample the input at least once every 5 ms or so.  Basically you make a voltage divider with one fixed resistor, and give each button a different value resistor, so that for each button pressed you get a different voltage (ex 0.25v , 0.5v , 0.75v, 1v ... 5v) ... this is explained in microchip's tips and tricks guide , see tips #5 and #7 : https://ww1.microchip.com/downloads/en/devicedoc/01146b.pdf

 

There's a sort of hybrid of this where you can use some pins in digital mode (to send power or not) and some pins in analogue mode (to read voltage) to scan lots of keys with few IO, for example 16 buttons with 8 IO pins ... See tip #12 at page 94 ( 6-10) in the pdf above. 

 

there's also charlieplexing, which is used to drive lots of leds with few IO pins, but can be adapted for buttons , see https://en.wikipedia.org/wiki/Charlieplexing

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×