I need help with the project in several ways:
- Design circuit
- Calculate resistors
- Calculate power supply
I started it thinking that it would be something simple (turning LEDs off and on), but it seems that it is not so easy.
The idea is to assign an RGB LED to each day of the month. Each LED shows a different color depending on the day it is: if it has passed, if it is the current one or if the date has not yet arrived. Therefore, I have 31 LEDs, one for each day of the month. One of them will not be used for months with only 30 days. Each LED has 3 input pins R, G and B, therefore 93 pins in total.
The first problem encountered (solved) was that the Rpi does not have enough GPIO pins. I have purchased MCP23017 pin expanders that work with the i2c protocol. I have learned to handle them in a simple way with python. Each chip provides 14 outputs, so I would need 7. Since the MCP23017 has three pins to define its direction (HIGH or LOW on pins 15, 16 and 17), I can connect up to 8 of them, solving the problem.
Since there are many LEDs, I should supply them with an external source, so as not to demand too much from the RPi. In such a case, I would need to drive the LEDs by an electronic device. From what I've read, a PC817 optocoupler could do the function of turning each LED on and off. I would need three for each LED, to independently control the R, G and B of each.
The circuit of each LED could be represented like this. Note that I have to repeat this scheme 31 times, one for each RGB LED:
The questions I have (total beginner) are:
- Is this representation correct?
- How do I calculate the power of the LED power circuit?
- How do I calculate the optocoupler resistors (logic circuit)? The GPIOs of the Rasperryi PI 3 have a 3v output, but I don't know the amperage.
- How do I have to calculate the resistances of the LED (electrical circuit)?
Thank you for the help.