1

I havent found anything, but iam sure there is already info on the topic. So even just a link would be helpful for me.

I want to build a Jukebox. So pretty simple. Around 30 Buttons, if Button is pushed add song to queue. Thats it more or less.

Since Iam a total newbee to pi and python:

How would I add several buttons to the pi? And what would the code roughly look like?

Thanks in advance.

Edit: To add a little more Info, I would need around 100 buttons. As far as I could google this means Iam gonna ned several GPIO extensions(?). How could I get and work with so many signals? The command would be simple for each one.

Maybe USB would be a better option then GPIO for this amount? Iam not to keen on buying 8 extensions boards for 20€ each.

Maybe thing of it as a DIY piano ^^

Ingo
  • 42,961
  • 20
  • 87
  • 207
user101499
  • 11
  • 2

1 Answers1

3

You could simply wire the buttons up as a matrix, your usecase already describes the buttons being placed in a grid pattern. If you wire all the button pins vertically and horizontally you can form a matrix, with the 28 GPIO pins avalible on all Pi models but the first edition. You should be able to theoretically run 14^2 buttons or aprox 196 buttons.

The way this would be run is, you would have an infinite loop that would constantly power 1 column at a time, then while that column was powered if any of your row pins recieved power you would know that a button was depressed and you would know the (x,y) coordinates of said depressed button. You can read more about the concept here.

Mohammad Ali
  • 2,373
  • 1
  • 12
  • 18