# Help on throttle mapping for gas/electric hybrid motor

• Automotive
hey all -

ive built an big amp DC electric kart, and want to add a gas motor for secondary drive. not going serial hybrid - I want both to be drive motors. I've written controller code (can link to it if anyone wants) - but the problem is not the code - its how to map the transition of throttles - or basically - when to use which motor - and with how much throttle input is correct for the given set of circumstances.

I've got a lot of data here - or can get and add more into the problem if needed. but at the heart of it, I am not sure what is the critical variable to use to make decisions - and what other factors I need to take into account to make good decisions.

I know:
max elec motor rpm
max gas motor rpm
each motors gear ratios
rpms of axle, or drive wheel
the mph (using wheel circumference calcs) -and can map to either motor, at any rpm (and have the data for each rpm, for each motor in a spreed sheet)

my logic -
3 zones - low speed, buffer, high speed. I use mph as the deciding factor in the calculations. the controller tells the servos in each zone to either throttle the motor(s) to gas pedal input, or ignore throttle setting to a certain motor.

low speed - elec motor only, following gas pedal input.
buffer - both motors, following gas pedal input
high speed - gas only, following gas pedal input.

My concerns -
I can see situations where harsh transitions can occur. both motors hooked to same axle via centrifugal clutches (so non-used motor freewheels). say if I am in high speed zone, and slow into buffer zone speed, then only hit the gas pedal a little bit (say 5%). the elec motor will come on, set to run at say 5mph, while the kart is travelling say 25mph. maybe I need to ignore gas pedal input given certain conditions, I'm not sure - or set any gas pedal input to match the current speed -like dead pedal until it matches.

im thinking the accel from zero to max mph will work well, I am most concerned with states of transition from high to buffer or low zones then back up. any other factors I can build into my throttle map to make it more intelligent and usable?

also - trying to avoid questions/comments along the lines of "how drive systems work, how code works, how high amp works". I can share that if needed, but really need help on this particular Q.

thx,

Nidum
Gold Member
Two ways of proceeding :

You can attempt to work it all out theoretically .

or

You can fit your vehicle with a fiddle box and do some active programming . Basically set the control system up best guess and then refine the system live during a series of test runs .

I would go for the fiddle box approach myself .

Last edited by a moderator:
berkeman
Mentor

berkeman
Mentor

Mech_Engineer
Gold Member
Have you considered mapping the power/torque curves for the gas engine and compared against the electric motor? It might make the solution more obvious if there are "flat spots" in the engine's power curve that can most benefit from the power curve of an electric motor?

Fiddle box might be the way. I think I have OK guesses on mapping- fiddling will show clearly how wrong I am :)

Engineer- that's an option, but two things- hard to do without proper dyno and my goal is not "max power all the time", but rather avoid clunky transitions during motor change overs. Maybe one day I'll do that, cool idea, but right now more worried about ripping a motor out of its mount.

Any one know how they base the motor transitions on real hybrids? Prius, etc.

Mech_Engineer
Gold Member
The point is a gas engine has relatively low torque output at low rpm, but electric motors have max torque at low rpm. You should have the motor putting out max power at start, and tune the electric motor down (through the speed controller I assume you will be implementing) as the engine reaches its main powerband. You shouldn't have any sudden transitions where the motor suddenly turns off and the other turns on; instead, you should have the gas engine running all the time and use the electric motor to supplement power in dead spots in the power band.

Tom.G
Gold Member
It would seem that the transition between motors shoud be mostly based on vehicle speed rather than solely on throttle position. After all, that's how automatic transmissions on passenger cars decide when to shift (with secondary input from throttle position.) You could also match motor speeds before reaching a transition point.

The difference in torque characteristics the reason for the build :)

I don't know actual mph- but let's throw a dart at it for example-

0-25mph elec motor only, gas idling/freewheeling
26-30mph - both motors going
31 mph+ elec off/freewheel, gas motor only

I'm thinking the torque of the gas motor so underpowered from elec, at 0-25mph- the elec will be pulling up the gas motor. But- the smaller gas motor will catch up/rev up quickly in buffer time.

I'm really not worried about 0-31+ mph, it's the on again/off again. Like going 30mph, slow/coast to 24mph, touch gas pedal. Stuff like that. I could monitor rpms of both motors and rear wheel- then code out bad transition states in my controller... Dunno.

Damn. Never thought I'd envy a Prius..

Tom.G
Gold Member
I could monitor rpms of both motors and rear wheel- then code out bad transition states in my controller...
Yeah, that's what I was trying to say; just couched in different terms.

Is the electric motor also driving via centrifugal clutch? I think a lot of "clunkyness" could be eliminated if you keep it spinning (evidently would need to be geared to handle max vehicle speed). Gas motor would just be a 'booster'

I would start with a 2 dimensional map(1 for each motor's duty cycle), on one axis you have vehicle speed, on the other axis you have pedal input... This would enable max acceleration with both motors when you mash the pedal, and would also allow you to gradually phase in or out a specific motor based on demand.. I would recommend starting with a small grid.. perhaps 20% increments (6x6) from 0 to 100% Throttle and speed to get a rough idea of how things react, and then go to a 10x10 or more as you start to fine tune...

If you'd start phasing in the gas engine with lets say about 25% power at 40% pedal and minimum of 15mph, and ramp it up from there, it should be pretty smooth.. it'll all take experimentation though.

Are you doing this on an Arduino?

wow - you guys are on point! love this forum :)

yes, I am using a centrifugal on elec, and gas. not sure if that is best, but the elec motor is massively "torquey" and takes a fair amount of force to turn over. I am starting with it on centif so I can take the drag of spinning that motor out of the drive system at higher speeds. I might first tinker with the clutch to see if I can make it engage very low rpms, if that doesnt work, I might have to take clutch off of elec.

yes, I am using Arduino - and have working proto code as it sits for doing all the mapping and servo/throttle control. after reviewing what others have said here, I went with a map that uses MPH ranges to tell when to use which motor, and a secondary check on gas pedal input to avoid bad transition, I call "dead pedal". just ignore input on gas pedal if it would spin the elec motor at say 5mph worth of rotations if the kart is going 20mph kind of thing. I've made the code use a "mode" function that lets the rider select different throttle maps, so I can do some test maps, and still have a working system. I'll post up the throttle map code snippet below, and can post full code if anyone wants it. Arduino will also take in wheel rpms (via hall sensor), and other various things not related to drive system.

***********************code snippet for throttle map- not full code***************************************
***** GTP is gas motor throttle position - or tell the servo how much to throttle the motor
******ETP is elec motor throttle postion -
*** x is used as gad pedal input, analog pot, mapped to 180 .

int x = analogRead(GasPedalPin); // for gas pedal input
x = map(x, 0, 1023, 0, 180); // mapped to 180 for servos. will chunk up that 180 map to 1/10ths - estimate each 1/10 of gas pedal input is about 3mph for elec motor. .

/*
how throttle map works - mph is main compare. at lower speeds, its elec motor only to follow gas pedal, mid range - both motors follow gas pedal, high ranges, only gas motor follows gas pedel.
the other part of throttle map is to check for "bad transitions" (like going 20mph, and "touch" gas pedal) - during bad transtion times, the program uses a "dead pedal" approach to ignore gas pedal input
until its high enough (stepping on the gas pedal enough) to make the kart actually go faster - must press gas pedal enough to make speeds in that range.
*/

if (mph<5)
{
GTP = 0;
ETP = x;
}

if(mph >= 5 && mph < 10)
{
GTP = 0;
if(x <=36) //the 36 is 2/10 of the 180 input var, or about 6mph worth of gas pedal input.
{
ETP = 0;
}
else{
ETP = x;
}
}

if(mph >=11 && mph <15)
{
GTP = 0;
if(x <=72) //the 72 is 4/10 of the 180 input var, or about 12mph worth of gas pedal input.
{
ETP = 0;
}
else{
ETP = x;
}
}

if(mph >=16 && mph <20)
{
GTP = 0;
if(x <=108) //the 108 is 6/10 of the 108 input var, or about 18mph worth of gas pedal input
{
ETP = 0;
}
else{
ETP = x;
}
}

if(mph >=21 && mph <24)
{
if(x <=126) //the 126 is 7/10 of the 108 input var, or about 21mph worth of gas pedal input
{
ETP = 0;
GTP = 0;
}
else{
ETP = x;
GTP = x;
}
}

if(mph >=25)
{
ETP = 0;
if(x <=126) //the 126 is 7/10 of the 108 input var, or about 21mph worth of gas pedal input
{
GTP = 0;
}
else{
GTP = x;
}
}
ThrottleSet();
}

With both of them running from centrifugal clutches, I think best results would be had with a tach input from both motors... It may be possible to do it without, but smoothness of engagement may suffer...

If both motors have the same final drive ratio, you know that (for example) each MPH of vehicle speed needs 200 RPM from whichever motor is powering it at that point... So if you're accelerating and the electric motor has been doing all the work, to bring the gas engine in gradually you'd open up the 'blip' the throttle briefly to bring the engine up to speed and engage it's clutch.. you will be able to have a feedback loop to reduce the throttle input due to the engine speed as the engine RPM approaches that of the clutch.

Here's a link to a project I'm working on, I have a 2 dimensional map used in a few places, and you can see how it works there, perhaps you can adapt it to be used for your application... In my case it's a position map for a variable vane turbo dependent on engine speed and TPS position.
http://community.lilbb.com/coding/my-life-my-coding/?action=dlattach;attach=203

Another thought of mine is to have your 'gas pedal' only command the desired speed.. so 0 is stopped, 50% is half of max speed, etc, and do all other calculations based on the deviation between real speed and commanded speed... Lets say you put the motors at 100% throttle when you're more than 5mph under commanded speed, so that if the driver commands 20 mph and you're at 17.5mph, it would run at 50% throttle..

Lots of different ways to skin a cat.. Pick and choose through my thoughts on how you can do it!

That is a completely different way to approach it, but I get the concept - that's a nifty way to look at it!. I'll check your project in more detail - seems like you're tinkering down a similar path...At this point, I think I am "done" on theory enough to plug stuff up and see what the heck happens. I'll post back any measured/observed outputs of this method when I get there. be a month or so to finish up mech mounts and such.

I have tuning left to do in my project, but it's working pretty well so far. Good luck with yours!
I've rewritten all my code many times now!

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

jack action
Gold Member
I might have misunderstood the problem, but the gas pedal is related to acceleration, not speed. Another name for the gas pedal is literally the accelerator.

So, when you fully depress the gas pedal, you expect to obtain the maximum acceleration under the current conditions, i.e. weight and speed.

Acceleration is linked to power, which is why you control the fuel delivery with gas pedal on the internal combustion engine (ICE).

Since the electric motor have its power delivery more or less independent of rpm, it makes sense to first use the power from the electric motor (from 0 to 100%). Once you have taken everything from the electric motor, you add the ICE, again from 0 to 100%.

For example, if you have a 2 hp electric motor and a 4 hp ICE, 0-33% of gas pedal input corresponds to 0-100% electric motor and 33-100% of gas pedal input corresponds to 0-100% ICE. This is independent of speed, so you can get both motors engaging at any speed but you get only the electric motor at low speed (no acceleration) or when the the combination of speed and desired acceleration is high.

I'm no expert on electric motors, but I know that you usually can also produce extra power for a short period of time. You might want to set that boost effect only when the gas pedal is at 100%.

Jack- you're 100% right on goal. Being as I don't have proper power curves for each motor- this is my system of guessing. I need to do measurements next, but made up numbers- if my elec does max 3K rpm, I'll figure its effectiveness drops off at say 2500. Then based on gear ratio and wheel circumstances I'll figure that mph, and throttle map accordingly. Same for gas. I'll figure it's max effectiveness comes on about 5K rpm. If anyone has better method of guessing, I'm listening. In the end- how ever i map it- I need a common compare factor. Mph seems most likely. Ill humbly take any other suggestions

jack action
Gold Member
Being as I don't have proper power curves for each motor
This is where I don't follow you: Why would you need those?

As @Rx7man stated in an earlier post, I would see your kart as an electric kart (no need for a clutch) with a gas engine «booster» (with a clutch). The gas engine is idling, doing nothing, and as you depress the gas pedal, the electric motor powers the axle. Once you have reached the maximum voltage input - no matter the rpm/MPH - the rest of the gas pedal travel begins opening the engine throttle, the centrifugal clutch engages, the engine rpm will quickly match the axle rpm and the engine power is added to the electric motor power.

It could also be the opposite - an engine with an electric motor as a booster - but I would prefer the former one.

It would sure be fun to match the engine and electric motor to get the most power throughout the useful speed range, but with the information you have, just matching the engine & axle rpms and motor & axle rpms for any speed should suffice. It will still beat a gas-engine-only or an electric-motor-only kart.

All great ideas, and I'm not sold my method is the best. At this point, I think I need to get to dual motors under controller driven state and test. I've modified my controller code now to do mode maps- or select throttle mapping. Elec only, gas only, basic transition, and earlier intro of gas motor. This way I can play with mapping without killing the ride and see. I'm also limited in my controller intelligence as to what data I can read/input.

As for centrifugal on elec- that seems like bad idea, but the elec motor so big, hard to free hand rotate. It will cause system drag. I'll play with and without centrifugal on elec to see. For the gas motor, I'm not going the Briges/Honda route. I'm going to use a 50cc cag motor(aka pocket bike motor) that is nicely modded and will turn 10k rpm. I know that motor has very little torque at low rpm I'll post back up in a few weeks once I get deeper in.

Seems to be an interesting little project anyhow.. I learned from my project that the logical way isn't always the one that yields the results I was looking for, and it took a lot of experimentation.
Is the gas motor going to have a charging system for the electric batteries? What kind of electric motor is it? they shouldn't be that hard to turn

finding a good, powerful, yet cheep for project build DC motor wasnt easy (at least for me). you get your 750-1000W scooter/wheel chair motors sure -but after that, the price goes way up for anything with power. this motor is a $60 junk yard find. its a starter motor off of an excavator (well, very big construction type vehicle) that runs on 24v. its mechanically sound - bearings etc good. I found out the hard way its a series wound motor - meaning it only spins in one direction no matter the polarity of voltage you send it. (by hard way - think completely ripping completed motor mounts, and remounting on other side). I havent measured the force it takes to turn it - but its not trivial you can rotate it, but can t get it to "free spin" by hand. under test on vehicle, it will free spin with momentum on its side. no planned charging system on kart at this time. external charge and go. when batts dead, the fun is over. Last edited: Hmm.. I also wonder about the duty cycle of it and how it's going to heat up. I have a 110VDC motor that came off a variable speed conveyor belt, permanent magnet brush type with fan cooling.. We got it at an auction for$40 with the controller.. of course the 110V part may require an inverter which is a bit of a PITA.
Just for an idea of what's available, check out Baldor motors.. they make nearly anything

Yea- over 100VDC the options open up. My motor will likely overheat. I'll be monitoring. I saw another group /YouTube vid with guys using some sort of 100+ VDC MOTOR. their batt solution- a boat load of like makita cordless 36v batts. Looks like they had big parallel banks for amps, then likely hooked up 3 banks in series. I guess if you can find a bulk deal on those batts- not a bad option for power vs weight.

For what you're doing I think lead-acid is the way to go, at least to begin with.. a 3 phase motor would be ideal, but again it needs higher voltage. Perhaps if you ran a 1000W inverter to get the 120V and went back to DC would be the cheapest way to get going.. I'd look at pawn shops for that