48 button keypad

@CrossRoads I need help on this
I am trying to create a 48 pin button keyboard with arduino and I don't really know how to setup the buttons

@roland345 welcome to the forum, but please do not post to topics which are 5 years old. I have asked the moderators to split it.

Please describe your keyboard better, or post a link to the spec. Does it have 48 keys or 48 pins?

@PaulRB thanks for the reply
The key lad I intend to build is with push buttons with what I read here it is possible I have it in 6x8 matrix with the help of shift registers

I need some clarifications on the connection

Do you have 14 pins available on the Arduino you intend to use? That is the easiest way. You can use the standard Arduino keypad library.

I dont have up to 14 free pins
I still have other things to be added to the board

What other things? Do any of them use i2c or SPI bus?

What model of Arduino?

What is the purpose of the keyboard? Will more than one key be pressed at the same time?

None use i2c but some use serial

Do you mean SPI or UART?

Please answer all questions.

@roland345

TOPIC SPLIT
PLEASE DO NOT HIJACK / NECRO POST !

Could you take a few moments to Learn How To Use The Forum.

Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

Here is one way to wire them up, it goes with the code that was split off into another topic for reasons I don't understand.
This would work well as long as only 1 button is pressed at a time.

Thanks @CrossRoads amd @PaulRB

Uart

@CrossRoads please can you elaborate on the code you wrote in the other topic that wa splitter

Sure, you could do it with a shift out register (74HC595) and a shift in register (74HC165). I imagine something like this: Shift out 11111110, shift in captured value. if all 1's come back, not button is pressed. If a 0 comes back, then the intersection of the row shifted out known to you, and column read back with a 0 tells you the button that was pressed.

Repeat for next row, 11111101, read back.

Etc. for 11111011, 11110111, 11101111 11011111. 6 rows, 8 columns. (I can't see the picture, your setup may be a little different).

Just need 5 pins - clock, data out, latch out, and same clock, data in, latch in. Can probably be clever and use latch in/latch out as the same signal, so just 4 pins.

for (x=0; x<8; x=x+1){
digitalWrite (ssPin, LOW); //
SPI.transfer (outByte[x]); // send out HC595 outputs
digitalWrite (ssPin, HIGH); HC595 outputs on this rising edge
digitalWrite (ssPin, LOW); // capture HC165 inputs with low pulse
digitalWrite (ssPin, HIGH); HC595 outputs on this rising edge
inbyte[x] = SPI.transfer(0); // read in HC165 inputs.
}
// act on any 0's in inbyte[0] to inbyte[7]

byte outbyte[] = {0b11111110, 0b11111101, 0b11111011, 0b11110111, 0b11101111, 0b11011111, 0b10111111, 0b01111111,};

// act on any 0's in inbyte[0] to inbyte[7]
for (y=0; y<8; y=y+1){
 for (x=0; x<8; x=x+1){
 if (inbyte[x] == 0b11111111){
 // do nothing, no key pressed
 }
 else{
 // 1 or more keys were pressed, in row y, x, look it up in a dataArray?
keyPressed = dataArray[x][y];
 }
// next x
} // next y

char dataArray[][] = { // check syntax for this
{a,b,c,d,e,f,g,h,}
{i,j,k,l,m,n,o,p,}
{q,r,s,t,u,v,w,x,}
{y,z,0,1,2,3,4,5,}
{6,7,8,9,A,B,C,D,}
{E,F,#,$,-,-,-,-,}
};
// or similar

Thanks
Here you mentioned how I can use just 5 pins but the schematic you sent used 8

Can you briefly help with the lin declarations if the code

Sorry for the troubles

More like:

char dataArray[6][8] =   // check syntax for this
{
  {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',}
  {'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',}
  {'q', 'r', 's', 't', 'u', 'v', 'w', 'x',}
  {'y', 'z', '0', '1', '2', '3', '4', '5',}
  {'6', '7', '8', '9', 'A', 'B', 'C', 'D',}
  {'E', 'F', '#', '$', '-', '-', '-', '-',}
  };
  // or similar

@johnwasser I understand that part

Just an help with the pin definitions via arduino code

I showed an 8-pin connector. +5 and Gnd are 2 of them, so those are not IO pins.
In the code, I used ssPin for the '595 latch signal, and I think it can be used for the '165 latch signal also, so that makes 4. Or 5 if separate latch signals are needed.
SPI signals: SCK (D13), MISO (D12), MOSI (D11), ssPin (D10).

@johnwasser, thanks for fixing the array.

Thanks @CrossRoads @johnwasserI am really grateful

Somewhat easier and neater would be to use a port expander such as the PCF8575.

Connects to your I2C two-pin interface along with any other I2C devices.

Note the need to use diodes in your matrix if you propose to press more than two buttons at any one time.