How to wire 5v Relay (not a module) to ESP32 (or ESP8266)?

I need to switch this relay G2R-1-E Datasheet, PCB Relay. , THT, 5 VDC, 16A.
How should i wire it? Using transistor or optocoupler?
I have currently available:
Transistor BC 546B
Optocoupler ILD74
• several resistors and so on.

It will be used to disconnect the solar input line from the solar generator. If its cloudy/low light, the batterie turns on but uses more energie then it harvests.

The relay has a rated ON current of 106mA so the easiest way would be to use a transistor but the BC546 has a max collector current of 100mA so it is not really suitable. The opto data sheet doesn’t give a max collector current but 5V at 106mA would exceed the device package power.

1 Like