Current feedback control by Arduino Uno+Motor Shield

Hi all

Recently, i am working on a project which is going to use the Uno and Motor Shield to build a current feedback control circuit. The target is a DDV proportional hydraulic valve. Since the motor shield has a current sensing analog input, A0, i would like to read that value and use a proportional gain to build a feedback loop to control the current of the solenoid in the valve by changing the PWM duty cycle. However, the value i get from A0 is not a constant, it varies similar like the square wave signal. What should i do to get a constant value?

Regards

Hi, welcome to the forum.

This motor shield ? http://arduino.cc/en/Main/ArduinoMotorShieldR3
Can you give a link to the valve ?

I don't know of a PWM signal for a proportional value is okay. I think it is not okay. That is not how solenoids work, that are activated or not.
Why do you want to control the current ?

It is possible to add a RC filter to A0, you have to change the hardware.
Perhaps you can measure the analog A0, while the signal is high. That will be very inaccurate, since it is the current of an inductive load.

What frequency PWM, what's the valve (datasheet)? With a high enough PWM the
current to an inductor should be nicely smoothed out, but you need to measure the
current in the line to the motor/valve, not in the H-bridge, or you'll need to synchronize your
readings with the state of switching the H-bridge.

Peter_n:
Hi, welcome to the forum.

This motor shield ? http://arduino.cc/en/Main/ArduinoMotorShieldR3
Can you give a link to the valve ?

I don't know of a PWM signal for a proportional value is okay. I think it is not okay. That is not how solenoids work, that are activated or not.
Why do you want to control the current ?

It is possible to add a RC filter to A0, you have to change the hardware.
Perhaps you can measure the analog A0, while the signal is high. That will be very inaccurate, since it is the current of an inductive load.

Hi, thanks for your reply, yes, that is the motor shield i am using, and the valve is here, http://www.moog.com/literature/ICD/E242CartridgeDDV-ds.pdf

is that possible to build a current feedback control loop based on the hardwares?

MarkT:
What frequency PWM, what's the valve (datasheet)? With a high enough PWM the
current to an inductor should be nicely smoothed out, but you need to measure the
current in the line to the motor/valve, not in the H-bridge, or you'll need to synchronize your
readings with the state of switching the H-bridge.

the default frequency of the PWM is 490Hz, but this can be changed by do some programming. I tried to increase the PWM frequency, however, the current sensing value is still not a constant value.

That is not a normal solenoid with a plunger. It uses a linear motor to make it proportional.
I never had one of those, so I'm just guessing here.

This seems to be the manufacturers page : http://www.moog.com/markets/motorsport/products-for-motorsport/

They have many documents : http://www.moog.com/literature-search/industrial-group-literature-library/

There is a drawing in this one : http://www.moog.com/literature/ICD/g123-821electronics-an.pdf
that has PWM output and it measures the current in a feedback.

A linear motor with current control is indeed the way to go.
I think you have to modify the motor shield. A RC filter for the current feedback should be enough to get an accurate analog value for the current.
The PWM of an Arduino is around 480Hz, a filter for 100Hz or lower could be with 4k7 and 470nF.
Perhaps you can connect that filter to an unused analog pin ?

A very high PWM smoothes it out, but I don't know if the L298 can go very high.
As far as I know, the Motor Shield measures the current of the H-bridge, not the current through the valve. For normal PWM frequencies, I think that is not a problem.

The valve is only 5.2 ohm, perhaps the L298 on the Motor Shield will get very hot.

P.S.: You don't have to quote a post, since it is already there :wink: You can use the REPLY button or the Quick Reply input field.

Hi,
I think you need to lower the PWM from 490Hz to 150Hz quoted in the data sheet.

I find it is best to use the oem driver for the valve as it is tuned and setup for the current limit rather than try and reinvent the wheel.

Tom...... :slight_smile:

Thanks for your help. The PWM frequency can go up to 4kHz, and i have tried to increase the frequency, but the analogread value from the current sensing port, A0, is still not a constant. As you said that the motor shield measure the current goes into the H-bridge, but the documents say that we can measure the current going through the motor by reading the value from analog input A0. i am confused about this.

TomGeorge:
Hi,
I think you need to lower the PWM from 490Hz to 150Hz quoted in the data sheet.

I find it is best to use the oem driver for the valve as it is tuned and setup for the current limit rather than try and reinvent the wheel.

Tom...... :slight_smile:

An OEM driver is the best choice, however, for some educational purpose, i`d like to try to build it by self. Are there any advice you would like to share? Thanks very much

I don't have a problem with 480Hz instead of 150Hz, but that is only because I don't undestand why it should be 150Hz :smiley:
I also don't care which current is measured. I assume at normal PWM frequencies they are more or less the same.

Did you try a RC filter and use A1 for that ?

Oops, I opened the schematic to see if A1 is used, and it is. Both A0 and A1 are for the current measurements.
Even A2 and A3 seems to be used for something.
You have to use A4 or A5.

Peter_n:
Oops, I opened the schematic to see if A1 is used, and it is. Both A0 and A1 are for the current measurements.
Even A2 and A3 seems to be used for something.
You have to use A4 or A5.

Yeah, that`s right. A4 and A5 are the two i can use. would you mind to draw a sketch of how to put the RC filter in the circuit, i am really poor in the knowledge of electronics. thanks!

4k7 resistor from A0 to A4.
470nF capacitor from A4 to GND.

Hi,
The valve dynamics will have a problem with the higher PWM frequency, such as linearity of operation, even getting the valve to start opening and the impedance of the valve coil.

Tom.... :slight_smile: