Arduino controller for Rain bird 100DV 9v solenoid valve

Hi all,

I'm desperate, please help!

I'm not so good at electronics and I don't know something important.

I'm trying to build Arduino MQTT Irrigation Controller for two Rain Bird 100DV 9v solenoid valves.

I read this topic:

And this article:

And decided to optimize the project.

This is a simple scheme of the 4 relay modules and the connection with the 9V power supply and the valves.

IMPORTANT: The 4 wires on the top left part of the scheme are connected: the two BLACK wires of the VALVES and the two wires from the 4 relay module.

This is part of the code for controlling the 4 replay model

// orange - module 1 relay 1
const int Module_1_Relay_1 = D5;
// white - module 1 relay 2
const int Module_1_Relay_2 = D6;
// yellow - module 1 relay 2
const int Module_1_Relay_3 = D7;
// black - module 1 relay 2
const int Module_1_Relay_4 = D8;

const int VALVE_WEST = 1;
const int VALVE_EAST = 2;

const int relayDelay = 100;


void turnOnValvesProtection(){
    delay(relayDelay);
    digitalWrite(Module_1_Relay_1, HIGH);
    delay(100);
}

void turnOffAllValveRelays(){
    digitalWrite(Module_1_Relay_1, HIGH);
    digitalWrite(Module_1_Relay_2, HIGH);
    digitalWrite(Module_1_Relay_3, HIGH);
    digitalWrite(Module_1_Relay_4, HIGH);
}

void reverseValveCurrent(){
    turnOnValvesProtection();
    delay(relayDelay);
    digitalWrite(Module_1_Relay_2, LOW);
    delay(relayDelay);
    digitalWrite(Module_1_Relay_4, LOW);
}

void normalValveCurrent(){
    turnOnValvesProtection();
    delay(relayDelay);
    digitalWrite(Module_1_Relay_2, HIGH);
    delay(relayDelay);
    digitalWrite(Module_1_Relay_4, HIGH);
}

void switchToValveEast(){
    delay(relayDelay);
    digitalWrite(Module_1_Relay_3, LOW);
}

void switchToValveWest(){
    delay(relayDelay);
    digitalWrite(Module_1_Relay_3, HIGH);
}

void sendSignalToValve(){
    delay(relayDelay);
    digitalWrite(Module_1_Relay_1, LOW);
    delay(500);
    digitalWrite(Module_1_Relay_1, HIGH);
}

void openValve(int valve, const char *topic){
    char state[] = {"1"};
    if (!mqttClient.publish(topic, (byte *)state, strlen(state), true))
    {
        Serial.println("Could not send message :( - openValve");
    }
    
    turnOnValvesProtection();
    if (valve == VALVE_EAST){
        switchToValveEast();
    } else {
        switchToValveWest();
    }
    normalValveCurrent();
    sendSignalToValve();
    turnOffAllValveRelays();
}

void closeValve(int valve, const char *topic){
    char state[] = {"0"};
    if (!mqttClient.publish(topic, (byte *)state, strlen(state), true))
    {
        Serial.println("Could not send message :( closeValve");
    }

    turnOnValvesProtection();
    if (valve == VALVE_EAST){
        switchToValveEast();
    } else {
        switchToValveWest();
    }
    reverseValveCurrent();
    sendSignalToValve();
    turnOffAllValveRelays();
}

The Rain Bird 100DV 9v solenoid valve is turning ON when the RED wire is connected to the plus (+) of the 9v power supply and the BLACK wire to the minus (-). And it's turning OFF when the RED wire is connected to the minus (-) and the BLACK wire - to the plus (+).

I using the 1st relay for protection. I connect the + of the 9v power supply only when the other relays are configured in a way to have the required connection.

When I start the controller and power supply everything works like is expected. I successfully turn on and off the valves. After a few minutes (maybe 10 or more) the 4 relay module is working like expected (open and close the relays) but the valves most of the time don't react.

I disconnect and reconnect everything - improve the connection, and check the connections - everything is OK.

So what I'm doing wrong?

Thank you in advance for your support.

First of all that is a 24V AC solenoid...

Probably true, and it is the difference between a volt and an amp. Some explanation of this is in post#3 of the thread you allude to.

Probably your insisting on using 9v batteries. If oldcurmudgeon is right, you stand no chance and, even if it is a 9v solenoid, don't expect much joy with a 9v battery. Your basic form 1 physics should tell you that what you need is watts, which means power, and is calculated from volts x amps. Your 9v battery has virtually zero amps, and is for use in devices that don't need them, so multiplying by nine equals virtually zero - hence the deafening silence in the solenoids. I think it is likely that the relays will stop working soon too.

I see the PDF from UGA clearly shows the valves working on a 24v supply, and I suspect they did this in a lab and not in real practice, hence the 9v PP3, which probably lasted just long enough to prove the point - just like it did for you. And proved your code is kosher..... I guess those guys know only a tiny, tiny bit more about watts than you do.

https://www.rainbird.com/products/dvdvf-series
You need the version with the latching solenoid intended for 9V battery-operated controllers.
The solenoid is latching, so you only supply a short pulse of power to turn it ON or OFF, the rest of the time it is unpowered.
I can't really understand the wiring from your drawing, but you would want to have all the relays OFF except when actively driving the valve solenoids. It would probably be better to use transistors instead of relays for prolonging battery life.

