GoldenMotor.com Forum

General Category => General Discussions => Topic started by: norkmeister on March 01, 2008, 06:19:38 AM

Title: Cruise control?
Post by: norkmeister on March 01, 2008, 06:19:38 AM
Anyone thought of having some sort of cruise control?  On a 16 km commute I imagine that my right hand is going to get a bit sore from holding the throttle on all the time and the ability to change hand position would be nice without having to back off on the throttle.  Has anyone done this?

Cheers,
Jeremy.
Title: Re: Cruise control?
Post by: martinko on March 03, 2008, 08:47:32 AM
Anyone thought of having some sort of cruise control?  On a 16 km commute I imagine that my right hand is going to get a bit sore from holding the throttle on all the time and the ability to change hand position would be nice without having to back off on the throttle.  Has anyone done this?

I was thinking of this myself. Recently I talked to a guy on the phone who does rides of about 150km. He has found a simple solution: He puts some electrician's tape into the throttle to avoid that it jumps back to zero when you release it. This is of course just a hack but could work. I have not yet tried myself, though.

Cheers
Martin
Title: Re: Cruise control?
Post by: norkmeister on March 03, 2008, 09:08:59 AM
My initial thoughts were some sort of hinged and spring loaded metal pin which you could swing over into a series of holes drilled into the twist grip.  Realistically I suppose one at full throttle would be enough.
Title: Re: Cruise control?
Post by: Tommybike on March 03, 2008, 11:11:45 AM
Martinco,  How is this guy getting a range of 150Km?  thats over 90 miles,  which is almost 4 hours continuous at the wheels top speed.  You'd need maybe 30-40 ampere hour batteries unless you're doing most of the cycling yourself.
Title: Re: Cruise control?
Post by: martinko on March 03, 2008, 12:55:41 PM
Martinco,  How is this guy getting a range of 150Km?  thats over 90 miles,  which is almost 4 hours continuous at the wheels top speed.  You'd need maybe 30-40 ampere hour batteries unless you're doing most of the cycling yourself.

He has 4 pieces of LiPo 40Vx10Ah Batteries with him, weight about 10kg, which seems feasible for me. A little expensive (1.400€), but doable.

Cheers
Martin
Title: Re: Cruise control?
Post by: martinko on March 04, 2008, 11:39:11 AM
Another thought on this:

Wouldn't it be nice, especially for longer rides, to have something like a constant-current-option for a cruise control? When I know, that I have 15Ah in my batteries, and I want to reach my destination with it, I know that I can use, eg 7A for 2hours, or 5A for 3hours. I can then check the speed for both and decide for the option that will bring me home best, how much power do I have to put in pedaling, how much can I afford to take from the batteries.

Has anybody experimented here? Of course I can think of hacks, like having an Amperemeter on, and adjusting the throttle always. But removing the human feedback loop would be nice of course, something like a electrical-current-restriction tool, that can be set to some typical values...

Greatful for any hints.

 
Title: Re: Cruise control?
Post by: OneEye on March 04, 2008, 04:09:16 PM
I believe the cycle analyst has some form of current limiting and cruise capability in its latest form.
Title: Re: Cruise control?
Post by: martinko on March 05, 2008, 11:02:37 PM
I believe the cycle analyst has some form of current limiting and cruise capability in its latest form.

could you be a bit more specific on this, please?
do you mean this site http://www.cycleanalystinc.com?
a search here does not seem to lead to anything useful...



Title: Re: Cruise control?
Post by: OneEye on March 06, 2008, 01:01:08 AM
Found it:  http://www.ebikes.ca/drainbrain.shtml

Looks like it has current and speed limiting, although not necesarily a cruise control.  You could probably make it so you have a switch that gives full-throttle, and then the speed limiting feature would keep you below the top speed.  It might take some tinkering to figure out.
Title: Re: Cruise control?
Post by: martinko on March 07, 2008, 12:38:08 PM
Found it:  http://www.ebikes.ca/drainbrain.shtml

Looks like it has current and speed limiting, although not necesarily a cruise control.  You could probably make it so you have a switch that gives full-throttle, and then the speed limiting feature would keep you below the top speed.  It might take some tinkering to figure out.

Great site, very nice logo, thanks again.

The shop names it with the word I was looking for, without being able to name it: "Tempomat": Try to keep constant speed. This is IMO exactly what it should be. The other option should be "Current-o-mat". I'll check it out.
Title: Re: Cruise control?
Post by: johnnyfr on March 11, 2008, 09:21:00 PM
That's what I call a good idea.
Title: Re: Cruise control?
Post by: ahend on March 16, 2008, 01:55:07 AM
I have thought about a cruise control for a while and have some ideas.

Creating an electronic cruise control for the golden motor controller should be fairly straight forward. The basic idea is to set and hold a 0-5v signal to the controller’s throttle input line. The throttle may then be released, and the controller will continue to drive the motor.

A crude version of this idea could be as simple as a potentiometer controlled voltage divider circuit with a mechanical on off switch. Close the switch and adjust the speed where you want it with the potentiometer. A couple diodes are added for throttle circuit protection.

