# Controlling a Piston Variable Pump with a Raspberry Pi

I'm involved in a team that is controlling an AA10VG axial piston variable pump using a Raspberry Pi 3 Model B V1.2. I've been delegated to design the circuit which will control the pump's displacement, but I simply don't understand electrical engineering enough to do so.

We already have a separate 12V power supply which will control various other components of the design as well as a PSU for the RPi. We have an MCP4725 DAC for converting the desired displacement control from digital to an analog signal, but here is where the problem arises: actually controlling the pump.

The pump displacement is varied according to the current of the 12V supply (from 400 mA to 1115 mA). The DAC has a voltage output of 5V with a current of 25 mA. We need to find a way to make the DAC reliably control the pump displacement, but I'm at a loss for how to do so.

I assume that we'll need some sort of current amplifier which can be controlled by the 5V output's current but powered by the 12V supply. I have looked into multiple op-amps and six or seven questions on this site alone, but all of these relate to either constant voltage throughout the system, current-agnostic systems, or are unrelated in some other way.

If this is feasible, please provide details on the symbols in your circuit diagram as I am new to this.

Disclaimer: I am a computer science student whose team's electrical engineering student has entirely failed to assist in any way, and I've been picked to fix it because I'm the closest to it. Please be patient with my ultimately limited understanding.

• DAC isn't design to drive a piston.... DAC are made to generate analogic information signal from digital information signal. – MathieuL May 23 '18 at 20:08
• @MathieuL We need to convert a digital input to an analog output which scales current relative to the maximum of the digital input. This was the only way I understood how to do this, so if there is a better way I wouldn't be surprised. What would you suggest instead? – Addison Crump May 23 '18 at 20:11
• The basic strategy is to use PWM to drive the gate of an IGBT/MOSFET transistor which is connected to the pump. – MathieuL May 23 '18 at 20:12
• PWM resume to measure the current and than inject pulse into a transistor gate. The pulse of voltage will generate an average current which is controlling your displacement. – MathieuL May 23 '18 at 20:14
• I think what you want is called a voltage controlled current source.. That's an example. I don't know enough about it to tell if it is a good design or not. I'll be watching this question to see what answers you get. – JRE May 23 '18 at 20:15

You should instead use a PWM output from the Raspberry pie, not the DAC. Then connect the PWM to a mosfet or just NPN transistor.

And you will need a shunt resistor to have a feedback of the current and control it with a PID.

The problem with PWM is it will control the voltage output, but the solenoid of the Pump can change resistance with temperature and the displacement is according to the current, not the voltage on the solenoid. That's why you need current feedback if you want precision.

The code I used to control a variable pressure relief valve with arduino :

  I1 = analogRead(A3); // Read the current from the shunt resistor

E0 = I0-I1;  // Compare with I0 the current I want to send to the solenoid

Integral += Ki*E0;  // Adjust the Ki here

if(Integral>800){Integral = 800;}  // Anti-Windup

else if(Integral<-800){Integral = -800;}

Temp = K_0*I0 + Integral + Kp*E0; // Command sent to the PWM output, 0-1024

if(Temp>1024){Temp = 1024;}else if(Temp<0){Temp = 0;}

OCR1A = Temp;   // PWM duty cycle register

• +1 for emphasizing the need for current control of a solenoid instead of voltage control. – Dwayne Reid Oct 8 '19 at 19:54