Electric wiring for arduino and hydraulic valves

Hey all,

Ive recently bought 3 electric controlled valves for an implement behind my tractor. The valves are operated via 12 volts, basically straight from the battery, they are either on or off (not proportional). I want to control them using a joystick with 2 axis and 1 push button, when the button is pushed the axis are used to control a different valve, so I can control 3 valves with 2 axis and a push button.

The joystick gets 12 volts directly from a plug in the tractor (basically same as in cars, which you use for charging your phone), the potentiometers from the axis send out 0 to 2,4 volt and 2,4 to 5 volt (forward/backwards or left/right on the joystick), however the button sends the 12 volts directly through and to the arduino, so i need to use a 'comparator'? in this line or the arduino gets fried. The signal the arduino sends to the 3 valves (6 controls total) needs to be 12 volt, so what do i put inbetween this wire?

Added is a picture of the rough schematics of the circuit, programming won't be a real problem as I know an IT student.

Sorry for my english!

You can make a [u]protection circuit[/u] with a resistor and a diode.

Or, you can make a [u]voltage divider[/u] with 2 resistors, but add a "backwards" diode between the Arduino input and 5V because you can get voltage spikes on an automotive (or tractor) electrical system. The resistor values are not too critical... It's the ratio that's important. The resistors can add-up to about 10K. Higher values are more susceptible to noise and lower values will draw more current (and overheat if they are too-too low).

valves are operated via 12 volts, basically straight from the battery, they are either on or off (not proportional)...

...The joystick gets 12 volts directly from a plug in the tractor (basically same as in cars, which you use for charging your phone), the potentiometers from the axis send out 0 to 2,4 volt and 2,4 to 5 volt (forward/backwards or left/right on the joystick),

It sounds like if you can find the "right" joystick with switches instead of pots, you wouldn't need the Arduino.

2formore2:
Hey all,

Ive recently bought 3 electric controlled valves for an implement behind my tractor. The valves are operated via 12 volts, basically straight from the battery, they are either on or off (not proportional). I want to control them using a joystick with 2 axis and 1 push button, when the button is pushed the axis are used to control a different valve, so I can control 3 valves with 2 axis and a push button.

The joystick gets 12 volts directly from a plug in the tractor (basically same as in cars, which you use for charging your phone), the potentiometers from the axis send out 0 to 2,4 volt and 2,4 to 5 volt (forward/backwards or left/right on the joystick), however the button sends the 12 volts directly through and to the arduino, so i need to use a 'comparator'? in this line or the arduino gets fried. The signal the arduino sends to the 3 valves (6 controls total) needs to be 12 volt, so what do i put inbetween this wire?

Added is a picture of the rough schematics of the circuit, programming won't be a real problem as I know an IT student.

Sorry for my english!

Welcome to the forum and your English is doing just fine.

Forget about powering the joy stick and switches from 12 volts. Your Arduino will have 5 volts with enough current for all of that.

Concentrate on the current required to operate the hydraulic valves. The normal little hobby relays won't be able to handle that.

Another discussion will be how to house the electronics and keep them cool and keep the dust out.

Paul

Hi,
Can you post a link to data/specs of the joystick and the valve solenoids?

Your joysticks output 2.4V from both outputs with the stick in the middle position?

Thanks.. Tom.. :slight_smile:

Hi,
If you are switching between 2 valves for one of the joystick operations.
When you have activated or de-activated valve1 then changed the joystick to valve2, do you want valve1 to keep its activated or de-activated state?

Tom.. :slight_smile:

Hi all thanks for the replies,

The joystick is a cheap aliexpress one, just try everything and to keep the cost down, the reason why i wanted one with potentiometers, is that i can adjust the sensitivity of the joystick through the arduino. (link: https://nl.aliexpress.com/item/1PC-New-Arrival-4-Axis-Plastic-For-Joystick-Potentiometer-for-JH-D400X-R4-10K-4D-with/32828346645.html?spm=a2g0s.9042311.0.0.9nbO48)

If been searching a bunch and came to the conclusion i needed solid state relays after the arduino for the valves to be operated.

And found that step down converters can be used to lower the voltage: Also read a bunch about step down converters for the 12 volt signal from the button, https://nl.aliexpress.com/item/DC-CC-Max-9A-300-W-XL4016-Step-Down-Buck-Converter-5-40-V-om-1/32845724444.html?spm=a2g0s.9042311.0.0.LQk0aH

The housing, thinking of repurposing my old lunchbox as arduino and relay housing :), will be in the tractor itself, while using it and when in 'storage' i might make it disconnectable via plugs as dust will be an issue in the storage.

