I am working on a home automation project using:
- rPi 3 with 2.5 A power source
- 3 x MCP23017 for GPIO port expansion
- 3 x 8 ch solid state relay board by Sainsmart
- 20 x physical wall switch
- (future) adding few thermometer and hygrometer
And basically I want to know how to supply power to (future) PCB (with all listed components); via
- rPi 5V GPIO pin, or
- rPi USB port, or
- should I add an external power supply just for MCP23017 and relay boards?
So I did some thinking and calculations, but in the end I would still like to hear your opinion.
Regarding MCP23017: I will power it with 5V with level shifter as seen on the following picture:
For this I'll be using 2 x BSS138 transistor and 4 x 1kOhm resistor.
Relays are off when reading HIGH and are turned on when reading LOW. Therefore, I will use pull up resistors with switches - here I will have 10 kOhm resistor + 100 kOhm internal resistor in MCP23017. So 5 V/110 kOhm = 0.045 mA/per switch is flowing when reading HIGH and 0.5 mA/per switch when reading LOW.
In the worst case, when all 20 switches are on I should be using 20 x 0.5 mA + 3 x 160 mA (for all relays ON as written in added link to sainsmart). This means 490 mA. Did I forget to calculate something? And in the final version if I add a few components and reserve for them additional 100 mA. This would mean approx 600 mA of current.
Now what would be the best solution for power source? Can rPi supply 600 mA and/or sink it? Would be best to use external power supply? Can I use rPi USB port for it - does that even make a difference compared to 5 V GPIO?
Thanks for answers!