The No-Switches Cruise Control
It's been a while since I've posted in this thread. I haven't been doing anything to Mexy for some time now. Just enjoying driving her. And yes, being on good behaviour speedwise. I get my jollies now by not slowing down for the corners.
But the very need not to speed accidentally, got me to thinking about adding cruise control. However, I like the fact that all the controls and displays are stock standard -- no one would know she was electric by looking at the dash. Not to mention the fact that I'm a lazy bastard who doesn't want to fiddle around, mounting and wiring switches. And as a wise man once said, laziness is the mother of invention.
So, over many drives, I thought about various solutions, gradually whittling the number of switches down to zero -- a purely software solution -- and then further simplifying even that. And today, I finally implemented it.
When I say "zero switches" I really mean zero
added switches. Clearly there has to be
some way for the driver to interact with it.
The Tritium WaveSculptor motor controller can be commanded, via CAN bus, to maintain constant rpm. All that's required is suitable software in the open-source Tritium Driver Controls unit, to send those commands. And, for a software-only solution, I can only use controls that are already connected to the Driver Controls unit.
My plan is to use the momentary-on START position of the ignition switch, when we're already in Drive mode, to toggle cruise mode (constant-rpm mode) on and off. The set rpm will be whatever the motor is doing when cruise is turned on.
Cruise mode can be turned off by touching the brake pedal, or the clutch pedal, or putting the gear-shift in neutral, or pushing the accelerator pedal to where the requested rpm is significantly higher than the set rpm. And if all else fails, you can turn the ignition key to OFF.
Some of you may remember that we're presently using the ignition-switch START position, when in Drive mode, to cycle around 6 different quantities that we can display on the tacho. That function will still be available, but now only when in neutral or when the clutch pedal is depressed.
I have to tell you that testing brand new code designed to take over control of the speed and torque of your small car's 120 kW motor, is somewhat scary. As Coulomb facetiously said, when I told him what I was doing, "What could possibly go wrong".
This is something you want to test on a straight road with few other cars. So off I went, in the suburbs, at peak hour.
Actually, on the first test, I didn't go anywhere. It turned out I had initialised cruise mode to ON. And since the rpm at the time was zero, zero rpm was dutifully locked in. Constant zero rpm is pretty much the definition of a brick.
So I fixed that and off I went to a quiet road near Mt Coot-tha. The first time I flipped the ignition switch to START, to go to cruise mode, and took my foot off the accelerator, she kept on accelerating! It was like a demon had taken control. In other words it was just as if
I was driving ... before I got the good behaviour bond.
So I flipped the key again, which turned cruise off, and gave me full regen braking, because of course my foot was off the accelerator.
The next time I tried it, she slowly
decelerated. So clearly something was still wrong. But I was pleased that all the different methods of dropping
out of cruise mode worked.
So, back home to eyeball the code, and I found I was taking the set rpm as the rpm being requested by the pedal rather than the actual motor rpm. So I've fixed that now, and will test again tomorrow.