# On/Off latching circuit with a raspberry GPIO 3.3v

I'm currently failing solving my problem. Of course if I would good better in electronic, I would not post my question here but that's life, and any help would be appreciate.

Context:

I have around 50 bulbs (not LED) to switch on (and keep on) or off (and keep off) at different times (20V max, 6 volts used, 1/2A consumption) I have around 10 coils to switch on (and keep on) or off (and keep off) at different times (60V max, 24V used, unknown consumption) I have a raspberry pi 4 with GPIO ports

I wanna use GPIO port(s) to do the switch on/off of bulbs & coils and because of GPIO limits (maximum of 16mA per pin with the total current from all pins not exceeding 50mA) then several bulbs can not be kept on for a long time thus I need a latching circuit so once it's on, it's kept on and one it's off, it's kept off until next signal.

I believe there are 2 approaches:

• use 1 GPIO pin per bulb/coil combined with an on/off latched electronic. In that case I need GPIO extended board since raspberry does not have 60 GPIO and 50 time the same circuit for the bulbs & 10 time the same circuit for the coil.
• use several GPIO pins for driving an or several IC(s) in an electronic circuit that would provide the latching expected behavior, so less GPIO pins but a more complex electronic circuit and probably less circuit to repeat because the IC may handle more than one switch on/off.

Notice that I would prefer to build an electrical circuit for cost reason, rather than buying an all-in-one circuit that would cost me 8$each around (50+10)x8$=420\$ total and that having a circuit dedicated to bulbs and another one for coils is acceptable for me.

From an electronical & financial point of view, what's the best way to go ?

• I'm not sure about the financial part, but if you want to go with building your own circuit I would recommend a cascaded shift register design. Considering the loads you are using, you will also need some power transistors or relays between the outputs of shift registers and the loads. Here is a tutorial of using shift register: learn.pimoroni.com/tutorial/170pt-projects/… . And here is an example of cascaded shift register design that I mentioned: learningaboutelectronics.com/Articles/… Jun 21 '20 at 10:09
• Additionally, maybe you can find some spesific I/O extension ICs which communicates with the main board via uart/spi/i2c etc. I just wrote down the straightforward approach of a shift registered design. Jun 21 '20 at 10:18