The problem arises when a lot of the relay boards are sold as Bistable when they are active bistable and not true bistable.
Many of the boards sold need a holding current, typically 70mA on many of them I have seen.

A true bistable is what is required, to reduce current consumption.

However if it is the following with a latching solenoid, there is no current required after the initial pulse. so the relays can be released.

Rain Bird Latching Solenoid Coil 9V

Latching type solenoid: the 9v controller activates the solenoid to open & close the valve.
Includes wires for connection, and filter
Works only with Rain Bird valves: DV, JTV, PGA, & PEB

I am presuming that it needs a pulse in one direction to turn it on and another pulse in the reverse direction to turn it off. I dont see any spec for that solenoid however, so no idea about how long you have to hold the current for.

You need to find the data for those valves, but if it is just a pulse then the relays do not need to be held in.
Your program would need to activate the bridge in one direction for a period of time that is long enough for the valve to change state, then remove the power from the relays by turning them off.

Thank you all for your support.

@Nick_Pyner - I don't use batteries. I have 220V connected to two power supplies:

  1. 220v to 9V 0.33A - Used only for the valves
  2. 220v to 3.3V 0.9A - Used for supplying the 4 relay module, NodeMCU, 1 relay module, Moister sensor



david_2018 - Yes, I have those ones. I didn't find specifications for them, but I found in the other topic in this forum advice for turning ON the impulse only for 500 milliseconds. And this is what I'm doing.

@latedev - You are right. I change the relays in a special configuration in order to connect + to the red wire and - to the black one to turn them ON for 500 milliseconds and I disconnect the + from all wires with the 1st relay. In order to turn OFF the valves reverse the + and - in order to connect - to the red wire and + to the black one for 500 milliseconds.

The interesting part is that when the valve stop reacting I disconnect one of them from the 4 relay module and connect it manually to 9V for less than a second and the valve reacts.

An interesting fact is that when I tested the connection with the buzz of the Multimeter - the red and black wires are connected (I hear the buzz). I test this after I disconnected the valve cables from the relays.

The most important is that when I'm trying manually to connect the valve wires to the 9V power supply it's working every time. I open them, then switch the + and - and I close them.

I think something strange happening with the 4 relay module or the issue somehow is that the red and black wires of the valve are connected to each other inside the valve. But still the strange is why it's working for 10 minutes and then the valve stops reacting.

P.S. The single relay module is used for lights - it's not part of the valve circuit.

That will teach me to try and answer in the middle of the night.

I can see from your link that it is a 50mS pulse to turn the solenoid on/off.
The relays on the board are all 5V, so I was wondering why you say you are supplying that board with 3V3.

Its always best if you can draw out a detailed diagram, showing all connections and where they go to. It makes it far easier to debug.

Where is the rest of the program?, I only see a list of functions created.
You also need to comment your code to explain what you are doing, this not only makes it easier for others to read, but helps you to see any problems.

I am still trying to work out what type of solenoid this is.
The data sheet only shows the spec for the 24V model, which clearly latches with a holding current.

There are a few different types of relay, some mechanical latching, some electrical latching, some that need a reverse current, some that are pulsed, once for on, the second pulse to turn it off.
You really need to specify the type of relay.

How many times are you switching the solenoids within the 10 minute period? I doubt those solenoids are designed to be used multiple times within such a short time period.

How much water pressure do you have?

The solenoid has a fairly low resistance, I would expect the continuity tester on a multimeter to behave this way.

@latedev thank you for your advice. I changed the 3.3V power supply with 5V 3A. And something another strange thing is happening. I connect the VCC of the 4 relay module to the plus of the 5V power supply and the ground to the minus of the 5V power supply. When I turn ON the controller the NodeMCU stack (can't connect to the NodeMCU via the USB cable (serial monitor)). When I disconnect the VCC of the 4 relay module and restart the NodeMCU it's working. So I connect the VCC of the 4 relay module back to the 3.3V and ground pins of the NodeMCU and so far it's working.

My question is - why it's not possible to connect the 4 relay module to the external power supply? The NodeMCU is connected to the 5V power supply via the VCC pin.

From what I can see, you need two relays per valve to affect the Voltage switching for each solenoid.

Your relay wiring diagram confuses this issue, given there is no description as to what wires are connected to what, other than it looking like the top right board, possibly being the MCU.
I know those relays have pin connections of (From right to left top view) Common, N/C, N/O
However you have not said whether the diagram is top or bottom view. Which makes it difficult to decipher what you are doing.
Either way it looks like the solenoids are not isolated from the MCU, which is the point of using the relays. If you just wanted to flip the Voltage over for the solenoids, all you would need is 4 FET's (2 for each solenoid) on the MCU I/O to affect this, and do away with the Relays.

Which of course leads to your question about PSU's.
The reasoning behind using relays, is to isolate the solenoid power from the controller power supply.

The USB cable carries power from its source, which is why you can power devices from the USB.
What you need to do is isolate the supplies from each other, one supply for the relay outputs and a separate supply from the I/O of the MCU.

Given your comments about the way you are connecting supplies, coupled with the fact that there is no supply isolation, then connecting a 5V PSU to a 3V3 PSU should give you a clue as to the problem.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.