News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

Current control

Started by TimB, Mar 08, 2021, 11:19 AM

Previous topic - Next topic

TimB


Hi All

This is a new project. So any suggestions welcome

I need to control the current to a proportional valve. Basically higher the current the more the flow.
The specs are saying 0-350ma

It will be in a feedback loop so no need to have a set current although I presume it will be possible

It needs to be controlled via a pic. PWM would be ideal although I could consider a digital pot.

Any suggestions?

Many many thanks as always

Tim

charliecoutas

PWM comes to mind for me as well.  Hardware PWM so you just set the mark-space and then keep tweaking it via the feedback loop.

Charlie

See_Mos

hi Tim,

all of the variable industrial valve controllers that I have come across use PWM.  I should have some controller manuals showing block diagrams.  I'll have a look this afternoon.

Might be worth searching for ready made controllers.

TimB


Hi,

So just a Mosfet driven by a PWM signal will do?

Cheers

Tim

Stephen Moss

Quote from: TimB on Mar 08, 2021, 11:19 AMI need to control the current to a proportional valve. Basically higher the current the more the flow.
The specs are saying 0-350ma

It needs to be controlled via a pic. PWM would be ideal although I could consider a digital pot.
I am not sure a digital pot would work.
If it is current controlled would you not have to keep the voltage across it relatively fixed otherwise as the POT resistance increases the potential divider effect (depending on the relative pot to valve resistance) may create problems. Plus, I have not looked at them recently but 350mA may be a bit much to draw through one of those.

I would think that PWM is better than the digital pot, I presume you are thinking to smooth to a voltage and then Ivalve = Vpwm/Rvalve. May work but, again current may be a problem as unless you have some way of amplifying the current are you not limited to the 25mA of the PIC's I/O pin?
Also, and just speculating here, but would not the smoothness of the resulting voltage vary with the modulation depth? Generally that would probably be to small too notice for most things but if it is anything fluid dynamic related is there is the potential that fluctuations may have an adverse effect if the value position chatters because the voltage is not totally smooth?

Not done it myself but perhaps use a PIC to control an I2C DAC with the output voltage driving the gate of a MOSFET (essentially a voltage controlled current).

TimB

Stephen

The digital pot was to control an opamp or as part of a regulator circuit. Not to pass current through it.

The PWM was also to control an external digital switch like a Mosfet.

Tim

 

top204

#6
I did this type of unit a few years ago for controlling a copper plating bath's current, that has to be constant for smooth plating.

In essence, it is a constant current load controlled via PWM with feedback.

The MOSFET has a very low Ohmage, large wattage, resistor to its Gnd that feeds an Op-Amp for amplification. This gives the current used by the MOSFET to the microcontroller's ADC, which in turn allows a simple mechanism to increases or decreases the PWM duty cycle for the current required. Because the microcontroller can see the current used by the load, and it median filters it, it can maintain a constant current to it in microsoconds resolution.

I did try a PID mechanism, but they are quite slow to initially stabilise and by the time it had stabilised (a few 10s of milliseconds), the plating had made some roughage on the copper sheet, so I used a very simple, fast, routine that altered the PWM duty to give the current required, if and when, it was required to change. OK, the current wobbled slightly when it was at its required current, but only a tiny amount because it was being altered in microsecond steps so it never wobbled a lot. :-)

I've come across, and created, this type of mechanism a few times in the past, and PID is not always suitable, and can give complexity to a simple process, but the acronym "PID" tends to be a "buzz" word for the general enthusiast reading copy and pasted articles. However, sometime's a little wobble is OK if it has a high enough resolution not to matter for a slow moving object that is being controlled. i.e. Heat, water flow etc...

Something like:

'--------------------------------------------------------------------------------------------------------
' Adjust the Current based upon the required Current
' Input     : wRawCurrentIn holds the current from the sensor
'           : fPCB_CurrentRequired holds the required current
' Output    : None
' Notes     : Uses a simple mechanism to adjust the 10-bit PWM voltage on CCP1
'
Proc Current_AutoAdjust()
    Tank_Read()                                                         ' Read the PCB in the Tank ADC (AN1)
    If tPCB_InTank = True Then                                          ' Is there a voltage, meaning the PCB is inserted into the plating fluid
        Current_Read()                                                  ' Yes. So read the current from the sensor resistor
        If wRawCurrentIn >= 1000 Then                                   ' Is there too much current?
            WriteAnalog1(0)                                             ' Yes. So shut off the current to the load
        Else
            '
            ' Reach the correct current out
            '
            If fInputVoltage < fPCB_CurrentRequired Then                ' Yes. So is the current sensor less than that required?
                Inc wRawCurrentOut                                      ' Yes. So increase the current output
                If wRawCurrentOut >= 1023 Then wRawCurrentOut = 1023    ' Make sure it is within upper bounds
            ElseIf fInputVoltage > fPCB_CurrentRequired Then            ' Is the current sensor greater than that required?
                Dec wRawCurrentOut                                      ' Yes. So decrease the current output
                If wRawCurrentOut <= 1 Then wRawCurrentOut = 0          ' Make sure it is within lower bounds
            EndIf
            WriteAnalog1(wRawCurrentOut)                                ' Place the output onto the HPWM
            Display_CurrentValue()
        EndIf
    EndIf
EndProc

And the above procedure is called within the main body loop so it is called very rapidly.

TimB


Hi Les

The system is to control the temperature of feed water. The water is made by condensing steam, however the steam pressure varies a lot. The result is the water gets hotter. I do have PWM control on the cooling fans but at high pressure it overwhelms the cooling system.

