Hi there!
here is what I have:
Internal combustion engine
what I need:
keep rpm's constant
what I have done:
wrote code that reads rpms by duration between HIGH pulses, works great
duration is Setpoint for PID
PID controller puts out pwm signal trying to keep Input same as Setpoint
where I am stuck:
throttle control...
I have a hobby servo, but thats a little too weak, so I came up with an idea to use windshield wiper motor like this one:
as throttle control motor where the motor output arm is connected to throttle body varying throttle opening.
I know I have to use H-bridge to control the motor, but I dont understand the software part...
I understand I need two outputs from arduino, each for one motor direction...
How to make PID output so it controls the motor ir both directions varying motor speed.
this is the part where I am really stuck:
when pid 1 is rising, pin 2 should stay 0
instead of pin 1 dropping its value, it should immediately stay 0 and pin 2 should rise instead, in that way both pins wont be ''HOT'' in the same time...
do i need to monitor pid's value and make an ''if'' statement, where prewious value is monitored, and if it is lower turn it to 0?
or is there an easier way? like, when PID is rising pin1 is rising and when PID is dropping pin2 is rising?
thanks