5

I need to control 32 L.E.D's individually, now looking through the forum, the common solution is to use MCP23017 chips, as they can control 16 l.e.d's. With that in mind, I would require two chips.

So can anyone offer advice, a link to a guide, a sample script e.t.c for how to actually integrate the two chips.

Do I need to use both I2C pins?

4

Try this..From RPi i2c pins, give the connection to any breadboard connection point (the horizontal columns or the vertical rows) for SDA and SCL, from there u can have 2 wires to the SDA and SCL of both MCP chips. Set 2 separate addresses for both port expander chips. i.e A0,A1,A2.

Check this out....http://www.raspberrypi-spy.co.uk/2013/07/how-to-use-a-mcp23017-i2c-port-expander-with-the-raspberry-pi-part-1/

  • I think I follow what you are suggesting, have a look at the link, I have wired the board on Fritzing but I've used a 5V supply as there are a lot of l.e.d's. what do you think !Image link s9.postimg.org/68cudfya7/circuit_test_bb.png – EV-O Mar 15 '14 at 14:32
  • That link is not opening for me, may be the education filter is blocking it, not sure. Anyway u can use resistors ranging from 330 ohm to 1 Kohm to light up the LEDs. LEDs usually have voltages in the range(1.5-2.5)V, so ur 5V wont be a problem with resistors. I am not sure whether this is what u want. – Ron4326 Mar 17 '14 at 9:16
  • dont you need 2x 4.7k pull ups resistors 5v the SDA and SCL? – jason Mar 23 '14 at 1:56
  • The pull-ups are there connected to 3v3, we don't need to provide it externally. – Ron4326 Mar 24 '14 at 6:32
1

No, the A0/A1/A2 pins can be tied high/low individually, so you can have up to 8 on the MCP23017 on the same bus

enter image description here

  • Thanks John, so I will give them an address easily enough then. I have made a prototype on Fritzing, I have powered it with 5V for the amount of l.e.d's. Does that seem correct to you? s9.postimg.org/68cudfya7/circuit_test_bb.png – EV-O Mar 15 '14 at 14:35
1

To EV-O:

Your circuit seems to be ok to start communicating from the Raspberry Pi to the IO expander through I2c, but I don't understand why you use 3v3 for the address pin(s) (see pin 15 of the left MCP23017 on your breadboard), while the device itself is powered with 5V . You should use 5V for the addressing pins too, in case you want to assign a "1" to them...

You're kind of lucky now, since the minimum level for a "1" on the address pins A0 and A1 is 0.25 x Vdd + 0.8 V = 2,05 V (see datasheet of the MCP23017, chapter 2.1 DC Characteristics, Param No. D040).

If you would have chosen to assign a "1" to address pin A2 by means of the 3V3 power supply of the Raspberry Pi, it would have gone wrong, since for that pin the minimum input high voltage must be 0.8 x Vdd, being 0.8 x 5V = 4V!!! See same chapter, Param No. D041.

Now that I'm even looking more close to the specs of the device, I think you might get problems with your I2c levels too. Still according parameter no. D041 of the datasheet, the minimum input high voltage of SCL and SDA must also be 0.8 x Vdd. That is 4V.

However, since the Raspberry Pi only delivers a max. of 3V3 on the I2c pins, you're too low.

I think the best you can do for the moment, is to power your MCP's with 3V3 too. Or you put an I2c level converter between the Raspberry I2c and the MCP I2c...

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.