I want to control a lot of LEDs (120 LEDs for example) independently of each other using the Raspberry Pi model B+, but the number of GPIO pins in the Raspberry Pi is not enough. So I thought of using the I²C bus since it allows up to 128 devices to be connected to the Raspberry Pi. I followed an online tutorial and enabled the I²C interface on the Pi, but I haven't been able to go further because I have some questions to which I haven't found answers on the internet.
- The I²C protocol needs the slaves to have registers of their own and to be able to send ACK bits to the master once a transaction is done. As far as I know, a mere 5mm LED is incapable of this. This makes me think of using some 'middle hardware' that has the necessary intelligence to carry an address (since each slave has an address), and to answer the master back. In other terms, I should't connect the LEDs (and their resistors of course) direcly to the SCL and SDA pins of the pi, I should connect them first to some chip, which is connected to the SCL and SDA pins of the pi. Am I wrong? If so, what am I missing? While searching for a solution, I bumped into datasheet of a PWM LED driver. Can it be of any help?
- In case I don't need that middle hardware, how should I connect the LEDs to the I²C bus of the Raspberry Pi (the SCL, the SDA, the ground and the 5V GPIO pins)? There aren't any tutorials out there that clearly explain this issue.