Hello all,
First time poster here. Please be gentle. This would be my first foray into the world of microcontrollers. I read an article about the Arduino in this month's WIRED magazine. At first thought, it seemed like a really cool device, but I could not think of a practical use for myself to use one. Then it hit me, I'd like to have cruise control in my car.
I'm rebuilding a 93 Civic, and have installed all the parts needed for cruise control scavenged from junk cars. I have installed the steering wheel buttons, the clockspring behind the steering wheel to transfer the signal down to the cruise module. I have installed and tested the servo motor/clutch under the hood. I have used an oscilloscope to monitor all the signals going into the cruise module while driving and all seem to be correct, but the cruise will still not set. I have replaced the module, still no cruise. I have the sneaky feeling that the module is looking for certain RPM to match up with certain Vehicle speed, and this model Civic (CX) did not come from the factory with cruise control. The gearing in this model is higher than a regular Civic, so it gets better gas mileage. I think that might be confusing the module. I have considered building a cruise tester that has switch inputs for the set, coast and brake switches, and a couple of 555's as oscillators to simulate speed signal and tach signal. If I had such a tester, then I could plug in a module that I want to buy at the junkyard and test it before I buy it. Also if I had such a tester, I could maybe sell it, there are folks who part out old civics as a living, and a few that I've met have expressed interest in such a tester. But it would be cool to build a cruise control with an Arduino.
I have been reading various datasheets on the Arduino and have been unable to find the information what I am looking for.
In building a cruise control for the car, I would need for at least two of the input pins to be able to be used as counters. I am anticipating about a 50Hz signal on one input and about 200Hz on the second. The 50Hz signal is from a Vehicle Speed sensor, and the 200 Hz is from a tach signal. Don't worry, these will be optically isolated signals. I would read these frequencies and when the set input is asserted, store the values. I would then continue to read these frequencies on a continuous basis, doing some simple math to determine if my speed has dropped or risen more than a hysterisis value. I could then turn on an output to run the factory module that has a small motor that pulls the gas pedal. That part is already in the car and I'm clear on how that works.
As an ultimate wish, has anyone written a PID Loop for the Arduino? For a cruise control to work best, the larger the error from the setpoint, the larger the correction would need to be. (Proportional Gain). Also, for small errors, where the proportional is not enough to make a difference, Integral could be used to apply correction for error that exists for a certain period of time. Actually just a PI would be needed, as I really can't see a use for derivative, this application is not that intense. I am in the Industrial automation business and we very rarely use derivative, even for motor control.
I have read a few things about interrupts. I think this would work best with several interrupts, 2 for counting pulses, one each for the set and coast buttons, and one for the brake pedal. Can that many interrupts be used at once?
So it all boils down to.
Can the Arduino read up to 200Hz on a digital input?
Can it count pulses for a fixed interval, and when an input goes high, store that value to a variable?
Can it use several interrupts at once?
Can it then perform simple math to determine error between that setpoint and the next interval count of pulses?
Has anyone done PID, or just PI control in the Arduino?
Thanks for reading, thanks in advance for any info anyone is willing to share.
Happy developing to all, and to all a good night!
Jason