I use Arduino UNO and two SPST Relay (Wemos Mini D1 Relay) to make the reverse polarity circuit. I use this circuit to open and close the Solenoid Water Valve (SWV), which work with 9 to 12 volt. The connections are as follows:
NO (Relay1) --> NC (Relay2) --> +12 Volt
NC (Relay1) --> NO (Relay2) --> 0
D1 (Relay1) --> D1 (Relay2) --> Digital pin 3 of Arduino
COM (Relay1) --> SWV1
COM (Relay2) --> SWV2
GND Relay1) --> GND (Relay2) --> GND of Arduino
5V (Relay1) --> 5V (Relay2) --> 5 Volt of Arduino
the circuit work perfectly with Arduino boar. But the problem is that when I use ATMEGA328p-PU on breadboard as explained in LINK, Relays are not working properly. Actually, relays connecting and disconnecting continuously when ATMEGA328p sends 1 to D1 pins of Relays.
The point is when I de-attach the SWV, relays work properly. but if the SWV is connected it still is not working.
I've checked the connection many times and they are correct.
I used the following code in arduino:
int Relay = 3;
void setup() {
// put your setup code here, to run once:
pinMode(Relay, OUTPUT);
digitalWrite(Relay, LOW);
}
void loop() {
// put your main code here, to run repeatedly:
delay(2000);
digitalWrite(Relay, HIGH);
delay(2000);
digitalWrite(Relay, LOW);
}
Any help is highly appreciated.
Thanks in advance.
reverse polarity circuit
?