# Electrical – Controlling a Piston Variable Pump with a Raspberry Pi

amplifieranalogcurrentraspberry pivariable

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.

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
``````