Cruise control design. Look over my shoulder to prevent failure...

Status
Not open for further replies.

tboydva

Member
Folks, I've designed what I believe to be a workable solution to the fact there is no aftermarket cruise control available for my '00 Ford F-350 diesel truck. I'm tired of long drives without it! I've taken some electronics courses, know how to program acceptably, and think I have a reasonable design. That's how whole electrical systems get destroyed! So I'm appealing to the pros to look over my design and make sure it isn't totally off-base. The pickup uses a throttle position sensor to determine "how much" someone depresses the throttle. A performance company makes a pigtail cable which allows one to monitor of "add" voltage at the TPS. I planned to monitor the TPS voltage and the speedometer frequency with a PIC. I was planning to convert the frequency to a voltage and read it using AN0 on the PIC. I have used an LM2917 before to convert freq to voltage (used in my old automatic truck to make a torque converter lockup switch that activated at a given frequency). My plan was to store the frequency (voltage), then when activated, add or decrease the voltage at the TPS using a DAC (microchip MCP4821). I would have interrupts from the brake or clutch (switches already there for the vehicle's computer). I was planning to put accelerate and deccelerate buttons in too just for fun.

The main issue is not knowing the current draw on the TPS. Plus, is it possible to put a 3 V signal "out" to from the DAC while the accelerator is still depressed (and putting out ~3V). Usually the pedal is lifted once the "set" button is pressed on a cruise control so there would be lag between the time the start button is pressed and the user (me!) would let up on the accelerator... I was thinking perhaps diodes would keep current from flowing "back" but then there would be a voltage drop I suppose? I was planning on getting the EasyPIC4 package from MikroElectronics - it has a DAC module with sample code.

Well, here's my flowchart and beginning schematic. If anyone has any advise, I would be very open to it and very appreciative. Thanks for all the help I've gotten from this forum!!! The LM2917 datasheet is here: **broken link removed** The microchip datasheet: **broken link removed**

Tom
 

Attachments

  • cruisecontrol.pdf
    26.2 KB · Views: 346
  • cruisecontrol_flow.pdf
    14.9 KB · Views: 259
There are recent threads here on the microcontroller forum on speedometers and tachometers that would be much more accurate than ADC.
An aftermarket cruise control operating the gas pedal would be much easier but not as much fun.
 
I would just be really worried if the brake/clutch interrupt would fail for some reason. Does the engine have a governor on it to keep in from overreving?
 
I'll bet that it is lawyers and the threat of product liability lawsuits that prevents such a product from existing.
 
Maybe im missing something here, You don't mention how you will control the throttle mechanically.
 
ClydeCrashKop: I did a search and do in fact see many threads on speedo/tachs... I wasn't thinking the ADC would suffer from inaccuracy, but having no real experience with it, perhaps I'm wrong. As I mentioned, I made a circuit for my older automatic truck using an LM2917 and a potentiometer. I could get the torque converter to lock up right at 45 mph pretty reliably. I assumed a 10-bit ADC would be accurate enough to keep the vehicle + or - a mph or so? I saw a means in one of my books for directly converting frequency to voltage with the ADC, but I guess this would suffer from the same issue you brought up. I guess this'll need some testing.

Andy1845c: I am worried about this too! This is why I really didn't want to alter the wires in the TPS at all (and got the pig cable). I believe the engine is governed, but I was planning to put an on/off switch for my entire circuit with a relay so if anything got squirrelly, I could shut power and totally isolate the circuit from the vehicle. Hopefully this would provide two overrides.

Papabravo: I would bet so. Ford had reliability issues with their cruise controls for my model/year. You cannot even buy replacement parts. No aftermarket cruises are available. Believe me, I tried for 3 weeks (calling every place I could find).

