Using Arduino to control a very precise DC motor

I am using the Arduino with the PID Library to control 2 very precise water pumps. The way it works is by aiming a laser horizontally across a small trough (aprox 300 uL) and picking up the amount of light hitting a photodiode on the other side and depending on how much light is hitting the photodiode telling the pumps to speed up/slow down.

My problem is that the pump I am using has a speed controller built in that uses an analog input to control the speed. I spoke with a technician that makes the pumps and he said that using PWM to control the input voltage to the pump would probably not be very accurate because there would be frequency issues between the arduino and pump controller. There are the pumps I will be using: http://www.instechlabs.com/OEM/pumps/

I was wondering if there is any attachment/shield that I can use to very accurately simulate an actual analog signal instead of using PWM. I found this shield http://blushingboy.net/p/motorShieldV3/page/Example-DC-motor/ that might work, but I don't know if I'll be able to use it with the PID which is crucial.

I was also thinking I could order just the pump/motor without the speed controller attached and use the arduino to control the motor all by itself using PWM... but I'm not sure if the arduino all by itself would be precise enough for my application.

My last idea was to possibly use a frequency to voltage converter, but I've already got a very complex, messy circuit to amplify the quadrant photodiode and I would hate to have to add even more stuff to the circuit and risk messing it up because it's taken me a while to get to where I am now and DO NOT want to go back to troubleshooting what's wrong with that circuit lol. But if that would be the most precise solution I'd be willing to do so.

Anyone with experience with these things I would love to hear which method you think would be the best route to take.

Thanks!

Just use a filter on the PWM output:- http://www.thebox.myzen.co.uk/Tutorial/PWM.html

Then use the huf and puf control method. That is decrement the number to the PWM if it is too full and increment it if it is not full enough. Add a delay in the loop and do it again.

Thanks for the reply. I have the PID library working in unison with the plotter and PID interface where I can change the P, I, and D values through the serial port which I feel will be necessary to get the results I'm looking for so if I can help it I'd like to avoid going another route. If I filter the PWM output will that mean I'm unable to use the GUI built for the PID library?

I would think not, why would it?

Well I was just concerned because I'm using the PID serial plotter through Processing that I found here and if I modify the signal coming from the PWM output then the values that the plotter is showing would be different from my actual values and make it more difficult to tune as precisely as I need to. But I built the filter anyways and it seems to work pretty well, I'm currently getting an analog output of between 0 and 5 volts with only slight ripple, so I think I'm fine.

Now that I have that problem solved I have encountered another! The motor that I am using right now has an analog input from -10 to +10 volts to control speed either forward or backwards. Would there be any way to now shift this voltage from 0 - 5 volts to maybe -2.5 to +2.5 volts or ideally get it to -10 to + 10?

Thanks, Lance

The motor that I am using right now has an analog input from -10 to +10 volts to control speed either forward or backwards. Would there be any way to now shift this voltage from 0 - 5 volts to maybe -2.5 to +2.5 volts or ideally get it to -10 to + 10?

Sure, with an external op-amp using + & - 12vdc power rails and an set for a gain of 4 and a input offset of +2.5v should convert your input signal of 0-5vdc to -10 to +10.