I have a needle valve and rely on the user to keep an eye on the system temperature and shut the valve in. However it can creep up when your not looking.

This system is more automatic so I need to control restrict the water flow and hence give the cooling side a chance to keep on top of things.

It is really to provide a constant flow rate based of the temperature.

I agree with the issues with PID's I never got them to work. Even on a commercial mixer speed controller I just had a load of case statements to manage the correction input.
Not my finest work.

Really appreciate you sharing your code. I do not need high speed feed back but will read an understand how you did it.

Tim

See_Mos

#8
Sorry, nothing useful, just some outline diagrams and setting up PID etc.  This is one that I repaired many of:-

https://www.pees.com/media/pees_an528_e.pdf but these people don't give much away.

A quick search for 'proportional valve control circuit' threw up some basic stuff.

Including this which uses DC control rather than PWM:-

http://aldax.se/wp-content/uploads/2012/12/HFPRO-9_26_12.pdf

and a discussion of valve control here:-

https://www.eevblog.com/forum/projects/pwm-circuit-to-control-hydraulic-proportional-valve/

RayEllam

#9
I worked on industrial stuff like this many moons ago.

I would suggest PWM from pic - low side MOSFET driver - N channel MOSFET connected to negative side of motor.

I take it you have some form of positional feed back from the valve?

TimB


Thanks Ray


There is no feedback from the valve. It's a solenoid that rises and falls depending on the current supplied. Its current vers spring. I think a PWM of a reasonable freq to eliminate too much buzzing will do the job

My issue now is finding the right valve. I saw one for £60 and thought that would do it. However its 24v and I want to work on 12v. They do a 12v version but nobody sells it.

Considering my aim is to reduce the potential temperature I'm thinking now to replace that one proportional valve with 2 normal ones. A restriction in both will give me 3 flow levels and rather than costing £20 it will be ~£10.

Tim

RayEllam

#11
Ok I get it. So the valve has no feedback and adjusts to a value dependant on I. If that's the case then your feedback could be a V dropped across a low ohm resistor to ground from the solenoid, amplified then fed to a pic AD?



RayEllam

There are other valves available. Non solenoid types that have DC motors controlling a motor gate valve. I'm working on a similar project at the moment.

TimB


Just to be clear. I do not need feedback from the valve. It would have been adjusted based on a temperature variable. That temperature would have been very slow changing. A bit of suck and see would be all that is needed to adjust the change speed.

yes I could build a motorized valve. But then I need a stepper motor, a stepper motor controller, a valve to adjust, a union and load of space.

I can get away with 2 valves ~£10 and 2 mosfets. No PWM and simple code.

Tim

okmn

I will have a small but very serious suggestion !!

First drive the valves and similar products with coil inside with direct current (DC), test it like 500ms or less !!!
then immediately switch to pwm and pwm rms (effective) voltage is half the valve operating voltage !! so the valve (coil never gets hot and you can continue driving without ever cutting.

RayEllam

Hi Tim,
Just for your reference. This is the motorized valve im going to use on my next project. Comes im a variaty of fittings and voltages and Costs <£10

https://shopee.ph/product/302190146/4552696144

Ioannis

Hi Tim.

If your valve needs 0-350mA as a control signal, then the PWM will have to go through a Voltage to Current circuit and in this circuit you need a current source controlled by the PWM signal.

If you are sure that your valve needs current control and not voltage control I can make a circuit to help you on this.

Ioannis

TimB


Thanks Ioannis

I really appreciate the offer.
What I have found was there were no reasonably priced proportional solenoid flow valves. So I'm going for another suggestion. A stepper motor controlled needle valve. It helps as the temperatures may be high and all the proportional valves I have seen are meant for air.

The issue is though, that on start up I need to ensure the valve is shut, or at least pretty well shut. Then wind it open in a feed back loop. A lot depends on the flow through the valve. It may take more than one turn. So on power up I need to wind it closed for at least x turns. But I may be squishing it against the seat then when I go to undo it its stuck.

To combat that I may need to have reduced power driving in than out. Some stepper drivers you can set the current limit. So might utilise that. Or use a valve that does not make more than 1 turn and place a pot on the shaft to know its position. I can then wind it in until its almost shut. Then there will be no issue with it sticking.

Tim

top204

For that type of mechanism, why not do what the galvanic motors sometimes do and measure the current used by the stepper and as soon as it starts to increase beyond a set limit, shut it down. It can be shut down in an matter of microseconds, then store the position of the stepper motor, so the next time, the firmware will have an idea of where it is and when to start looking more closely for it to shut or open.

Depending on how fast the valve needs to move, the drivers that have a 256:1 microstep ratio are excellet and give such a high resolution to a standard stepper motor, but are quite slow, so maybe a 64:1 or 128:1 will do. As you stated, some of the drivers have the current monitoring built in and some of them bring it out so a microcontroller can monitor it using an ADC.

 

m.kaviani

you need to couple a step motor with your needle valve.
now you need a voltage source with a current limiter of around 350mA, this helps you to not damage the valve seat when trying to close it.
so you may make a current monitor circuit to read the current and you have to consider an interrupt for the current limiter.
when the system orders the valve to close it close until the interrupt occurs.
here valve is completely close. now you can open the valve based on the temp or pressure signal like a closed loop.
After the closed valve count the pulse that the board sent to the step motor.
for example, if you send 10 pulses to open the valve. then send 10 pulses in the reverse direction.