1

I need to connect around 60 LEDs and 60 switches to a raspberry pi

Each LED would be mapped to a switch.

Suppose Raspberry pi enables 16th LED to be switched on, its corresponding switch press would send signal indication of Raspberry Pi to switch off 16th LED.

I'm confused how to achieve it as I'm new to Raspberry Pi

  • Each of the 60 LEDs has an associated switch. If the switch is pressed its LED should be switched off. How are the LEDs switched on? – joan Aug 10 '15 at 20:18
  • The GPIO capacity on the Raspberry Pi isn't enough to allow you to directly control 60 LEDs from 60 "switches". You're going to have to look at shift registers or some other mux/demux solution for this. There are as many ways to accomplish this as the day is long, however, so you might need to provide some other details that help put a boundary on the project. – WineSoaked Aug 11 '15 at 0:29
  • Let me explain project in detail There would be a master computer attached to barcode , where all required barcode would be stored with the corresponding Shelf position , In this position each Shelf would be tagged with position and LED Master computer would send Serial communication to Raspberry Pi with the Shelf position Raspberry Pi based on the serial communication would display on the LED , now when the user places the stuff at that position , User should press the Switch or button there to acknowledge item has been placed 60 position needs to be attached to Raspberry Pi – Abhishek Singh Aug 11 '15 at 4:33
  • I got this module on net aliexpress.com/item/… Nt sure how to use this module – Abhishek Singh Aug 11 '15 at 5:16
1

As WineSoaked says there are dozens of possible solutions.

I'll suggest one.

You can connect 8 MCP23017 port expanders to the Pi's I2C bus. This will give you 128 inputs and outputs.

You can use 60 to drive the LEDs and 60 to connect to switches, leaving 8 spare.

On the output side you would just send an I2C message to switch a LED on. On the input side you could either poll for switch changes (i.e. regularly read the chips, perhaps twice a second) or connect the MCP23017 interrupt lines to a gpio (so you would only need to poll when you get an interrupt).

This solution wouldn't scale very well if you needed twice as many LEDs, but you could always buy another Pi.

  • Is there any ready available module for expanding MCP23017 and ya got solution one solution aliexpress.com/item/… But not sure how will I program using my Raspberry pie – Abhishek Singh Aug 11 '15 at 11:03
3

Although I do like the answer selected, what I am suggesting is a much lower cost and a modular solution if designed properly.

I had a similar requirement when I designed a LED table, but in my case it was 100 switches and 100 RGB leds

So what I used were

SN74HC165 to detect the state of my switches, be sure to set the switch as either pull up or pull down so that you get a proper read

ws2801 to control each of my leds. Each ic can control 3 leds.

The best part about this entire setup is that it uses spi connection meaning that you will require only a total of about 4 gpio pins.

  • Good points. I didn't really think of ws2801 as a solution. I associate them with LED strips and tiny hard to solder chips. – joan Aug 14 '15 at 7:53
  • the good thing about the WS2801 is the low cost, you could always use the DIP version of the IC – evolutionizer Aug 14 '15 at 8:00
  • That shows my ignorance. I didn't realise there was a DIP version! – joan Aug 14 '15 at 8:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.