3

I'm currently working on a "rotating cube" project where a raspberry pi will be used to determine which cube face is at the top and any given time using an accelerometer and light it up with LEDs.

So, I have the bare bones working and the code pretty much there, I can have the pi light up one of six LEDs depending which way up the accelerometer is. The next step would be to have 9 LEDs light up for each face, however I know that the GPIOs have a current limit that should not be exceeded (~50 mA).

So I need on some advice on how to go about this as I am abit of a noob when it comes to electronics. What I was thinking to do was to use a relay board to supply each set of 9 LEDs with more power, something like this;

8-Channel-SSR (ebay)

So my understanding is ill be able to control the relays from the pi, but use an external power supply (5 V) to power the LED sets when switched?

Is this the right way of going about this? Is there a better way?

FYI these are the LEDS that i am using;

https://www.modmypi.com/shop/ultra-bright-5mm-led-white

Ghanima
  • 15,958
  • 17
  • 65
  • 125
Pys3nberg
  • 31
  • 3

2 Answers2

2

You could use one or more ULN2003A which are just like a relay but much cheaper.

E.g. http://www.hobbytronics.co.uk/uln2003a-darlington-array?keyword=uln2003, each one will drive seven LEDs.

Using the ULN2003A (or similar) you'd need one gpio per LED.

Alternatively you could use one or more MCP23017 port expanders.

E.g. http://www.hobbytronics.co.uk/mcp23017-16bit-port-expander?keyword=mcp23017, each one can drive 16 LEDs per chip.

The MCP23017 connects to the I2C bus and you could have up to 8 on the I2C bus. The I2C bus is just two gpios, so with two gpios you could control up to 128 LEDs.

joan
  • 71,852
  • 5
  • 76
  • 108
-1

This baby controls up to 24 LEDs. I'm using a similar one for PWM output for a quadcopter I am coding. Perfect for your needs! 24 Channel LED Driver The code to control it is fairly simple as well. Message me if you want some advice on this little dude.

Justin C.
  • 47
  • 5