I am using an Arduino Uno with a 10K pot and BTS621L1 SmartFET transistor (12vdc supply) to control a proportional hydraulic pressure relief valve. As the pot is varied, the PWM duty cycle is adjusted to provide more or less current to the solenoid coil. I am using the basic map function for this.
Basically my problem is that as the coil heats up during prolonged use, resistance increases and current decreases. Thus, causing solenoid actuator force to decrease and as a result reducing the set hydraulic pressure without touching the pot.
I have an ACS712 hall effect current sensing inline with the coil (basic wiring as you can imagine). The ACS712 is a 5amp version with a 185mA/V sensitivity. This signal is input back into an arduino analog input pin and works as it should.
My coil spec is as follows:
12vdc
6.4 ohms @ 20 degrees C
9.4 ohms @ 50 degrees C
Now, here comes the million dollar question:
I am unsure of how to take this analog input and program the arduino to implement some kind of current compensation / stabilization so that (with no adjustment of the pot) as the current drops due to increased resistance in the coil the PWM duty cycle is adjusted to keep the current stable?
Any help would be greatly appreciated with this. I havent provided code as my code is basically the arduino LED PWM POT tutorial with the addition of my ACS712. Wiring diagram wise, I havent got one drawn up, but again its fairly basic, and shouldnt effect my programming question.
You read the current and if it has dropped below what you require you nudge the PWM duty cycle up by one.
You can find the relationship between the PWM cycle and the current by measuring a cool solenoid. Put this in a look up table so you can check if it is correct and when to nudge the value.
Ok I understand. So in non-logic terms would I be right in writing code to this explanation:
Read current immediately after POT adjustment and save value to a variable eg. SavedCurr. Do not resave SavedCurr value until pot has been adjusted again.
If CurrentCurr > SavedCurr then reduce PWM duty cycle by 1 until CurrentCurr = SavedCurr.
If CurrentCurr < SavedCurr then increase PWM duty cycle by 1 until CurrentCurr = SavedCurr.
Therefore when the arduino detects movement of the POT an output (PWM) current measurement is immediately taken. Then say over half an hour (no pot movement) the temperture of the coil increases and as such current drops due to increased resistance, the correct code will adjust the PWM in order to match the actual current to the current recorded immediately after POT change?
Is this along the right sort of line? If so, what sort of delays do I need to account for to allow the current to settle after adjusting the pot? And the same for the adjustment of the PWM until it is corrected again?
before you try to control a device, you need to know exactly what that device needs.
do you have a data sheet to your proportional hydraulic relief valve ?
I was not aware that you could control a [solenoid] coil proportionally. for relays and such, it is either full on or full off.
of course there are devices that are designed for different applications and different uses.
best to start with what that device needs. once we know that, we can help you to get the Arduino to provide that output.
Yes I already know what this device needs, and it is working accordingly. So please do not worry about that side of things. I have taken this into account. Yes it is possible to control a proportional solenoid with a coil through current control. However the solenoid and valve have to be of proportional configuration and not of ON/OFF configuration like you say. Electro-proportional hydraulic valves are a common sight in most hydraulic machinery these days.
The coil requires between 100mA and 1200mA to cover its complete range. Like I say, this works accordingly using the BTS621L chip.
The problem I have is how to go about coding the current feedback / stabilization?
Is my logic along the right sort of lines? How could I go about recording the current once after adjusting the POT, then not again until the next time the POT is altered?
The pot-to-current relationship should be fixed, independent of the temperature. Something like Current = PotValue * Constant.
When the pot value changes, the related current is calculated and becomes the new SavedCurrent value (step 1), whereupon the PWM will adjust to the new value (step 2). I'd only rename SavedCurrent into DesiredCurrent.
How could I go about recording the current once after adjusting the POT, then not again until the next time the POT is altered?
That would be a simple if statement saying that if the pot reading was the same as last time do nothing, if it is different adjust the PWM and take the current reading.
BUT
is that what you want to do? I would have thought not. You want to constantly read the current and adjust it if it is not what you want it to be. That way you will constantly adjust for any heating that takes place.
The pot-to-current relationship should be fixed,
No it is not due to the change in resistance caused by heating.
DrDiettrich:
The magnetic field strength depends on the current, not on temperature.
Yes you are right. But temperature dictates resistance, and resistance dictates current.
Grumpy_Mike:
That would be a simple if statement saying that if the pot reading was the same as last time do nothing, if it is different adjust the PWM and take the current reading.
BUT
is that what you want to do? I would have thought not. You want to constantly read the current and adjust it if it is not what you want it to be. That way you will constantly adjust for any heating that takes place.
Mike, thanks for the update, I think your the only person who is actually reading and answering my actual questions lol! Appreciated.
To be honest I just need a method of holding the current at the value that is set on the POT, regardless of temperature change. Would this not be the easiest way to do this? I do however like your idea of a lookup table with the PWM duty cycles and corrosponding current values on a cool coil. However I have no idea how to integrate this sort of code into my program.
You seem to be confused by the many answers. Your sketch in #2 is correct, except that you don't need to read the current when the pot changes. The actual current value is only required to adjust the PWM duty cycle.
DrDiettrich:
You seem to be confused by the many answers.
You seem to be missing the vital point that the resistance of this coil is changing with temperature. Therefore applying a constant voltage will not produce a constant current. As the temperature increases the current will drop because the resistance increases.
owever I have no idea how to integrate this sort of code into my program.
The other way to do this is in hardware. Implement a constant current drive that you can use the smoothed PWM output to set the current.
Grumpy_Mike:
You seem to be missing the vital point that the resistance of this coil is changing with temperature. Therefore applying a constant voltage will not produce a constant current. As the temperature increases the current will drop because the resistance increases.
And to compensate for that effect, the current is measured and adjusted. Did you miss step 2 in #2?
That seems to be a lot of current. there are many types of of proportional hydraulic controls out there. There are mechanical pressure relieving valves too. You might want to try putting a pressure sensor into the works.
Most of what I worked with had about 60 ohms across the coil. I would never use electronics to relieve pressure. An electronic malfunction could get someone hurt. As far as control, I've use 4-20 mA, voltage and PWM and mostly Sauer-Danfoss in mobile equipment applications. Recently they have introduced CAN-Bus too.
I will try to throw some code together for my logic explained in my previous post. I'll let you know how it goes. I'll also do some research into the lookup table.
Thanks for your time, I feel like I'm now heading in the right direction.
Hi,
I agree with Nasa, that low a resistance is unusual for a proportional system
Please post link to valve solenoid specs, it should tell you what the PWM frequency should be for that coil.
It is important for efficient operation that the frequency is correct.
What does the spec say that the control PWM frequency should be?
I already know what this device needs, and it is working accordingly.
No its not you have told us.
If so why is the coil getting so hot?
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Jim_cliff:
Yes I already know what this device needs, and it is working accordingly.
this is like saying my project is wired perfectly and my software is working perfectly.
but it is not doing what I want.
I refuse to tell you anything about my software or my hardware, but can you help me ?
let me put it very clearly your device is working EXACTLY the way it should because it is working the physical universe parameters of pressure and voltage and the like.
you may not understand WHY it is doing what it is doing and you want to altering things to make it bend to your will.
however, all you can do is alter the physical universe parameters such as current and voltage.
you are asking for us to help you solve an equation but are refusing to give us half of the equation.
Ok, give me a little time to draw a circuit and get the valve specs. I do understand what your saying. Besides after prolonged use with decent functionality I am now having problems with the valve juddering violently when the coil gets hot. So yes, maybe I jumped the gun slightly..... apologies.
Just to let you know the recommended PWM frequency for the valve is 140 Hz. However after speaking to the valve manufactures they have said it is practically a case of trial and error to find the best frequency, which usually varies between 80 and 250 Hz. I have set the Arduino PWM to run at a frequency of 122 Hz.
As for the process, hydraulic systems are basically compression of fluid, creating heat. the heat is either allowed to just radiate where it may, or it is run through coolers.
if your valve is experiencing environmental effects, then your project may need to either develop a lookup table for simple corrections, or monitor that change to try to compensate for it before it changes things too much.
Just to let you know the recommended PWM frequency for the valve is 140 Hz. However after speaking to the valve manufactures they have said it is practically a case of trial and error to find the best frequency, which usually varies between 80 and 250 Hz. I have set the Arduino PWM to run at a frequency of 122 Hz.
Because PWM is being used to control the valve, and this is basically applying AC to the coil, just the DC resistance is not the only impedance in the circuit.
Xl = 2 x pi x f x L
so 80 to 250Hz is a three fold change in frequency, hence a three fold change in impedance, I don't how much the impedance is but it could influence the current.
Does the manufacturer of the valve assembly sell a controller for it as well, if so, what is the spec sheet for it, a link please.
Tom....
PS, just valve make, model will do.... and we can trawl for specs.