How to read frequency and adjust voltage output
sport270
Posts: 82
in BASIC Stamp
I have a bs2 reading 3 shaft rpms. Presently the hydraulic pumps are controlled by pwm controls with ramping. Problem is variance in output because of heat in hydraulics.
Wanting the bs2 that is already reading the rpms to output a variable .75 -1.25 vdc to keep the shaft speed consistant regardless of any load or temp changes.
Wanting the bs2 that is already reading the rpms to output a variable .75 -1.25 vdc to keep the shaft speed consistant regardless of any load or temp changes.
Comments
That said, I guess the short answer would be to use a DAC or filtered pwm.
Currently the bs2 is just reading 3 mag sensors and displaying the rpm on a lcd screen. With rpm on top line and alarm point displayed beneath each output. If rpm falls below setpoint a led lights up and buzzer goes off. I am trying to include the control part to overcome the change in speed due to temperature change. The present control circuit is actually a proportional brake control circuit that i wired to just output a pwm output relative to a 20 turn pot input and included a rc circuit inline to accomplish ramping up to speed. But the fluctuations from temp are enough to change the rpm as much as 100rpm. So was hoping to just let the bs2 take the place of the pot input for the pwm brake control circuit
I think you ought to be able to replace the pot with a DAC controlled by the BS-2. If the rpm is too high, you add more brake; if it is too low, you back off on the brake. Small steps and some hysteresis so it doesn't oscillate.
Be sure the accuracy and precision of the sensors is adequate. Likewise the DAC.
So all you need to do is put the Stamp in place of the operator to close the loop. You have the rpm feedback, you know what the desired rpm is so you can calculate an error value, and your hydraulic pump is controlled with a varying voltage. The problem is to calculate a correction that's proportional to the error and use that to correct the output voltage, e.g. turn the knob.
As the other guys suggested, you can use a digital to analog converter instead of the pot to generate that voltage. You've already got the hard parts.
Here's a place to start: http://learn.parallax.com/tutorials/language/pbasic/pid-control/proportional-control-pbasic
I'm not a Stamp user, but I suspect you can find examples of projects where people have used Stamps for similar things. Incidentally, that link also discusses PID controllers. It doesn't sound like you need integral or derivative terms (the I & D in PID) so just focus on proportional control.