MOTOBRICK.COM
TECHNICAL MOTOBRICK WRENCHING In Remembrance of Inge K. => The Motobrick Workshop => Topic started by: wmax351 on April 13, 2012, 04:38:23 AM
-
I am thinking of making a cruise control as a project (to learn avr programming). I plan to use an arduino/avr microcontroller, and a large model aircraft servo motor, or a stepper motor. Should be able to make a much smaller form factor, for well under 30 dollars and a bit of time.
Rough idea of the arduino code. I would have to tweak the delay, and add a dead zone, (to adjust sensitivity) but this is most of what would be required.
#include <Servo.h>
Servo throttle; // create servo object to control a servo
const int freqpin = 0 ;
const int setpin = 1 ;
const int cutpin = 2 ;
int thrpos = 0 ;
int curspeed ;
int setspeed ;
void setup()
{
throttle.attach(9); // attaches the servo on pin 9 to the servo object
pinMode(setpin, INPUT);
pinMode(cutpin, INPUT);
}
void loop() // Main Running loop. Adjusts throttle while comparing speeds
{
curspeed = analogRead(freqpin); // reads the value of the frequency to voltage converter (value between 0 and 1023)
if(digitalRead(setpin) == HIGH ) // reads the value of the "set" button
{
setspeed = analogRead(freqpin);
}
if(digitalRead(cutpin) == HIGH ) // reads the value of the Cut button
{
setspeed = 0 ; // zeros the desired speed
}
if (setspeed > curspeed) {
thrpos ++ ; // adjusts the throttle based on speed
}
if (setspeed < curspeed) {
thrpos -- ;
}
throttle.write(thrpos); // sets the servo position according to the scaled value
delay(15); // waits for the servo to get there
}
-
Makes perfect sense to me.
(Not!)
-
Just bought an exhaust servo for a CBR600. It runs cables that close a baffle in the exhaust for more backpressure. Should have enough power for the throttles, which I will set up to open only part way. In addition, it is already set up to run bowden cables. I will reverse engineer the input, and set up a micro-controller to run it.
I will also run a PID (Proportion, Integral, Derivative) control, which will provide smooth, adaptive control for the speed.
Total cost, so far:
$8.50 for the Servo
$ 19.90 for the micro-controller, and related stuff for easy development (arduino clone). Final cost for additional units will be 5 bucks or so.
-
Are you going to program to kill if the RPMs change by say, several hundred? That's what the Audiovox does for 2 reasons:
a) you can disengage the cruise with the clutch
b) it prevents the CC from causing a runaway engine
-
Are you going to program to kill if the RPMs change by say, several hundred? That's what the Audiovox does for 2 reasons:
a) you can disengage the cruise with the clutch
b) it prevents the CC from causing a runaway engine
Yeah. I was planning to do that, as well as an interrupt for the clutch, brake, etc.
The PID system should be quick enough to control rpm even in neutral. The "D" part detects rapid acceleration.