After a bit of tinkering I was able to build a prototype electronic cruise control using a Microchip PIC16F684 microcontroller. At this point I’m fine tuning the software and investigating how best to integrate the Golden Motor controller’s inhibit signal. At present I have set, stop, and resume functionality – well mostly.
The PIC16F684 is set up to assume complete throttle control by first sampling the signal from the throttle assembly on an input pin and then emulating the signal via pulse width modulation to an output pin. The PWM output signal required a low pass filter to smooth it out and make it presentable to the controller. As a consequence of this filter, the output signal is attenuated slightly. To counter the reduced output, I fed in another analog voltage which is added to the throttle signal digitally. This “trim” voltage is set with a small potentiometer and is adjusted to just allow full throttle when the throttle is opened fully. With the trim set properly, the throttle functions almost identically to the original. I set the PWM control to run at 15kHz, giving the output 8 bit resolution. That seems to be adequate (5/256=0.0195 volts per step), but I could lower the PWM frequency to get 9 bit resolution if need be. I would be surprised if the Golden Motor controller were sampling the throttle at a resolution higher than 8 bit. With the throttle now under digital control, setting a cruise output is simple.
The system is powered from the +5VDC supply lead that runs to the throttle assembly, so it can be patched in pretty easily. Currently, the system will hold a cruise output, based on the throttle position, with a button push, and turn off with another button push. I’m currently tweaking the resume function code but it will ramp the throttle up, or down, to the setpoint from the current throttle position.
I have not put the project in any container yet, it’s all on breadboard. To keep it small and tidy, I may pot it in black silicone so that power, throttle, and button wires can be molded in.
When I get the code somewhat finalized I will post it, along with a schematic and bill of materials. I should have some test results soon as well. I have about $4 of electronics into the current design, minus a few momentary push buttons. To make the system fail safe, I would most likely need to add a small reed relay and some more code. If anyone is interested, and I get the wrinkles ironed out, I’d be more than happy to program a PIC and send it out to you.
Andy