Building A Cruise Control
I have a BS24P running a speedometer and also running a hobby servo that operated the throttle on a gasoline engine.
My speedometer operates from 0 to 25.5 miles per hour (0 to 255) and my Throttle control operates in much the same range. Almost exactly the same on level ground.
I would like to take the feedback from the Speedometer and use it to create the hobby servo signal based on the command number I am now sending directly to the hobby servo.
Basically I want to close the velocity loop so that when I go up a hill and the speedometer slows down, the throttle command will automatically increase.
Does anyone have any idea how I should begin this experiment?
This system will be used on my large scale locomotive. A hobby servo operates the carburetor. An ADC reads a throttle control pot. I am using COUNT to measure my speed from a hall effects sensor on a drive sprocket.
Just wondering if anyone has done something like this before or as seen any writeups around that deal with making a software cruise control.
THANKS
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
AUTOMATE EVERYTHING
http://www.trainyard.net
My speedometer operates from 0 to 25.5 miles per hour (0 to 255) and my Throttle control operates in much the same range. Almost exactly the same on level ground.
I would like to take the feedback from the Speedometer and use it to create the hobby servo signal based on the command number I am now sending directly to the hobby servo.
Basically I want to close the velocity loop so that when I go up a hill and the speedometer slows down, the throttle command will automatically increase.
Does anyone have any idea how I should begin this experiment?
This system will be used on my large scale locomotive. A hobby servo operates the carburetor. An ADC reads a throttle control pot. I am using COUNT to measure my speed from a hall effects sensor on a drive sprocket.
Just wondering if anyone has done something like this before or as seen any writeups around that deal with making a software cruise control.
THANKS
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
AUTOMATE EVERYTHING
http://www.trainyard.net
Comments
As a start, the throttle pot becomes the target speed pot.
The program loops, comparing the actual speed to the pot setting. If actual <target then increase servo position. If actual > target then decrease servo position.
The loop probably needs to do 5 things:
measure target speed pot
measure actual speed
compare actual and target
adjust the servo
repeat
The details include how fast to adjust the servo and what to do when a sudden change in target speed pot occurs.
Sounds like a neat project!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
·
I need something to limit the "adjust the servo" or throttle with some control. I don't want the throttle to accelerate so fast that it overshoots the target speed.
Greg
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
AUTOMATE EVERYTHING
http://www.trainyard.net
If target - actual > 10
Move_fast
else
Move_slow
endif
Move_fast
servo = servo + 50
Move_slow
servo = servo + 2
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
MOORE'S LAW: The capabilities of electronics shall double every 18 months.
cloyd's corollary: Hardware is easy, software is hard.