Good morning all!
Thank you for replying,
Where exactly did you get the PID library?
This is the library I am using.
map() is a good choice. The PID doesn’t really care what you do with the output; it doesn’t need to know how many degrees the valve has turned.
Thats what I was thinking originally, but I havent yet figured out how to tell the PID loop that 90 is the middle.
Since your servo takes a value from 0 to 180 I would set those as the PID Output limits. Then the PID Output can go directly to the servo. For more precision control you could use servo.writeMicroseconds() which generally takes values from 1000 (0°) to 2000 (180°). In that case I would use 1000 and 2000 as my PID Output limits.
Since you are running a device where the higher Output causes a LOWER Input, set the PID for REVERSE instead of DIRECT.
I can try the (0 - 180) range and let you know.
Wouldnt that just invert the control method and then leave me with the same problem of the zero being in the middle but it going in reverse? Just curious if maybe I am not understanding this correctly.
Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Hi Tom, thanks for the welcome.
I didnt post my code, because I don’t have any code to post yet. I am in the “Playing around” phase where its mostly flowcharts and trying to figure an overall control scheme. Most of my code is just snippets of the arduino examples. I wanted to ask what the best practice for this kind of thing was, before I spent a weekend going down the wrong path.
Also, no circuit yet, just some sketches in block diagram that show the various components. No reason to waste time drawing circuits I may never use.
I will post both when I have both.
Thanks everyone for your warm welcome.