PCF8574_8Relay
PCF8574_8Relay copied to clipboard
Use opto-isolation
The relay board has opto-isolation, so ideally it should be used to prevent damaging the ESP. Take a look at https://forum.arduino.cc/index.php?topic=185234.msg2651260#msg2651260
I've used relay boards before, but with Raspberry. I use similar schematics to this one:
but two separate power sources could be used.
I'm not a professional electronic, so probably this can be improved :)
You can use the same power supply safely, if you heed the limitations. Jd-vcc is used to power the relay coils. Do not connect it to ESP rail. Connect an external 5v + to jd-vcc and - to the ground pin (70-80mA per relay). Connect 5v to and ground from the ESP power supply next to the data pins which will power the octocoupler (25ma). (The pins in a row 1, 2, 3...8 are data pins. For example gnd,1,2,3,4,5,6,7,8,5vdc) Since all ground pins on the relay are common, you could also just use the same power supply that operates the opto-isolation circuit. The jd-vcc pin keeps the power separated, unless you place the jumper across vcc & jd-vcc.