Hydraulic cylinder control - HOLD position


I`m creating a RC-hydraulic system with one hydraulic cylinder.

The LCD code;
I already made arduino LCD code is shoving to me on the LCD screen the value of position of the hydraulic cylinder. from 0-100 [%]. I`m using the analogue sensor to take the value for the stroke.

Stroke control code with 3/4 directional valve - still working on that
To control the move with three buttons; forward, hold, backward.

In normal state/position of the 3/4 directional valve is in the open position - oil moves to the tank. So the pump run the oil to the tank and so on. And the A and B to the cylinder are blocked. In the case of oil leaking I want to prepare the HOLD and the ALARM code.

And here I have an issue! The HOLD button…I need help, if anybody of you have an idea.

Function of HOLD;
If the system by analogue sensor detect a change in position, it must react automatic with “forward” or “backward” to reach the proper position.

I think I need to have another button “AUTO mode” where I can run another HOLD code. Correct me.
MANUAL mode - where I can press the button to act on stroke.
AUTO mode - where the system can act automaticaly, when the HOLD button is pressed.

Thank you in advance!



Hi "xyz",

welcome to the forum.

There is no way around providing much more detailed information about the components you are using.
Mentioning a 3/4-way-valve is far away from beeing sufficient. (only very few users here will even know how such a valve works in detail)

Can you please provide a handmade drawing of the complete hydraulics and the complete electrical wiring and write down a much more detailed description of the functionality that you want to achieve.

You can go on posting short messages with insufficient information. This will have the effect of delaying the completion of your project und increase the unwillingness of people to write answers. So my recommendation is to start on detailing right with your second posting.

This my sound somehow "rough" It is just meant as getting clearly to the important point.
best regards Stefan