Brevor: You do it with your foot! As best I can tell from the wiring diagram(s), the TPS has a 5 V signal and the degree you push with your foot swings a potentiometer. The output voltage from the TPS ranges from ~0.7 V to ~3.8V (**broken link removed**. Mine appears to be perfectly in the range.

Again, my main concern is "adding" voltage to the circuit. It would make current flow "back" through the TPS. Since there is a potentiometer between where I would "add" the voltage, it seems like there should be no problem, but I want to somehow make sure. I can model the system using Electronics workbench (my student version!). When the source goes above the voltage supplied through my virtual TPS, a small current flows back through the TPS. Would this be bad??? It's an older truck, but it's my only transportation (and the bank still owns it!).

Thanks all for the rapid replies. I greatly appreciate it!
 
This is a fairly ambitious undertaking. It's my belief that product liability is only half the reason there are no aftermarket products - it's bloody complex to install and probably would be very costly due to labor.

Unless you talk about PID or similar, this isn't cruise control but rather a throttle set system.

I believe that most CC systems use some form of the PID algorithm to control the throttle based on the speedometer input. There are subtle interactions here. You want to quickly adjust the throttle when the load changes but you can easily overshoot and cause ringing (speed oscillating around the set point). The PID algorithm allows you to adjust parameters to control various aspects of this. Of course, you don't get direct throttle control but rather accelerator pedal control so it's a bit more complex. Google is your friend.
 
philba, I never thought of the sophistication needed for the control algorithm... I assumed if my PIC was running at 8 MHz, there would be ample temporal resolution to increment or decrement the throttle voltage. I've heard of PID algorithms, but have no hands on experience. Google is my friend, though. I looked it up and the first link was a Matlab tutorial on the algorithm. I am very adept at Matlab and produced a function to implement it. I also use the matlab compiler so I "compiled" it to an ANSI C function. I was planning on using mikroC so I'm hoping I can just drop it in.

I think this project will take a lot of getting in the vehicle on a deserted road and testing to get it working (if at all). As for the installation, I was going to "tap" the wire to the speedometer for the speed signal, tap the wire from the clutch and brake switches, and use the pigtail on the TPS. AFA installation, are you thinking there's much more?

Thanks for taking the time to respond. Obviously, I've thought the project through, but my narrow perspective is in need of broadening! Experience and mistakes are the best educators... I'll have to do a lot of testing on the breadboard before putting this in my vehicle. In my old truck, I drove around with my pencilbox circuit all hooked in!
 
it sounds like you heading in the right direction.

A suggestion - set up your PID code so you can dynamically update the coefficients. this will make drive testing sooooo much easier. Drive your test route - tweak the coeffs, repeat. I'd use a laptop so you can be systematic about it. I would also do data logging so you can plug your actual inputs into matlab for offline testing.

on performance, a lot depends on how frequently you need to update the "plant" (i.e. throttle). If you code uses floating point then you may have an issue with performance. If you use fixed point, error accumulation could be an issue. I'd start by running the 88 at 20 mhz but you may want to look at other chips that have better performance like atmel or TI mps430. The 430 is nice because it's 16 bit so should give a lot better performance.
 
Last edited:
You have no reason to be reading the tach with a freq-to-voltage conv+ADC conv! Either use an external interrupt and a timer, or the MCCP module.

Similarly you wouldn't use a DAC for the output. Just a motor driver. It's either a stepper motor or maybe just a normal motor that moves a linear actuator.

You do not specifically need a TPS sensor here. If the car is going too slow, you speed up regardless of throttle position. It might be necessary to avoid driving the actuator's motor once it's reached a high or low limit, but that should already be built into the actuator.

You must have a PID algorithm really. This is essential. Otherwise, if you're low, what do you do? Keep running the "throttle up" motor until you reach 70 mph? Well, you'll probably reach 65, the truck acceleration is going to take more than a few moments to get to 70 mph and in the meantime this thing will drive the accelerator to the floor.

The tranny position need to be detected. What if you accidentally shift into neutral with cruise engaged? It keeps the accelerator at the highway speed setting but it's slowing down, speed doesn't increase so we give it more and more gas and the engine might overrev real, real fast!

The task does not require a 16-bit processor. It probably won't make a difference. I would recommend a PIC18F though. Especially one with advanced management features- WDT, Brownout detection. Read the errata sheet. There's important "gotchas" at times.

I think this is too dangerous a project really. I mean even if we blow a fuse, will the actuator automatically drop back to idle or remain stuck?
 
Last edited:
Motorola used to make a cruise control IC. It used a pulse train from the driveshaft to determine speed. The output was tailored to control solenoid valves to pull/release a cable to the throttle positioner. I don't recall the IC number, but the suggested circuit on the spec sheet was pretty good. The chip had inputs for the brake switch and button disables, etc.
 
Please excuse me if I am wrong but are you thinking that you can control the engine RPM by applying a voltage to the TPS ? If thats the case it does not work that way. The TPS tells the engine control computer how far the throttle is open. This is to control the amount of fuel injected into the cylinders. To control the engine RPM you must still control the throttle mechanically.
 
Yes, and there's a good reason for this. Consider when you take over the accelerator from the cruise control. You want the accelerator to be in the correct position so you can smoothly transition to manual control. If you had to press the pedal to find that point, you would either cause the car to slow down or speed up. There are a lot of subtle interactions going on.

By the way, my volvo has the best cruise control I've found. It is rock solid on what ever I set - never varying more than maybe 1/4 MPH even on long uphill stretches. I've used chevys and chryslers and they would lose up to 5 MPH on hills that my volvo has no trouble with. My Honda is good but not nearly as crisp. Also, accel and decel functions are quite smooth on the volvo. My old chrysler would buck like a bronco and the honda get's little surges that are somewhat annoying. My only complaint with the volvo is that you have to actually engage the brake to kick CC out - fortunately, there is a disengage button on the steering wheel.
 
Rather than add to their voltage which is going to change as soon as you set your speed and let off of the gas pedal, I suggest you read their voltage as a starting point, use your voltage instead of theirs switched by a SPDT latching relay that is powered thru the ignition, brake and clutch switches. If any of those open, it will revert back to the gas pedal output which is at idle.
The old governor vacuum type were extremely analog and worked great.
If the difference between the starting point and the acceleration or deceleration voltage is proportional to the difference between the set speed and actual speed, you will do just fine. You don’t need full throttle to accelerate 2 MPH. Your truck is not going to react instantly so overshoot shouldn’t be a problem.
Sure, your program will require fine tuning but that is just part of the process.
Go for it!

On second thought, your truck’s computer won’t like even a momentary open circuit, so match their voltage and switch yours on before you switch theirs off.
 
Last edited:
I think perhaps I've made some confusion in my description. I could be wrong, but as far as I can tell, my vehicle has no "mechanical" throttle. Brevor, I wasn't trying to be a smart-a** when I said you use your foot - what I meant is that I believe the only throttle signal comes from the TPS. The accel pedal actuates a lever that swings angularly (and appears to be a potentiometer). From what I can gather in the service manual and the appropriate forums, the TPS sends a voltage signal to the PCM which then adjusts the engine RPM. I could be wrong, but I've looked at it carefully and there are no cables running to the engine compartment (my dodge diesel had a mechanical cable - I know, I had to replace it!). It appears that the driver's foot pedal communicates to the "engine" through just two wires. This is the reason I figured I could control the voltage signal going to the PCM using a PIC and have the PCM "think" it was a driver depressing the accelerator. You are certainly right for very other vehicle I've owned. What I need to do to confirm my whole approach first is to take a potentiometer and ramp up the voltage at the TPS and make sure the RPM increases as the voltage increases. It that doesn't happen, I think I'll have to wait 5 years for my next vehicle to have my cruise control!

Oznog, is there any compelling reason you don't recommend a freq-voltage converter? My previous experience was very positive with this device. I have seen the counter used in an example in a book I have. I'd have to reference, but I seem to recall that it wasn't terribly accurate??? As for your second comment, see above. I don't think there is any "mechanical" control to be done! Uuugghhhh! I never thought about what happens if the truck slips out of gear without the clutch or brake being depressed! Thanks for bringing that to light! I guess I'd need to tap the rpm signal too and have the system "stop" if it gets over a certain level. Andy1845c brought up the point about the engine being governed which I assume it is, but an RPM governor would be a good failsafe. Best to have several levels if possible!!!

j.p. bill - if you have more info on this IC, I'd like to investigate. I couldn't find any information in a short web search. I will look for other ways to reference, but nothing popped out immediately.

Philba, I haven't researched this extensively, but as I'm reading the responses, I think perhaps the TPS design on my year of truck was a colossal failure in terms of CC. There are no aftermarket ones available and the dealer won't even sell replacement ones. The '99 and '00 models are the only ones with the two-wire TPS. The '01 and on have a 6 or 8 wire harness (this info comes from the performance chip place where I got my pig cable). I wonder if the CC "felt" wrong because the pedal wasn't mechanically actuated and drivers complained. Ford issued a recall for the CC in '99 and my year truck ('00). One of my many personality flaws is that I love projects like this. I don't mind burning up some IC's on the breadboard, but I can't afford to destroy my commuter vehicle's electrical system!!! I'm gonna test the voltage to RPM theory and make sure my beginning design is at least feasible! Thanks again everyone for the comments!!!
 
you all are missing the point.

this is a diesel application - engine power is NOT controlled by air. It is controlled by the amount of fuel injected.

you will not find a throttle plate on this vehicle.
 
I looked myself with no result. Motorola may be out of all electronics but cell phones by now.

By the way, I've got a Honda Fit the does fly by wire for the throttle. It's twitch as hell without the elastic wire and bellcrank mechanism. That probably means no shaft end to grab at the throttle plate for a mechanical cruise control. I got the cheapo model with cruise, so I have no idea how it's done (it is available for the Fit - I just did not want fancy wheels and silly trim package that come with it).
 
you all are missing the point.

this is a diesel application - engine power is NOT controlled by air. It is controlled by the amount of fuel injected.

you will not find a throttle plate on this vehicle.

Sorry, I stand corrected I missed the diesel part in the original post.
 
Sorry all for dropping the discussion. Major deadline at work! So ClydeKrash - my original doodlepad sketch had two SPDT switches to isolate "my" circuit from the truck... I think that still might be the best strategy. I was just thinking for simplicity, I could avoid cutting any wires and just "add" voltage. I haven't had a chance to play with the actual voltages while the vehicle is running. I think I need to do this first. I got the pig cable so I think I need to tap each wire, figure out how the voltages read under different throttle levels, and make sure I can bump up the RPMs by adjusting voltages accordingly. Although I felt like I thought this through, it's obvious that I have to work out a few specifics before progressing (if at all).

I'm on travel next week, so that'll give me some time to muse. I work in a technical field, so I naturally found the PID algorithm information on the web very interesting. I've done quite a bit of programming during my career, but always with PCs and high level languages. I think PIC controllers are really cool, so I'll probably continue investigating this even if it's not a lot of bang for the buck!

Thanks again to all for replying.
 
One thing to consider is that if the throttle pot (TPS) is at one end of it's range of travel, then injecting voltage into the wiper terminal part of the circuit could burn up the throttle pot. Definitely limit the current into the TPS circuit to avoid doing damage to your vehicle! Can you find and post a wiring diagram of this part of your truck?
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…