emulating a POT
emulating a POT
I am toying with making a cruise control for my new vehicle which has a fly by wire throttle. I aim to get a spare pedal assmenbley to examine, but is suspect at its heart if a potentiometer attached to the pedal. this may then interface to the can bus but if i can T in at the pot level so much the easier.
i have used digital pots in the past and it all seemed pretty straightforward, and this seems like th eobvious route, but any insightor experience out there to share would be appreciated.
mechanical solutions will in this day and age be frowned upon
i have used digital pots in the past and it all seemed pretty straightforward, and this seems like th eobvious route, but any insightor experience out there to share would be appreciated.
mechanical solutions will in this day and age be frowned upon
There's no need to interface with the throttle control. Cruise Controls don't function in that manner. For example, if you keep your foot on the accelerator pedal in exactly the same spot, the vehicle speed will change with the varying road conditions. The important part is to know the vehicle's speed, not the throttle position.
Some systems use engine RPM to determine vehicle speed, which should be easy enough to access without hacking the CAN bus. Other systems use the vehicle's speed sensor, either on the wheel, in the transmission, or sometimes on the driveshaft. You could also add your own speed sensor. Calibration is not needed, as you don't need to know what the speed is, only wether you are travelling faster or slower than what the cruise control is set for. Personally, I would go for the RPM sensing version, as it probably won't involve any rotating or moving parts (unless your vehicle is diesel). An inductive ignition wire pickup is perhaps the least invasive method.
Assuming a gasoline engine, I think the more difficult part will be controlling the engine itself. Without adding an additional throttle servo (the component that actually opens the throttle plate), you would have to splice into the existing servo, and separate it electrically from the rest of the car whenever the cruise control is engaged, then reconnect it when operating manually. A simple relay arrangement would work here. Another method might be to purchase a similar servo, and adapt it to the existing one, in a parallel manner so that both can be connected at the same time. This would allow for the cruise control to maintain the vehicle's speed, while at the same time, allow you to press on the accelerator pedal to temporarily increase speed for passing. This is how most factory cruise control arrangements function, albiet using only a single servo.
A word of caution is appropriate here. Make sure you include a fully manual, hard disconnect method during testing, and include as many of the typical safety interlocks as possible. These interlocks would turn off the cruise control whenever it sensed a braking condition (brake lights ON) or a transmission gear change (clutch pedal switch or automatic transmission gear selection switch). By 'hard' I mean removing the power to the throttle servo with a mechanical switch so that there is no possible way for it to get stuck in the ON position if there is a software fault.
-Don
Some systems use engine RPM to determine vehicle speed, which should be easy enough to access without hacking the CAN bus. Other systems use the vehicle's speed sensor, either on the wheel, in the transmission, or sometimes on the driveshaft. You could also add your own speed sensor. Calibration is not needed, as you don't need to know what the speed is, only wether you are travelling faster or slower than what the cruise control is set for. Personally, I would go for the RPM sensing version, as it probably won't involve any rotating or moving parts (unless your vehicle is diesel). An inductive ignition wire pickup is perhaps the least invasive method.
Assuming a gasoline engine, I think the more difficult part will be controlling the engine itself. Without adding an additional throttle servo (the component that actually opens the throttle plate), you would have to splice into the existing servo, and separate it electrically from the rest of the car whenever the cruise control is engaged, then reconnect it when operating manually. A simple relay arrangement would work here. Another method might be to purchase a similar servo, and adapt it to the existing one, in a parallel manner so that both can be connected at the same time. This would allow for the cruise control to maintain the vehicle's speed, while at the same time, allow you to press on the accelerator pedal to temporarily increase speed for passing. This is how most factory cruise control arrangements function, albiet using only a single servo.
A word of caution is appropriate here. Make sure you include a fully manual, hard disconnect method during testing, and include as many of the typical safety interlocks as possible. These interlocks would turn off the cruise control whenever it sensed a braking condition (brake lights ON) or a transmission gear change (clutch pedal switch or automatic transmission gear selection switch). By 'hard' I mean removing the power to the throttle servo with a mechanical switch so that there is no possible way for it to get stuck in the ON position if there is a software fault.
-Don
thanks for the thoughts.
vehicle is diesel so rpm pickup not as straight forward as it might be but i'm sure doable.
i was going to interface with the pedal pot to control the speed i.e. when in cruise mode, cut out the pedal in favour of my zbasic controlled pot. no servos or anything. including as you suggest a toggle hard switch for final cut in/out so it can be over-ridden if required. i see the electrical approach as safer than mechanical in this regard. it also seems like the ecu is tolerant of varying pot readings and doesn;t throw a fault code. the throttle pots wear and create issues but rarely cause a MIL light.
an interesting point you raise on not needing to know what the actual speed is. Using gps i could know the speed and use this as a reference, or i could use the rpm also and maintain it. as i have gps modules and routines this is easy for me, and is slightly nicer in that i can have up/down buttons to set an actual accurate speed. only problem is going in a tunnel, but i think i would sound a buzzer and disengage if lock is lost. however, on motorways this is rarely the case.
one issue i foresee is that at the point of cutover, managing to do this without a drop in speed etc. i could take a reading from the pedal pot, then cut mine in and match the value, then use gps or rpm to maintain the speed
for sure switches on brake on clutch to disengage.
still in planning phase - i need to get a pedal and examine the way it works
vehicle is diesel so rpm pickup not as straight forward as it might be but i'm sure doable.
i was going to interface with the pedal pot to control the speed i.e. when in cruise mode, cut out the pedal in favour of my zbasic controlled pot. no servos or anything. including as you suggest a toggle hard switch for final cut in/out so it can be over-ridden if required. i see the electrical approach as safer than mechanical in this regard. it also seems like the ecu is tolerant of varying pot readings and doesn;t throw a fault code. the throttle pots wear and create issues but rarely cause a MIL light.
an interesting point you raise on not needing to know what the actual speed is. Using gps i could know the speed and use this as a reference, or i could use the rpm also and maintain it. as i have gps modules and routines this is easy for me, and is slightly nicer in that i can have up/down buttons to set an actual accurate speed. only problem is going in a tunnel, but i think i would sound a buzzer and disengage if lock is lost. however, on motorways this is rarely the case.
one issue i foresee is that at the point of cutover, managing to do this without a drop in speed etc. i could take a reading from the pedal pot, then cut mine in and match the value, then use gps or rpm to maintain the speed
for sure switches on brake on clutch to disengage.
still in planning phase - i need to get a pedal and examine the way it works
That makes much more sense. I mistakenly thought you were trying to read the throttle position, when in fact, you're trying to emulate it. That would be a nice solution to interfacing with the engine.
I've done many GPS projects myself, and can only say that you might have a problem with 'hunting' using a 1hz GPS device. There may be too much lag between throttle inputs and the corresponding change in GPS speed. The exact effects are difficult to predict however. I would suggest you try the GPS approach first. It might work fine, and combined with the throttle pedal interface, you would have an elegantly simple add-on cruise control.
Regarding the throttle pedal; I don't think you need another one for testing. I would bet that the one in the vehicle is plugged into the wiring harness somewhere nearby. I would unplug it and do some probing with a multimeter. Most likely, it's a linear pot that should be very easy to emulate digitally. It might not be a bad idea to source the connectors though (both the male and female) so that you can insert your interface circuit without cutting any wires.
I would agree that you could read the current throttle value, then match it when the cruise control takes over. The transition would be seamless. If you continuously read the throttle pedal, you could also retain he ability to manually speed up by watching for a throttle pedal value that's greater than the system's current outputted value, allowing you to temporarily accelerate without disengaging.
Taking that a little further, always keeping the system inline would allow you to manually remap the throttle pedal curve, making it either more or less sensitive, or adding a speed limiter, or any number of other goodies without any more hardware. Simply read the pedal value, adjust it to your liking, then send the adjusted value to the wiring harness. Many possibilities there.
-Don
I've done many GPS projects myself, and can only say that you might have a problem with 'hunting' using a 1hz GPS device. There may be too much lag between throttle inputs and the corresponding change in GPS speed. The exact effects are difficult to predict however. I would suggest you try the GPS approach first. It might work fine, and combined with the throttle pedal interface, you would have an elegantly simple add-on cruise control.
Regarding the throttle pedal; I don't think you need another one for testing. I would bet that the one in the vehicle is plugged into the wiring harness somewhere nearby. I would unplug it and do some probing with a multimeter. Most likely, it's a linear pot that should be very easy to emulate digitally. It might not be a bad idea to source the connectors though (both the male and female) so that you can insert your interface circuit without cutting any wires.
I would agree that you could read the current throttle value, then match it when the cruise control takes over. The transition would be seamless. If you continuously read the throttle pedal, you could also retain he ability to manually speed up by watching for a throttle pedal value that's greater than the system's current outputted value, allowing you to temporarily accelerate without disengaging.
Taking that a little further, always keeping the system inline would allow you to manually remap the throttle pedal curve, making it either more or less sensitive, or adding a speed limiter, or any number of other goodies without any more hardware. Simply read the pedal value, adjust it to your liking, then send the adjusted value to the wiring harness. Many possibilities there.
-Don
don
thanks - somemore good thoughts there.
I have a 5hz gps module from a project i upgraded to 10hz so i think i'll be ok on that one. Placed in a good position in the vehicle i doubt it would lose lock. i use these modules in a race car and on a motorbike most days and they are pretty solid.
I like the idea of keeping online as this does indeed allow me to accelerate using the pedal then drop back to cruise controlled speed. this is how most car systems operate.
Regards the pedal, i suspect the connection into the main loom is CAN bus, the connector to the pedal has a multiway plug on it of at least 8 or so connectors - not that they are necessarily all in use, but it would have been nice to have seen just 2 or 3 for sure. i'll pull one apart and see what is going on. hopefully it is simple, they are not that expensive.
in order to use keep the pedal online as well as the cruise i'll need to establish whether the resistance increases or decreases for more speed. if it increases i can put my pot in series, if it decreases i'll need to put in it parallel i guess - just thinking out loud now.
i'll research the pedal options and see where it all goes.
thanks - somemore good thoughts there.
I have a 5hz gps module from a project i upgraded to 10hz so i think i'll be ok on that one. Placed in a good position in the vehicle i doubt it would lose lock. i use these modules in a race car and on a motorbike most days and they are pretty solid.
I like the idea of keeping online as this does indeed allow me to accelerate using the pedal then drop back to cruise controlled speed. this is how most car systems operate.
Regards the pedal, i suspect the connection into the main loom is CAN bus, the connector to the pedal has a multiway plug on it of at least 8 or so connectors - not that they are necessarily all in use, but it would have been nice to have seen just 2 or 3 for sure. i'll pull one apart and see what is going on. hopefully it is simple, they are not that expensive.
in order to use keep the pedal online as well as the cruise i'll need to establish whether the resistance increases or decreases for more speed. if it increases i can put my pot in series, if it decreases i'll need to put in it parallel i guess - just thinking out loud now.
i'll research the pedal options and see where it all goes.
The throttle pedal on newer cars has two pots , normal and inverted for safety purposes .
So You could read the value with ADC and output the modified value from 2 DAC's ...
I doubt that the throttle pedal has CAN , most likely its connected straight to the engine ecu .
I added a hall sensor to my diesel before i knew how to read the engine CAN , so now i have both , i can practice the use of input capture and compare it with the rpm value read from CAN .
I have a MB and the cruise switches are wired straight to engine ecu .
What make and model do You have ? ( You could probably read the brake and clutch status from CAN ...)
The GPS speed is important so You know Your true speed (every car should have one) , but it should have nothing to do with cruise , use ABS speed read from the CAN so You get an average speed of all 4 tires .
I have found these very easy to interface to CAN ,
www.lawicel.se -> can232.com & candip.com
So You could read the value with ADC and output the modified value from 2 DAC's ...
I doubt that the throttle pedal has CAN , most likely its connected straight to the engine ecu .
I added a hall sensor to my diesel before i knew how to read the engine CAN , so now i have both , i can practice the use of input capture and compare it with the rpm value read from CAN .
I have a MB and the cruise switches are wired straight to engine ecu .
What make and model do You have ? ( You could probably read the brake and clutch status from CAN ...)
The GPS speed is important so You know Your true speed (every car should have one) , but it should have nothing to do with cruise , use ABS speed read from the CAN so You get an average speed of all 4 tires .
I have found these very easy to interface to CAN ,
www.lawicel.se -> can232.com & candip.com
The vehicle in question is a 2006 Ford transit van 2.4 turbo diesel. i tow a race car with it and there is a speed limit for towing that is a pain to stick to on long distance runs.
its the later of the MK6 vans, so not as sophisticated as the MK7 but for sure has can.
I like the look of the can converters for reading values. couple of questions.
When you say MB do you mean motherboard ?
The hall you added was for rpm was it before you read can ?
Interesting point on the pots - i shall investigate.
thanks - i feel a plan coming together
its the later of the MK6 vans, so not as sophisticated as the MK7 but for sure has can.
I like the look of the can converters for reading values. couple of questions.
When you say MB do you mean motherboard ?
The hall you added was for rpm was it before you read can ?
Interesting point on the pots - i shall investigate.
thanks - i feel a plan coming together
Sorry i meant Mercedes Benz , but i have on older model with limited CAN , so probably newer cars have everything on CAN .
I added a hall before i could read CAN , my crankshaft damper/pulley had a notch on it and a ready bracket for the hall .
The CAN232 is very easy to use and connects straight to ZX24 Com1 or PC RS232 levels .
The DIP version uses TTL , i like the DIP version more but for some reason the DIP has older firmware than the CAN232 ... But You should get both , DIP for the cruise and CAN232 for PC debugging .
All the electronic throttle pedals i have seen have a 6 wire connection 2x Gnd , 2x +5V , Linear throttle output 1 and inverted throttle output 2 .
Both pot's are wired with their own Gnd and +5V so the system can withstand one wire braking , of course this activates the limp home mode but You can still drive the car home ...
( the pedal might also have a switch for kickdown when connected to a automatic transmission )
You Could build a system like ,
ADC 12bit like MCP3201 to read the throttle
2channel DAC , MCP4922 Feeding the ECU both normal and inverted copy's of the throttle position only a 2 wire connection is needed with the DAC's compared to the 6wire if You use electronic pot's ...
CANDIP & a native mode ZX ... and of course a color display to show You all the engine values ...
I added a hall before i could read CAN , my crankshaft damper/pulley had a notch on it and a ready bracket for the hall .
The CAN232 is very easy to use and connects straight to ZX24 Com1 or PC RS232 levels .
The DIP version uses TTL , i like the DIP version more but for some reason the DIP has older firmware than the CAN232 ... But You should get both , DIP for the cruise and CAN232 for PC debugging .
All the electronic throttle pedals i have seen have a 6 wire connection 2x Gnd , 2x +5V , Linear throttle output 1 and inverted throttle output 2 .
Both pot's are wired with their own Gnd and +5V so the system can withstand one wire braking , of course this activates the limp home mode but You can still drive the car home ...
( the pedal might also have a switch for kickdown when connected to a automatic transmission )
You Could build a system like ,
ADC 12bit like MCP3201 to read the throttle
2channel DAC , MCP4922 Feeding the ECU both normal and inverted copy's of the throttle position only a 2 wire connection is needed with the DAC's compared to the 6wire if You use electronic pot's ...
CANDIP & a native mode ZX ... and of course a color display to show You all the engine values ...
OK - so i got a spare pedal and pulled it apart.
It has 3 pots each with fixed value resistors on each end, and then a variable section in the middle so to speak. its all contructed on a PCB fixed against some wipers.
the pedal is connected via a 9 pin connector, 3 connections for each pot which i assume (but to be proven) are 0v, 5v (maybe 12v) and the wiper.
i intend to make a break out connector so i can read values and map out what is going on, and also potentially see how upset the ecu gets if 1 or 2 signals are not available or if they should get out of sync.
digital pots seem to be out of the question due to restricted values available and steps. for example the variable part of each resistor is in the range of 2k, whereas most digipots seems to start at 10k with max 256 steps. so a dac as suggested would be a better bet but i am open to informed suggestions.
alternative is a stepper motor attached to the pedal, but this would most likely require some gearing as the actual angle of movement from fully open to fully closed is pretty small, like 30 degrees, so not much resolution again. plus the rebound spring is pretty fierce. i also have an inherant dislike of anything mechanical attached to the pedal.
will keep investigating, any thoughts appreciated.
It has 3 pots each with fixed value resistors on each end, and then a variable section in the middle so to speak. its all contructed on a PCB fixed against some wipers.
the pedal is connected via a 9 pin connector, 3 connections for each pot which i assume (but to be proven) are 0v, 5v (maybe 12v) and the wiper.
i intend to make a break out connector so i can read values and map out what is going on, and also potentially see how upset the ecu gets if 1 or 2 signals are not available or if they should get out of sync.
digital pots seem to be out of the question due to restricted values available and steps. for example the variable part of each resistor is in the range of 2k, whereas most digipots seems to start at 10k with max 256 steps. so a dac as suggested would be a better bet but i am open to informed suggestions.
alternative is a stepper motor attached to the pedal, but this would most likely require some gearing as the actual angle of movement from fully open to fully closed is pretty small, like 30 degrees, so not much resolution again. plus the rebound spring is pretty fierce. i also have an inherant dislike of anything mechanical attached to the pedal.
will keep investigating, any thoughts appreciated.
Man, times have changed.
I recall building a cruise control with an 8085 micro. The micro read the vehicle speed from 3 magnets mounted on the front axle, and a coil to pick up the pulses. There was a throttle linkage in parallel to the one from the gas peddle. The micro controlled a solenoid valve which changed the suction pulling on a diaphragm inside a cylinder which pulled on the additional throttle linkage. The vacuum came from the engine itself. The User, (me), could hit the cruise button, or enter the desired speed on a keypad. Brings back memories...
That said, I double the comments made above about lots of safety systems and redundancy.
Finally, I've not worked with any recent ECU's, but I suspect they would not like the glitch in data from even switching back and forth from the real pedal and your controller's output. You could certainly try the relay switch and see what happens. Use a DPDT relay and put the original signals on BOTH sets of contacts, so when you switch the relay you are just briefly interrupting the signals, then resuming the normal signals. This way you do not need your micro or any bug free software to be up and running when you test to see how the ECU handles a data interruption. Test it at many speeds, on a test track, no traffic around, etc.
If that test shows that the ECU doesn't like losing its signal, even briefly, then another option would be to feed the gas pedal signals into the micro, micro reads them, and generates the signals going to the ECU. Cruise Off = micro just reads the pedal and generates a matching output. Cruise On = the micro reads you speed signal, the starting pedal values, and modulates the output as needed to maintain your speed, (within limits, of course; i.e. LOTs of range testing a default values...).
Personally, I would try to read the vehicle's speed either from the vehicle's data bus, if the format is known, or from a speed sensor on the axle, (i.e. the old fashioned way). I would not relie on GPS for speed data.
Road Rally sport people have lots of speedometer cable insert gizzmo's that output a pulse per cable revolution if you vehicle is old enough to have a physical speedometer cable.
Just a thought or two...
JC
I recall building a cruise control with an 8085 micro. The micro read the vehicle speed from 3 magnets mounted on the front axle, and a coil to pick up the pulses. There was a throttle linkage in parallel to the one from the gas peddle. The micro controlled a solenoid valve which changed the suction pulling on a diaphragm inside a cylinder which pulled on the additional throttle linkage. The vacuum came from the engine itself. The User, (me), could hit the cruise button, or enter the desired speed on a keypad. Brings back memories...
That said, I double the comments made above about lots of safety systems and redundancy.
Finally, I've not worked with any recent ECU's, but I suspect they would not like the glitch in data from even switching back and forth from the real pedal and your controller's output. You could certainly try the relay switch and see what happens. Use a DPDT relay and put the original signals on BOTH sets of contacts, so when you switch the relay you are just briefly interrupting the signals, then resuming the normal signals. This way you do not need your micro or any bug free software to be up and running when you test to see how the ECU handles a data interruption. Test it at many speeds, on a test track, no traffic around, etc.
If that test shows that the ECU doesn't like losing its signal, even briefly, then another option would be to feed the gas pedal signals into the micro, micro reads them, and generates the signals going to the ECU. Cruise Off = micro just reads the pedal and generates a matching output. Cruise On = the micro reads you speed signal, the starting pedal values, and modulates the output as needed to maintain your speed, (within limits, of course; i.e. LOTs of range testing a default values...).
Personally, I would try to read the vehicle's speed either from the vehicle's data bus, if the format is known, or from a speed sensor on the axle, (i.e. the old fashioned way). I would not relie on GPS for speed data.
Road Rally sport people have lots of speedometer cable insert gizzmo's that output a pulse per cable revolution if you vehicle is old enough to have a physical speedometer cable.
Just a thought or two...
JC
ok a bit more digging seems to reveal of the 9 pins 3 are gnd and 3 are 5v
the values of the others are
Pedal pressed 1.04 & 3.83 & 3.27
released 4.11 & 1.49 & 0.93
this is from a ford manual of a closely related model so stands verification.
i wonder how the ecu uses these values. it might use just one, if that fails switch to another, or it might constantly check all three are in expected ranges.
will need to set the test pedal up and verify these values before any more work is done. i also need to measure the current flow, as the DAC suggested above has max 2ma.
the values of the others are
Pedal pressed 1.04 & 3.83 & 3.27
released 4.11 & 1.49 & 0.93
this is from a ford manual of a closely related model so stands verification.
i wonder how the ecu uses these values. it might use just one, if that fails switch to another, or it might constantly check all three are in expected ranges.
will need to set the test pedal up and verify these values before any more work is done. i also need to measure the current flow, as the DAC suggested above has max 2ma.