Controlling 4 hydraulic valves

Hello,

I'm trying to control 4 proportional hydraulic valves with my Arduino Uno.

To do this i have 4 mini joysticks (single axis) that work with a signal from 0,5V to 4,5V with neutral position 2,5V.
The valves that I need to control work with a PWM-signal (see picture below)

the problem now is that I'm not really know how to transform the 0,5V - 4,5V to a correct PWM-signal... I've never done this before.

Is there somebody that could help me with the code? If I would know how to do it for 1 valve, i can copy the rest.

thanks in advance !

If you put a pot across 5V and GND, connect the wiper to analogue input of an Arduino then using analogRead() will give you a value between 0 and 1023. Actually slightly less range because of the voltage range of 0.5V to 4.5V

The value will be proportional to the position of the pot wiper and you need a value between 0 and 255 as the PWM output

If you divide the value from analogRead() by 4 then you will have the proportional PWM value as if by magic. Try it first by printing the PWM value to the Serial monitor


void setup()
{
    Serial.begin(115200);
}

void loop()
{
    Serial.println(analogRead(A7) / 4);
}

Free Code: Interesting project but we are not a free code writing service. We will help out with your code but first you have to make an attempt to write it, post it and explain what is not working properly. If there is hardware it is always best to post links to technical information as there are many versions of the same or different items. Since we cannot see your project, my eyes are to weak, you need to post an annotated schematic (best) or a clear picture of a drawing. Pictures never hurt. Frizzing diagrams are not considered schematics here.

Look at the map() instruction after you have read the Arduino Cookbook and done a few tutorials on line. Also some on basic electronics. This is not that complicated and I expect you will have it operating before you finish the cookbook.

looks like you need a signal value between 0.25 and 0.75 of your supply voltage, Udc which is 11-32V

an Arduino can't output more than 5V, but can drive a transistor connected to through a resistor to a higher voltage. The PWM output at the junction between the resistor and transistor, the collector, will be inverted.

since the arg to analogwrite is 0-255, a value of 64 corresponds to an output of 0.25 on the output pin and will be 0.75 from the transistor. and similarly 192 will be 0.25 from the transistor.

this illustrates driving the transistor, the 33k resistor would be the device it drives and is not part of what you needed.

700ba7777b9dc066e79f4045e4c07b3b1d8a02f7_2_500x211

may be better to use on opto-coupler

7339687b7e588924cfe451c74fbde70de818bac3_2_500x206

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