I am currently working on a project where I use a PZEM-016, an 8-ch relay switch, and shift registers, (165 and 595).
All of my components seem to work normally when they are Isolated; the problem arose when I added my PZEM-016 circuit with my relay switch. The relay switch started giving out random outputs, and would frequently fail to light up whenever I turn a relay on. (It lights up but would immediately shuts down). Initially, all my shift registers were powered using Vin of my ESP32, but I tried to put the 595 shift register that is connected with the relay in an external power to see if it would work but it didn't. Additionally, the schematics below are separate because of the limited editing capability of the app I used.
I've read something similar from this post about adding a capacitor?? But I'm not totally sure because we used different microcontrollers. Can anyone please suggest a possible solution?
That relay module should have the 3 pin header with JD-Vcc, Vcc, and GND.
The board comes with a jumper between JD-Vcc and Vcc, so that the relays are powered by Vcc.
When using a separate power supply for the relays, remove the jumper and apply power to JD-Vcc and GND, with no connection to VCC.
At the 10-pin header there are connections for GND, Vcc, and the 8 inputs to drive the relays.
Connect ONLY the Vcc and relay inputs, with Vcc being the Vcc used for the 74HC595, not the 5V supply for the relay board. DO NOT connect GND, otherwise you lose any benefit from the opto-isolation. There should be no common connections between the power supply for the relay board and the power supply/circuitry on the input side of the board.
The problem may be from powering the 74HC595 from 5v, that puts the minimum HIGH level input voltage very near the supply voltage of the ESP32.
Yes but even if the hc595 did have enough current to drive the relay board it would not work because with Vcc = 5V, the minimum Vih for the HC595 is around 3.5V and the ESP can only output 3.3V
I tried doing this, but I used the same power supply for my JD-Vcc and Vcc. I think that's the part where I made a mistake. I will retry this technique with your correction; I will use the ESP32 Vin so the 595 is powered separately. Really hope this works.
This is what I have been considering, but I didn't exactly know how to do it. I will give your solution a try. Thank you very much!
Use a SN74AHCT595N or SN74HCT595N whichever you can get.
Power it with 5V.
Connect the outputs of the 595 to a 74ACT244N and it's outputs to the relays.
You should also power the 165 with 3.3V or you will damage the ESP input pin.
I also recommend using the pushbottons pull-up resistors to 3.3V rather than pull-downs on the 165 inputs.
Anything connecting to an ESP32 I/O should be 3.3V
I've asked for this component in our local store, but unfortunately, this wasn't available. I have now ordered one online, and I'll just try some other method while I wait for this. Thank you so much for your help! :))
Hi again, I would like to clarify how I should place my bypass capacitor. I found in this youtube video and they used an electrolytic capacitor like this:
but you've mentioned that I have to put it as CLOSE to the IC as possible. Should I place my ceramic capacitor the same as this one, or should I exclude pin 10 (Vcc) and pin 13 (GND), and just put it in pin 16 and 8?