(http://www.iserv.net/~ahend/Crude2.jpg) 

Tests of my throttle assembly reveal that the motor does not start working until about 1.2 volts are present on the throttle input. At maximum speed, the throttle is putting out around 4.3 volts. The throttle sources around 40 micro amps of current to the controller. The potentiometer and resistor in the above circuit are sized to closely approximate that signal level.

A more elegant and user friendly solution would be to use a cheap micro controller and an analog to digital convertor to sample the throttle signal level when an input button is pressed, and then output a cruise control signal that approximates it. A micro controller can easily output a variable 0 to +5v signal using pulse width modulation.

This configuration would “grab” whatever speed signal was present on the throttle when the set button is pushed and lock the controller to it. It would be a safer solution as well. You could monitor the controller’s inhibit signal from the brake levers and cut out the cruise control when the brakes are applied. A resume button could also be added to ramp up the throttle to the cruise level, after stopping or slowing down.

The components for the micro processor version should be under $10 easily. In the next week or so I will try to put a working example together and post the results.

Andy
Title: Re: Cruise control?
Post by: ahend on April 07, 2008, 08:04:48 PM
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 
Title: Re: Cruise control?
Post by: sdalli on April 08, 2008, 10:55:43 AM
can't you just remove the return spring on the throttle assambly?
Title: Re: Cruise control?
Post by: shakkan on April 08, 2008, 01:15:13 PM
this is what ive done-allso makes right turns easer as you can keep your right hand out all the time.you have to watch when you plug in/turn on key at the start or the bike goes off.easer on the wrist
Title: Re: Cruise control?
Post by: ahend on April 23, 2008, 10:17:32 AM
I finally finished the electronic cruise control that I designed for the Golden Motor brushless controller.

The system is based on a PIC16F684 microcontroller from Microchip Inc. It interfaces the controller’s existing throttle and inhibit circuits. In operation, it reads the 0 to 5 volt output of the throttle assembly and emulates it back to the controller, thus allowing control of the signal. 

Theory of operation
Using its onboard analog to digital converter, and pulse width modulation block, the PIC monitors and emulates throttle settings.
The PIC16F684 constantly polls the throttle in and throttle offset pins for analog voltage levels. These two analog values are converted to digital and added together. This combined throttle value is then tested against the current cruise setpoint. If the value is lower then the setpoint, the setpoint value is sent out a to digital output pin via pulse width modulation. If the combined throttle value is greater than the setpoint, the throttle value is used. The PWM output is smoothed through a first order low pass filter, where it is then presented to the controller's throttle input line.
The PIC also constantly monitors two button inputs, the set and resume controls. If the set button is pushed, the current combined throttle value is saved to memory as the setpoint. If the resume button is pushed, the PIC16F684 enters a loop, in which it tests the current PWM duty cycle (the value output to the motor controller) to a delayed ramp value, which starts at the current throttle position (in most cases zero). The loop increments the ramp value until it reaches the current setpoint. Each time the ramp value increments, it is sent out to the motor controller. When the ramp and setpoint values are equal, the loop is exited and the program continues scanning the main loop.
The throttle trim input (offset) serves to add back in the output filter losses. If it were not present, the throttle would not respond normally. Acceleration would occur further down in the throttle’s stroke, and the full throttle position would not provide full motor power.
An interrupt handler is incorporated into the program to monitor the state on the inhibit in/out pin. When the PIC16F684 see a falling edge on the inhibit pin, it executes the interrupt and shuts off the cruise control by setting the cruise setpoint to zero. Before  doing so, it saves a copy of the value to memory so that operation can be resumed via the resume button.

Wiring instructions
Tap into the +5VDC and ground lines bound for the throttle, and wire into the appropriate power line inputs of the PIC circuit. Be sure power is still being feed to the throttle assembly.

Cut the throttle signal line and wire the end coming from the throttle assembly into the Throttle IN line. Wire the other end (going to the controller), to the Throttle OUT line.

Tap into the controller's positive inhibit signal, and wire it to the Inhibit IN line. Make sure you are using the positive line. The inhibit in pin must be biased high from the controller. Use a volt meter between the two inhibit connections to find the positive wire. One of them is at ground potential, the other is around +5 volts. My positive inhibit line happened to be blue in color.

Adjusting the throttle trim
With the system turned on, hold the throttle full open and slowly turn the trim potentiometer until you hear, or see via speedometer, that the maximum speed has been reached. Do not turn the potentiometer any more than necessary to achieve full speed using this method.

Using the cruise control
While traveling at the desired speed, press the set button. The system will lock on to the current speed and allow the throttle to be relaxed. The throttle will work as normal above this set speed, allowing higher cruise speeds to be easily set. To deactivate, grab a handful of brakes to close the controller inhibit circuit (which also shuts down the cruise control) or simple press the set button with the throttle in the off, or relaxed position. 
To resume cruise to the last setting, press the resume button. If the throttle position is lower than the cruise setpoint when resume is pressed, the system will gradually ramp up the output to the setpoint. If the throttle is higher than the setpoint, the setpoint will be activated but immediately overridden by the current throttle position. If the throttle is reduced below the resumed setpoint, cruise speed will be held to the setpoint.
The last setpoint value is saved to non-volatile memory, so anytime you power the system back up, the last cruise setpoint value is available and may be resumed.

Bill of materials
(1)   PICF16F684 Microcontroller
(1)   0.1µf ceramic capacitor
(1)   1µf ceramic capacitor
(3)   47kOhm 1/4 watt resistor
(1)   33kOhm 1/4 watt resistor
(2)   Normally open, momentary push buttons
(1)   1kOhm linear trimming potentiometer

Project source code
cruise.asm (http://www.custominterfacing.com/cruise.asm)
P16F684.INC (http://www.custominterfacing.com/P16F684.INC)

Circuit schematic
(http://www.custominterfacing.com/CruiseSchematic.jpg)

Ugly, but operational . . .
(http://www.custominterfacing.com/CCG.jpg) (http://www.custominterfacing.com/CCF.jpg)





      
Title: Re: Cruise control?
Post by: nitecheck on June 14, 2008, 05:34:05 PM
Hi Andy -

Personally I think you have done well  :)

Great little "commuter cruise controller".

I sent u a mail - let me know if your interested.

Regards
nitecheck