How to code 2 solenoid valves with a pH regulator proyect?

Hey there, hope you can help me, i'm so very new with this whole tech :frowning:

I have this proyect where not only do I measure the pH of a solution but also I have to regulate or at least change the pH of the substance in question. For that I should use a code where, let's say, if I want to keep water at pH 7 I throw some acid on it just so the probe gets the measurement (this is the part where I go blank) and then valves (two 12V solenoid valves) get activated for 1 second to deliver base so it can gent back to pH 7. Now, how can I code the arduino to activate the 5V relay attached to the first and second solenoid? The first relay activates a 3-way valve with the acid in NO and base in NC. The second relay activates a 2-way valve with the only purpose of closing the flow of either base or acid and doesn't fall on the substance being measured. Both solenoids are 12V and each one of them is connected to a 5V Relay.

Basically, in short, I don't know how to send (or stop sending, for that matter) signals to the relay so it can open/close.

I didn't choose this proyect nor the way it's done. There are a lot of things I don't understand about it and my professor really doesn't care so I hope you can help me.

Thanks in advance. I hope I was clear xx

first things first.... how will you be measuring the pH ie what sort of sensor you intend to use?

Do you get to choose the relays? If not, what relays are you required to use?

Usually you connect an Arduino output pin to a transistor to drive a relay. When the output pin is set HIGH the relay goes one way and when you set the output pin LOW the relay goes the other way. Use the line digitalWrite(PinNumber, HIGH); to set the pin HIGH and the line digitalWrite(PinNumber, LOW); to set the pin LOW.

sherzaad:
first things first.... how will you be measuring the pH ie what sort of sensor you intend to use?

My professor gave me this pH probe from his workplace: InLab Expert Go-ISM. It has a female BNC output which I connect it to a male BNC and then directly to an analog pin (which, btw I think is wrong, like shouldnt I have an amplifiying fase?).

You have not provided nearly enough information to get help of any value.

As previously stated, you need to specify the relays you're using and how they are connected. Post a schematic.

Regarding pH probe, they have an extremely high output impedance. You'll never be able to use one connected directly to an Arduino input. You'll need a buffer amplifier. Does yours have one built-in? Post the datasheet / user manual.

liaannee:
There are a lot of things I don't understand about it and my professor really doesn't care

Wait until you get a job in the real world. The boss is not going to want to hear about how you can't get the assignment done. You'll either figure it out or your REPLACEMENT will.

liaannee:
My professor gave me this pH probe from his workplace: InLab Expert Go-ISM. It has a female BNC output which I connect it to a male BNC and then directly to an analog pin (which, btw I think is wrong, like shouldnt I have an amplifiying fase?).

That do really not help I'm afraid.... google does not say much about the probe characteristic ie pH vs Voltage Output

and you may also be right about a pre-amp circuit...

I would suggest that to start by characterising the probe output for known pH values, that way you will know the voltage range and IF you need a pre-amp circuit.

gfvalvo:
Wait until you get a job in the real world. The boss is not going to want to hear about how you can't get the assignment done. You'll either figure it out or your REPLACEMENT will.

Yep, that's exactly why I'm asking for help, trying to figure stuff out by myself and by any means I can.

liaannee:
Yep, that's exactly why I'm asking for help, trying to figure stuff out by myself and by any means I can.

So why haven't you posted the information people would need to help you? There have been multiple requests that you provide component data sheets, schematics, user manuals, your current code, etc. You've provided nothing.

johnwasser:
Do you get to choose the relays? If not, what relays are you required to use?

Usually you connect an Arduino output pin to a transistor to drive a relay. When the output pin is set HIGH the relay goes one way and when you set the output pin LOW the relay goes the other way. Use the line digitalWrite(PinNumber, HIGH); to set the pin HIGH and the line digitalWrite(PinNumber, LOW); to set the pin LOW.

Hi there! Thanks for the reply. No, I didn’t get to choose the relays. The relays required to use are a two channel Songle SRD-05VDC-SL-C relay. https://www.rlocman.ru/i/File/2018/02/21/SRD--T73-.pdf ← datasheet

Thanks about the programming idea, I’m going to try it. I’ll open the relay to let a few drops of the solution in the 12V valve to go through and then I’m going to close it. Do you know a way the program pauses so I can mix the solutions and then get a new measurment? Like if I press a botton the program just pause until I press it again? Sorry, I don’t even know if that’s possible.

SRD-05VDC-SL-C
The L in "SL" means the .36 Watt version which, for 5V, means 71.4 mA of current. The Arduino UNO outputs can only handle 40 mA ABSOLUTE MAXIMUM. Typically 20 to 30 mA is the recommended limit. This means you will need a transistor to switch the higher current. A small NPN transistor can connect between the relay and Ground to switch the current. Collector pin to one side of the relay coil, Emitter pin to Ground and Base pin through a ~220 Ohm resistor to the Arduino pin. The other side of the relay coil goes to +5V. A diode across the coil will absorb the voltage spikes caused by the collapsing magnetic field when the relay is turned off. Google: Snubber Diode.

Wire that up and connect it to Pin 13. Run the Blink example to turn the relay on and off as a test. You should hear the relay click.