When switching when you pressed the button i want it to stop the valve, basically stop the signal.

Hey all,

So i just got the joystick and it has x- and y-axis and an z-axis (rotating the top). So i have 3 potentiometers, which output a constant voltage between 2,41 and 2,58 when fed 5 volts from the arduino itself and when pushing it goes to either 0 or 5 volts.

These go into the analog input on the arduino A0, A1 and A2, so know i need to code it to output a signal.
I tried using the code for the fading led, but cant figure it out, so im basically at the start again. I want to get 2 signals from the A0 input, nothing when its in between 2,40 volts and 2,60 volts and when it goes over that, say 2,65, i want it to send a signal (voltage) to digital 0 which i can use for the valves with a relay inbetween so ican get it up to 12 volt for the valves. When under the voltage, like 2,30 i want it to send a signal to digital 1.

Im not sure if this is the right way to use the arduino for this, but i found codes which did basically the same but only outputting 1 signal not 2.

Any advice how to code this.

Thanks

Back up one step. How do your relays operate? Do they close and send 12 volts to the hydraulic valve when the control signal is low or 0? Or do the relays close and send 12 volts when the control signal is high or 1?

That information is the ultimate control for how your program MUST behave.

Paul

Paul_KD7HB:
Back up one step. How do your relays operate? Do they close and send 12 volts to the hydraulic valve when the control signal is low or 0? Or do the relays close and send 12 volts when the control signal is high or 1?

That information is the ultimate control for how your program MUST behave.

Paul

Or is it 12V to open and 12V to close the valve?

Hi,
If you go to this link;

It will show you how to code for the analog input that you need.

The code is also in the IDE examples in the Analog section, called AnalogInOutSerial.

What model Arduino are you using?

Tom.... :slight_smile:

Hi,

You will e better offt o develop your code in stages, using the example I linked in the previous post is a good start to getting your project going.

You will notice that the analog value that appears in the code from your A0 is a number from 0 to 1023.
I would suggest you do not convert it to a voltage in the code as you are only looking at some ON/OFF outputs controlled by the input level.

That sample code will show you what values you get for the extremes of your joystick travel and also when the joystick is central.

You can expect a center value of about 512, do not expect 0 and 1023 for the joystick extremes, this is dependent on the quality of the joystick mechanics and the potentiometer.

As for controlling your relays, the Arduino cannot supply on its outputs enough current to drive a relay coil, so a BJT transistor or MOSFET will need to be used to interface between the Arduino and relay.

Tom.... :slight_smile:

Hey all,

Thanks for the replies, the relays get a constant 12 volt from the plug and when they get 5 volts form the arduino they send the 12 volt through, atleast thats what i thought. Solid state relays. Here is the one im using, im using 2 because i need 6 of the relays: https://nl.aliexpress.com/item/free-of-charge4-road-5-v-10A-optical-coupling-isolation-relay-module/32304609560.html?spm=a2g0s.9042311.0.0.GGImNM

I am using a Arduino Uno.

Ill look at the code you send Tom!

Hi,
The OPs relays.


They aren't solid state relays, they are optically coupled relays, which will do the job.

Tom... :slight_smile:

Hey all

i had the time this weekend to continue my project, I managed to write the code mostly myself and it is working well. The push button on top is to turn the controls on and off so incase of an emergency i can stop it with a button on the joystick as well as an on off switch on the electric housing.

The wiring is almost done, only need to connect the wires from the hydraulic valves to the relais and then the whole circuit is complete.

Tomorrow ill test it with it behind the tractor, sadly i get the correct plug connector on teusday so ill need to half ass the power for the controls with an external battery.

Ill post some photos of the electronics tomorrow.