when you push the hold button, make a state change :
"HoldPressed" true
then, check this state with sensor data change, and react automatically
HoldPressed fallsback to false only if a button is pressed (not when auto cycle decides to command "move"

OK, I`ll gave you more info about my project:
The goal is to move hydraulic actuator in very precise sloooooow short stroke=18mm.

The hydraulic system is small - RC hydraulic models in this way. But, I want to do some hybrid type, RC-in industrial way:) ...I need the stroke holding force around 1500kg in both directions, so I choose hydraulics and I need to control it.

so...BLDC-KV1000 - motor run the pump, Ill run it manualy, I attempt to change rpms for the testing with potenciometer. The goal is to find right rpms from 7000-12000rpms "adjusting the pump flow" - for testing the system.
Im want to test the fade IN/OUT for the stroke-I need to correct the HOLD position. I dont know jet majbe with rpm`s. Slower is more precise. Important info, but I must come to this point.
How slow/precise I want, I need to test.

The direction valve "HYDAC-WK06G-01" has two coils; 12V @0.98A each, to charge each coil, to move the stroke of the cylinder, one for forward and second for backward. I need manual mode and automatic mode for testing and simulate oil leaking so the actuator will lose the adjusted position. The automatic system will correct the position automatically.
The LED reed light will shine or alarm-beep will screaming with ERROR-lost position and oil leaking info on bigger LCD screen will shown up...this must be, becaus of this info I can recognize the broken piston seal.

I already prepared the test bench with AC/DC 400W [12V@33A power supply].
BLDC-KV100 motor
16x2 LCD or multiple of them 16x2 or one bigger LCD
3/4 directional valve with two coils
electronic hardwer components, have a lot of them and still waiting for them
...I`ll wrote here what I have

I already tested the LCD code, with LCD 16x2 and special potenciometer and works fine. I have info the position from 0-100[%], 18mm=100%

I already test the BLDC-motor code. I can adjust the motor rpms, If we look the scale on the potenciometer, the motor start spinning from 25% and at 60% has max.rpms. The code is simple, but I tried with 5Kohm, 100kohm potenciometer and is the same...I don`t know where is the problem.

I done a lot for now. I have done cca 50% of entire work for now, mechanicaly I done all in CAD
Now I realized that I need help because I`m not electric engineer, I know only basic fundamentals in this world.

I understand, Im also rough, because in the beginning also I dont know how to inform you to explain. I will provide my hand drawings but remember this, Im not electric engineer :confused: ! The hydraulic is simple in this case....pump+3/4valve+actuator, thats it.

Thank you for understanding.


Your Arduino can't manage 12V or 0.98A so you will need some external circuitry to switch the coils on and off. A pair of relays would do it or SSRs or MOSFETs

HI G.,

OK I understand. I guess (but I'm not sure as you haven't posted a drawing yet)
That your potentiometer is connected


Analog-IO-pn---middle potentiometer-pin


And in this case it is in fact thsi way that the resistance of the potentiometer is variable in wide ranges with getting always the same result.
The potentiometer acts as a voltage-divider %-resistance is equal to %-voltage.
The analog-pin measures the voltage
The current flwoing through the potentiometer is different with different resistance but the %-voltage stays the same
because if the resistance is divided 30%/70% the voltage gets divided the same.

Regardless of what the summary-resistance of the potentiometer is. The voltage just depends on the resistance ratio

3 kohm / 7 kohm = 300 kohm / 700 kohm

anything above 1 kOhm and below 1 Mega-Ohm will work.
below 1 koHm the current gets too high
above 1 Mega-Ohm the circuit becomes too sensitive against electromagnetic noise (EMV)

You wrote Your ESC starts moving the motor at 25% and maximum is reached at 60%
Well depends on your code and depends on the calibration of the ESC. Most ESCs can be re-calibrated as
usual RC-TX-Rx-equipment from different manufactures differs in signal-range too.

How to activate re-calibration should be written in the manual of the ESC.

Yea the hydraulic is simple - for you

not simple for all users well knowing arduinos and programming but knowing nothing about hydraulics.

best regards Stefan

Your Arduino can't manage 12V or 0.98A so you will need some external circuitry to switch the coils on and off. A pair of relays would do it or SSRs or MOSFETs

I know, I have extra hardwer for that.

Stefan, I will post my first drawing...give me the time. Also kids are waiting for me :slight_smile: right now.
I`ll go step by step.

I want to learn a lot, you will se what I bought already, however, I don`t have a knowledge like you here in programing.

I`m still learning this because I want to learn.

Good to know.
I made two codes for now, LCD and BLDC. Separatly for each. I didnt combain them jet. All functional codes what i need I want to test separatly then I want to combine them together. That is my thinking so far. Remember, who am I.
For now:
The LCD code is 100%-OK,
The BLDC is a cripled code. I didnt know, that ECS can be recalibrated...I never done this...how should I know?..no manuals with the ESC, it is from aliexpress :confused: . Ill understand if you`ll think-buy good components.

Ill write for each Arduino UNO pin-out where is which potenciometer and the LCD connected. In next posts. Also, Ill share the BLDC code...I had problems with wireing this, maybe this is major problem for me...also one time I run the code on LEONARDO next time on UNO..

Tomorow to be continued.


kids are important too. Of course.

There are some common methods how re-calibrating on EScs is initialised
If you can post a link to the ESC that you bought and a picture with the number on it

I can try to find a manual or a YT-video how to do it one method is
put signal to “full throttle” bevore powering the ESC if the beeping has finished or maybe some kind of beeping is repeated put signal to throttle off.
but there are also some other methods

I haven’t bought from aliexepress yet. but from banggood. They have a feature that you can ask questions about the products. maybe aliexpress has this question-feature too.

best regards Stefan

Test bench:

I2C motor driver TB6612FNG - 2pieces:

I have also motor drives (Deek-Robot) - 2 pieces
A lot of L293D chips.

ESC with motor:

About the ESC and motor. I can buy another-NEW, That one which can be easy calibrated. Just write me which one. It must be at least 1000KV.

I know, I need to have right hardware. I bought what I think is OK, for the test.

Are there any more numbers on the ESC than just the 30A label?
Is there somewhere printed a name of the manufacturer?

Do you still have a link to this ESC? So I could look up if there is a datasheet or manual to download at aliexpress.

About the 1000KV. This is a technical data about the brushless motor. It says the motor rotates at 1000 rpm per volt with no load attached to the motor.

The important specs about ESCs is how many lipo-cells in serial can it handle as an equivaltent to the maximum input-voltage.
Most ESCs of this size can at least hande 2S-3S (which is 24.2V = 8,4 to 34.2V = 12.6V
Many of them can 4S = 4*4.2V = 16.8V and the amperage they can handle. A 30A ESC should be used at 2/3
in your case 20A to stay away from the limit.

For maximum perfomance most ESCs can be adjusted in a timing parameter. But this is not important. I have never changed the timing of any of my 30 electric planes.

I estimate it is this motor

technical specs says 12A so can be easily driven by a 30A ESC. suitable for 2S-3S this means

3*3.7V = 11.1V with 1000 KV this means maximum rpm without load 11100 rpm

You have to test how this motor works in your application. For a hydraulik pump the motor will run all the time at high load. This means you have to stay in the max-amperage that the motor can handle without overheating.
Once overheated the magnets are destroyed and the motor looses a lot of power.
So I would test how many amperes the motor pulls from the ESC under maximum load.

Most manufacturer don't tell anything about the long-endurance max-power-rating. Just a short maximun 15 to 30 seconds or even without any time.

For a different ESC in which country do you live?

best regards Stefan

Question; Are there any more numbers on the ESC than just the 30A label? Is there somewhere printed a name of the manufacturer?
Answer; Only this label. I decide to buy another ESC, which do you prefer?

I decide to supply the ESC directly from 12V from 400W AC/DC power supply. The ESC have constant 12V.
Yes, you attach the right link do the BLDC-motor.

I understand this electrical consumption - you have right. So I already prepared the test bench for that, but I have some problems to run the motor - rpm`s problem.

I`m from Slovenia.



Hi "G."

rpm-problems. is a pretty vague description. What exactly is the problem. Describe the behaviour of the motor.
If you look through RC-shops in slovenia you will find a lot of ESCs. The important thing is to look if you can download a manual for the ESC.

HobbyWing has a good price/perfomance ratio.

manual can be downloaded here

But there are more manufacturers than just hobbywing
Just google for rc-shops in slovenia and then search in the shops what 30A ESCs they do have
and if you can download a manual from the manufacturer.

best regards Stefan

Well, As I wrote already, the motor spins like ...

If we look at the potenciometer scale-numbers from 0 to 10.
at 2 start to rotate
at 6 reach full rpms
from 6-10 no changes - just full speed.

That is my BLDC-motor problem.
If I need to buy different ESC, then I will. And what to do next after I have the new ESC?

Project in graphic mode: