Help on gas/elec hybrid go kart

hey all- I've built a elec go kart using a 24v source, PMC high amp speed controller, and massive 24v excavator starter motor. Fun stuff. I want to make it gas/hybrid. I'm not going to lay out all the challenges- but I do need help on building a buy list for micro controllers/sensors etc. I haven't done Microcontrol programming/build in 15yrs- sooo.. I'll pay more for "more built" or easier programming.

Here's what I think I need:
-RPM sensor (drive wheel)
-angular position sensor (gas pedal)
-servo x2 (gas and elec throttle control)
-Microcontrol that can handle the inputs/ drive servos

Without getting into the mud of the logic- general thoughts- based on drive wheel rpm, engage elec throttle servo based on gas pedal position, until certain rpm reached, then taper on gas throttle servo, tapper back elec throttle servo until higher rpm- then zero elec throttle servo

Disclaimer-I am first time newb on this controller, sorry if any of this already covered- feel free to point me to old posts.

Hi,

Welcome to the forum.

What do you want the controller to do, do you have a block diagram of how you want to integrate the E system to the G system.

I assume you have the E system speed control taken care of.

Tom.... :slight_smile:

Yea- the high amp stuff all taken care of. Basically- I want to have the kart use elec for take off/low speed, the gas motor for high speeds.

I'm thinking a drive by wire system. Gas pedal is input sensor. Servos control throttle for both elec and gas motors. Controllers job- monitor wheel speed (and gas pedal position) and decide when to use elec motor vs gas.

Serial hybrid is so much easier. Gas motor drives a generator which charges the battery which drives the wheel motors.

You may also consider separating the drive wheels. The electric only drives the front when the accelerator position or rate-of-change-of-accelerator-position requires it. The main drive is conventional mechanical transmission to the back wheels.

The Prius type hybrid is mechanically very complex. Most amateurs would not be able to do this. (But only because they don't want to. If you really want to do it, don't let me stop you.)

Thx guys. As for "feasibility " with the arduino- I'd say a big yes. I've since gotten a starter kit and begun prototyping.

Morgan- your probably right. I've seen builds like that. I'm still going dual drive. Mechanically - single axle, dual drive sprockets, and centrifugal clutches on each motor. Gear ratios optimized for their jobs of high or low speed.

With controller- I'll monitor axle rpm vs each motors rpms. Key will be building acceleration maps (for when switch over) and then telling controller via servos how to throttle each motor. At cut over point (from elec to gas) I'll have to buffer rpm matching then shut down elec to free wheel. Basically (I hope) it's all down to actual drive wheel rpms.. And based on its speed vs desired acceleration- I can reference my acceleration map to correctly throttle motors.

Hi,
What are you going to do mechanically to integrate the two systems to the drive train.
MorganS sounds ideal.
Other wise a clutch on the G motor to engage with the E motor shaft.
When G motor engaged, E motor freewheels and if needed offers dynamic breaking.

Tom.... :slight_smile:

The mechanical side probably a discussion for another forum.. But briefly..

Simple is best. Solid axle. Drive sprocket on each side of axle. G and E motors, with different ratios hooked to each drive sprocket. The centrifugal clutch on each motor will let the drive system on unused motor "freewheel".

Biggest thing I'm concerned mechanically is "buffer time" or the transition of motors when they will be a few thousand rpms apart. I might overcome some of that by delaying stall on clutches (what rpm they engage). I'll solve that when I get there.

FullOfBadIdeas:
I'm still going dual drive. Mechanically - single axle, dual drive sprockets, and centrifugal clutches on each motor. Gear ratios optimized for their jobs of high or low speed.

Electronics aside, I'm not clear on how this would work. The centrifugal clutch on the electric motor drive won't disengage until the speed drops below the engagement rpm, so the throttle response is going to be very strange at the best. At worse, it doesn't disengage and you over-rev the electric motor when driving from the gas engine. Maybe if there were a freewheel on the electric drive . . .

One of the benefits of the electric hybrid is regenerative braking. With a freewheel or centrifugal clutch, you don't get to use the electric motor for braking. That may not be a problem for this build.

Is this for some kind of racing category or a school competition? Those types of events have lots of safety rules for good reason. Things like two accelerator return springs in case one breaks. Adding this extra complexity of drive-by-wire should consider those kinds of safety aspects. If the Arduino loses power because a wire broke, does it return the throttle actuator to a safe position? What if it's the ground wire that breaks?

Mr mark based on how those clutches work - it will free wheel (motor not in use). of that im sure. drive wheel rpms could be at say 4k rpm, and elec motor at zero - thx to clutch, no drag on system (bar the chain, and spinning clutch). There might be an un-settling "lurch" during motor transition however - not sure.

Morgan - you are again correct - regenerative breaking will not work here.

safety is a BIG concern - my kids going to be driving it - I'm estimating speeds in range of 35-45mph. I need to work into code a "fail safe" default throttle return, I also have spring returns on throttles, and last - a "dump" button on elec drive which cuts all power. I can connect gas kill switch to dump button too. reason for the project? shits n' giggles.

Check this out - sample proto code - its working (at least on my desk/proto baord)

//proto code for hybrid gas/elec drive by wire system. the servos control each motor, and based on drive wheel rpms, tell which thottle what position is best.
//using an Arduino UNO board.
//observed results - seems to work. if rpms are below 4k, the elec throttle goes full range, between 4-5k rpm, both E and G throttles follow gas pedal to full range, and over 5k rpms - elec thorttle servo goes to zero, gas goes full range.
//when coming from above 5k rpms back down, the elec servo will return from zero to gas pedal input postion.

#include <Servo.h>

Servo myservoG; // create servo object to control a servo - gas motor throttle actuator
Servo myservoE; //elec motor throttle actuator

int potpinT = 0; // analog pin used to connect the potentiometer - this pot is the gas pedal
int potpinR = 2; //this pot used to give test drive wheel RPM input - simulated wheel RPM - will use hall sensors on final
int valT; // variable to read the value from the analog pin - for gas pedal
int valR; //var for fake wheel RPM input
int switchstate = 0; //for the turbo button :slight_smile:
int GTP; //used to write to servo gas motor throttle position
int ETP; //used to write to servo elec motor throttle position

void setup() {
myservoG.attach(9); // attaches the servo on pin 9 to the servo object - gas drive servo
myservoE.attach(12); // attaches the servo on pin 12 to the servo object - elec drive servo
pinMode(2, INPUT); //for push button switch - goal, set both throttles (near)max on push.
Serial.begin(9600); //serial monitor so I can track the vars
}

void loop() {
switchstate = digitalRead(2); //results - the servo follows pot position until button is pushed. on release of button, returns to current pot value.
if (switchstate == HIGH) {
myservoG.write(150); //when in doubt, punch it!
myservoE.write(150);
}

else {
valT = analogRead(potpinT); // reads the value of the potentiometer (value between 0 and 1023) - for gas pedal input
valR = analogRead(potpinR); //input for fake wheel RPM
valT = map(valT, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180)
valR = map(valR,0,1023,0,10000); //used to map fake RPM input from pot from 0 - 10k rpms - just made up range for now.

//throttle mapping - goal, based on drive wheel's RPM, choose which motor (gas or elec) to throttle
if (valR <4000) {
ETP = valT; //setting elc and gas throttle positions - under 4k rpm, elec only, no matter gas pedal position, gas motor gets no throttle.
GTP = 0;
}
if (valR >4001) { //setting throttole positions - in this "buffer" range of 4-5k, both motors are equally throttled.
ETP = valT;
GTP = valT;
}

if (valR >5000) { //setting throttle postions - in this high range, over 5k rpm, elec is set to zero, gas is set to pedal postion.
ETP = 0;
GTP = valT;
}
//the above throttle maps have flaws - I will need to know motors RPMs, and the gear ratio invovled to better set throttle - this is just POC. i.e. if gas motor is at 8k RPM, given its gear ratio, it should be spinning rear wheel at 2k rpm -

Serial.print("RPMs"); //all this to use serial monitor to watch variables on pot turn. -this is to show simulated real wheel rpms.
Serial.print("\t");
Serial.print("ETP"); //elec motor write throttle postion
Serial.print("\t");
Serial.print("GTP"); //gas motor write thorttle posion -
Serial.print("\n");
Serial.print(valR);
Serial.print("\t");
Serial.print(ETP);
Serial.print("\t");
Serial.print(GTP);
Serial.print("\n");
delay (100); //note to self, learn how to make serial print more readable..

myservoE.write(ETP); //writes the final servo position for elec post-rpm calculation
myservoG.write(GTP);// writes the final servo postion for gas post-rpm calculation
delay(15); // waits for the servo to get there

}
}

Couldn't you mesh the two using a differential with the electric motor driving one of the axles and the gas engine driving the pinion/ring gear? The remaining axle would be used to drive the real, kart axle.

That's an interesting idea charpin. Hadn't thought that, will ponder it. First reaction- small yet tuff diffies hard to find and second concern- just not a lot of "real estate" on kart for much stuff. Still- given the right diffie- that's a real possibility

code update - guys - I am rusty on my coding - any comments welcome. I could really use some help on the throttle mapping -or the logic that decides which motor(s) to throttle and how much. you can see how I have it now - works -but I can see some situations - like going right in buffer speed zone (say 25mph) then just tapping the gas pedal - likely cause big motor breaking. any other comments on how to improve the throttle decisions welcome!

code------------------------------

//proto code for hybrid gas/elec drive by wire system. the servos control each motor, and based on drive wheel rpms, tell which thottle what position is best.
//using an Arduino UNO board.
//observed results - seems to work. throttle mapping suspect.

#include <Servo.h>

Servo myservoG; // create servo object to control a servo - gas motor throttle actuator
Servo myservoE; //elec motor throttle actuator

int GasPedalPin = 0; //input pin for gas pedal pot
int WheelRpmPin = 2; //for now, input for pot, but place hall sensor here later.

float WC = 4.18; //static value for measured wheel circumference, used in MPH calc. unit in feet.
int MRE = 3000; //static value, measured maximum RPM possible by elec motor
int MRG = 9000; //static value, measured maximum RPM possible by gas motor
float GRE = 5; //static value for gear ratio on elec drive - in this case 12T and 60T sprockets.
float GRG = 5.625; //static value for gear ratio on gas drive - in this case 8T and 45T sprockets
int GTP; //used to write to servo gas motor throttle position
int ETP; //used to write to servo elec motor throttle position

// *************************************************
void setup() {
myservoG.attach(9); // attaches the servo on pin 9 to the servo object - gas drive servo
myservoE.attach(11); // attaches the servo on pin 12 to the servo object - elec drive servo
GTP = 0; //return both throttles to zero.
ETP = 0;
pinMode(2, INPUT); //for push button turbo
Serial.begin(9600); //serial monitor so I can track the vars
}

// *************************************************

void loop() {

int Throttle = GasPedal();
int WheelRpm = WheelSensor();
int mph = mphCalc(WheelRpm);
ThrottleMap(Throttle,mph);
ThrottleSet();
turbo(mph);
TestMonitor(Throttle,WheelRpm,mph,GTP,ETP);

} //end of loop

// *************************************************

int mphCalc(int x)
{
x = (x* WC)/88; //a lot of simplification here, but this works.
return x;
}

// *************************************************

void turbo(int x) //results - the servo follows gas pedal position until button is pushed. on release of button, returns to current pot value.
{
int switchstate = 0; //for the turbo button :slight_smile:
switchstate = digitalRead(2);

while (switchstate == HIGH) { //protection for elec motor - dont engage after its max rpms..
switchstate = digitalRead(2);
if (x<25) { //bad coding - using mph, knowing elec motor will not drive over 28 mph.
ETP = 150;
GTP = 150;
}
else {
ETP = 0;
GTP = 150;
}

TestMonitor(0,x,0,GTP,ETP);
ThrottleSet();
}
}
// *************************************************

int GasPedal()
{
int x = analogRead(GasPedalPin); // for gas pedal input
x = map(x, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180)
return x;
}
// *************************************************

int WheelSensor()
{
int x = analogRead(WheelRpmPin); //input for fake wheel RPM
x = map(x,0,1023,0,2000); //maps input to 0-2000 rpm range - this is again, rear axle - so post gear ratios.
return x;
}

// *************************************************

void ThrottleMap( int G,int S) //throttle mapping - based on mph - decide best motor or combo to use, then assign throttle positions
{

if (S<20) {
ETP = G; //setting elc and gas throttle positions -poor coding - the 20 is mph, knowing that elec motor max rpms (3000) through ratio (5) yeild max mph of 28.5mph.
GTP = 0;
}
if (S >=20 && S< 27) { //setting throttole positions - buffer range
ETP = G;
GTP = G;
}
if (S >27) { //high range
ETP = 0;
GTP = G;
}
}

// *************************************************

void ThrottleSet()
{
myservoE.write(ETP); //writes the final servo position for elec motor throttle
myservoG.write(GTP);// writes the final servo postion for gas motor throttle
delay(15); // waits for the servo to get there
}

// *************************************************

void TestMonitor(int aa,int bb,int cc,int dd,int ee)
{
char* a = "Gas"; //change these for other labels print format is ("char a, int aa,")
char* b = "RPMs";
char* c = "mph";
char* d = "GTP";
char* e= "ETP";

Serial.print(a);
Serial.print("=");
Serial.print(aa);
Serial.print("\t");
Serial.print(b);
Serial.print("=");
Serial.print(bb);
Serial.print("\t");
Serial.print(c);
Serial.print("=");
Serial.print(cc);
Serial.print("\t");
Serial.print(d);
Serial.print("=");
Serial.print(dd);
Serial.print("\t");
Serial.print(e);
Serial.print("=");
Serial.print(ee);
Serial.print("\n");
}

Please use code tags. The forum software turns some of your code into smileys if you don't.

It has a pulse! Next step- hook up arduino do for monitoring, then go drive by wire, then install 2nd gas motor. Baby steps!