Ok, I think I have looked into this stuff enough to have some good thoughts and questions again.
I had asked earlier about the ULN2803A - So I think from @pcmanbob and @ptimlin, that this is an option. But, I also do like the earlier suggestion of using optocouplers to protect the pi. So, I was looking around and found this item https://www.digikey.com/product-detail/ ... ND/4562956
But, honestly - I am too uneducated on the electronics side of this to know for sure what I am reading. I think I get that this is effectively both an optocoupler as well as a Darlington array. But, I'm not sure exactly what the point is in the Darlington array at this point. @pcmanbob had helped me on an earlier discussion where I did end up using a ULN2908A to control one of those 8 channel relays off Amazon that really seemed to work better at 5v vs 3.3v and this was a way to get some isolation and converted the signaling to active high instead of active low. But, in this case, it's a different scenario and now I don't know that I see the point in it - especially if optocouplers are in the mix.
I mean, at this point I think I am set on controlling the 12v power to the DPDT relay's coils to turn them on/off. So, in that case I can just control the optocouplers with the pi and it seems to me that they are capable of handling the 12v power for the relays on their own on the other side. But, I would prefer to find them in a DIP package with 4 or 8 of them per DIP so as to simplify board design and lower costs. In the process of looking to some of these, I came across the item I linked.
It is a good priced - but has the Darlingtons in it. I don't suppose that hurts anything and seems to increase the capacity of what these DIPs can control - fine. But I started thinking more about a power issue with the pi. I want to control 16 of these relays at one time. So, that means powering 16 of the optocouplers. I'm not able to understand the specifications given on this item to know if that is feasible.
My understanding is that on the pi 3B+, that all GPIOs combined can only output a total of 51ma. I think on the datasheet for this item - that the LED on the pi side of this is using 10ma - at least in their "Test Condition" on the top of page 3. It also says the Min forward voltage is 1.1v - so maybe 10ma is not needed and can go lower? But that is one of my other issues - I don't know how to run the calculations on these things. I'm such a frustrated noob!
So, anyway, I do think I want to use optocouplers if able to. I do need all 16 relays to be engaged at one time. I plan to use 12v to power the coils on the relays. Will probably design and have a PCB fabricated for the components that will use a ribbon cable to the pi and will use screw terminals to make connections to the relays which will be socket-based DIN rail mounted relays (DPDT)
I would love some explanation or to be pointed to explanations on how to calculate things - like resistor sizing between GPIO and other components, what values to specifically look for on these data sheets so I know what data point to use in calculations, etc... I'm willing to learn - but I'm been looking at YouTube videos, web searches, tried looking for book titles and nothing seems to be hitting the spot. Really looking for how to figure this stuff out in relation to circuit design with RPis, Arduino's, MCU's in general, etc.. So much seems overly simplified. They don't give the design calculations or how/where to check with meters to see if things are correct or for detecting a failure. General electronics books don't deal with these MCU particular considerations - and still, seem weak on design theory.
I had some electronics training many, many years ago - so like the idea of what the basic components do - I get (i think
). But when it comes to combining them and getting the math worked out - it's just not there - and it never made sense to me even way back when. I always had a disconnect between how to develop designs vs being told how to do the simple math on simple schematics with given data vs - coming up with the data and making the schematic.
Sorry to ramble - again - I appreciate the help with this!