I am having problem with relay module. When relay is connected through laptop USB, it works fine and switches on/off correctly. But I've to use my project on 220Vac mains and for this purpose I'm using HLK-PM01 Ac-->DC supply. When I connect my relay through this supply, the relay doesn't switch back once turned on. Although the led on the relay module turns dim but not properly off. Please help if anyone has had any problem like this one.
If the problem goes away after you disconnect the AC load, then you have a problem with interference due to contact arcing. Should use a suitable MOV or RC snubber. A relay module with opto isolation is more suitable for switching AC loads.
The problem exists only when I'm taking 5V Dc from HLK-PM01 (220VAC-5VDC Supply) or even if I aplly 5V Dc from Mobile charger. But worked fine when connected via Laptop USB.
I have tried Opto-coupler in order to isolate. I think there was some problem with the voltage levels when mains voltages are applied.
An optocoupler improves the isolation ... especially on the power rails and if you use a separate DC supply for your relay.
An MOV like this will reduce contact arcing (EMI/RFI) and prolong the life of the relay.
Without MOV protection you may still get intermittent problems over time (emissive interference) and the relay contacts could weld closed due to contact arcing.