You should really run this device side. Generally, the feedback loop needs to be as quick as possible (depends on the bandwidth of the system in question). You might adjust the coefficients remotely but the actual control loop would run locally.
PID control is really quite simple, there’s some pseudocode on http://en.wikipedia.org/wiki/PID_controller - the tricky bit is working out the right coefficients for your system.
I also want to do PID on the Imp but I’d guess I am many months out from accomplishing it. I need to learn PID and squirrel and finish building my system.
The examples I have seen use imp.wakeup to call a function after some period of time - often a function calling itself. I think one would set the PID controller to loop in this way; setting the rate at the appropriate speed. The article I linked discusses how often to calculate based on your desired settling time.
If you know your desired settling time, desired calculation rate and your ins and outs then perhaps this forum could advise you about the capability of the Imp hardware. In my case I am controlling temperature and it changes so slowly I have no concerns about the Imp keeping up.
Just general note in many years of commissioning PID loops I’ve never used the D: Derivative term. What are you trying to regulate? You can get reasonable control with just the P term which would be simple to implement and then add the I term. I often send people hear http://www.csimn.com/CSI_pages/PIDforDummies.html
Paul I would like to help out on this.
Perhaps testing I’ve got a whole load of motorised valves I want to fit to control my radiators (heating). I was going to use straight proportional control but having PI would be brilliant.
Sounds good! I would be happy to share. I was planning on just trying to port the Arduino library mentioned at the top to Squirrel. I’m down for a few days, My Imp died yesterday so I’m waiting on an RMA.