Solving the Variable Ebrake-Throttle Problem

Electric Motors and Controllers

Solving the Variable Ebrake-Throttle Problem

Postby Kingfish » Mon Aug 13, 2012 4:24 pm

Preamble
Once upon a time, before spring of 2010 – Controllers from EBikes.CA had progressive regen, also known as Variable Ebrake. After that time these controllers were no longer available anywhere on the market. :cry:

Traditional operation was as follows:
  • Throttle-only, no ebrake -> works just like a throttle should.
  • Ebrake depressed, no throttle -> low amount of braking force
  • Ebrake depressed, full-throttle -> maximum electric braking
Note: Some of us (including me) found a middle-point with half-throttle, though most of the time it was either low or high depending on the throttle type.

Mission
The aim of this thread seeks to restore what once was: Give us back our variable ebrake capability!
<cue pastoral anthem with lots of French horns>

An Idea :idea:
I have a dream! <whoa that’s heavy!>
It’s a tiny dream <that’s better>

The way to solve the problem is two-fold:
  1. First we investigate how to adapt present common ebike controllers to trick them into providing variable ebrake,
  2. and second – come up with a clever circuit that we can spoon in.
I’ve spent some time with the first part and here’s my theory:

Using “Hyena’s parallel resistor calculator for LVC and high voltage regen mod” spreadsheet, I was able to extrapolate an interesting fix to the problem. Depending on which controller you have, most depend upon modifying the value of R12 with a piggyback resistor and some tinkering with two parameters in the Firmware configuration to fake LVC and HVC.

I figured out that for my own system I could do this with a 5k POT parallel to R12; when the POT is at Zero, Ebrake will be maximum, and conversely when at 5k Ohms, Ebrake will be the softest – but not below the preset HVC in the firmware.

Presuming we run without any ebraking effects, LVC should be set to match this condition – however we don’t care that it goes all wonky when ebraking is maximum. With my conditions (15S/63V LiPo using a 100V-capable controller),
  • No Ebrake: R12 @ +5k Ohms, LVC = 49.5, HVC = 64.9
  • Max Ebrake: R12 @ +0 Ohms, LVC = 75.5, HVC = 98.9
This is theory; in the real world maybe we dial these values in a bit – but you get the idea. If we can change the value of R12 on the fly this might work without rebooting the controller.

The next part of the problem is how to intercept The Throttle and use it like a tool. My thought is that the Throttle always has power, it always has a value – it’s wired that way! The controller through some internal application programming decides to ignore (or cut off) the Throttle signal inside the chip, but we can still read the value even if the MCU doesn’t care. All we have to do is trigger our variable R12-mod to react when –EBS goes from +5V to GND and maybe with a few milliseconds of delay. :wink:

As the throttle is increased, the resistance at R12 drops – and there we have it, Throttle-controlled variable ebraking! :mrgreen:

Now for the part that I’m weakest on… Circuit Design. I know how to do this with hardware, and it crossed my mind ever so briefly to employ a mechanical device that spins the POT relative to the throttle and… hand me another beer, let’s think of something better. :roll: Perhaps a passively sensing circuit could read when –EBS goes to GND and that one could read Throttle without a lot of loss. In the most primitive, we’d have High Ebrake and Low – though it would be quite novel to have several point in-between wouldn’t you think? A voltage-controlled resistor circuit albeit in reverse.

When –EBS goes High (+5V), then obviously we’d return R12 to max ohms and Throttle would be a throttle again with no delay.

Anyway – that’s my dog & pony to a solution. Actually, I thought it would be really nifty to just remove R12 altogether and a hack mini-board would tap right in-between, and borrowing some from the +5V bus as well.

Does this make sense, or am I way out in left field… ?

Missing my variable electric brake, KF
* My 2WD Garden Wall
* Kinaye MotorSports
* Primary ride: 2WD Disc 9C 2806-equiv / Dual Lyen 12FET / 20S7P LiPo.
* Epics: Going to California: 2011 8)
* 50-mph, 101, 10k-Club. 12,527 miles-to-date, 7037 as 2WD.

It is by caffeine alone I set my mind in motion.
It is by the beans of Java that thoughts acquire speed.
The hands acquire shakes, the shakes become a warning.
It is by caffeine alone I set my mind in motion.
User avatar
Kingfish
10 GW
10 GW
 
Posts: 4274
Joined: Wed Feb 03, 2010 11:23 am
Location: Redmond, WA-USA, Earth, Sol, Orion–Cygnus Arm, Milky Way. Age: > yesterday < tomorrow

Re: Solving the Variable Ebrake-Throttle Problem

Postby John in CR » Mon Aug 13, 2012 8:16 pm

I thought regen was just triggered by an on/off switch and the R12 only affected the voltage of the HVC for regen and other voltage related stuff like LVC. ie the R12 mod fools the controller into thinking the voltage is different from actual, much like we fool the controller brain about current with our shunt mods.

If that's true, for variable regen don't we need something to turn regen on an off quickly so the width of the ON pulses determines regen force?

FWIW, I bought a used scooter controller that when you activated regen the braking force was light, and if you turned the throttle at the same time the regen force got stronger but not variably stronger. Personally I didn't like the throttle being involved. It wasn't natural. Maybe I just didn't get enough time with it before blowing the controller.

Once I get my controller pairs set up just how I want for my 6 phase motors I'll get to have 3 regen forces. I'll set the regen force different for the 2 controllers. Then the lightest braking force will be triggering the lower set controller. The next level will be regen with only the other controller, and the max force will be having both triggered. I'll accomplish this with one connected to the normal e-brake handle, and the other to a momentary thumb button switch (a horn button). I've already done it, though not yet with the different settings, and with the thumb button mounted well under the handlebar so your thumb stays wrapped under the handlebar, it feels natural and ergonomic to operate either or both.

John
John in CR
100 GW
100 GW
 
Posts: 13682
Joined: Tue May 20, 2008 12:58 am
Location: Paradise

Re: Solving the Variable Ebrake-Throttle Problem

Postby Cowardlyduck » Mon Aug 13, 2012 8:49 pm

Love this idea as I've been thinking of increasing my Regen braking force recently anyway, but have no idea how to do it.

Assuming it gets figured out, would a mod like this work on an 18Fet Crystalyte controller? I think that's what my Stealth Fighter has.

Cheers
Stealth Fighter/Bomber - Clamping torque blocks Only 7 Left!

High Power LiPo wiring harnesses - 4x parallel XT90, HXT4mm, 5.5mm. Up to 4X series links - 200Amp+ capable.
Global shipping.

My Rides:
Modified Stealth Fighter - Force air cooled Leaf motor @ 5KW, Heat-sinked Adaptto Mini-E. Battery = 20AH, 72V LiPo.
Cowardlyducks - Stealth Fighter Videos

BikeE recumbent commuter - Golden motor, 6Fet Infineon, 20AH 12S LiPo, with on-board solar charging.
User avatar
Cowardlyduck
10 MW
10 MW
 
Posts: 2173
Joined: Sun Jun 26, 2011 8:41 pm
Location: Canberra, ACT, Australia

Re: Solving the Variable Ebrake-Throttle Problem

Postby John in CR » Mon Aug 13, 2012 9:36 pm

I almost forgot, I did think of a way to do variable regen, but only increase it from the programmed setting. Regen force is controlled by a current limit. If you make the controller brain think current is different from actual, then you change the force. eg On my cargo bike regen on the max program setting was too soft. I reduced shunt resistance and increased the current limit of regen by fooling it. There's a more elegant way to do the same thing as BigMoose pointed out in a shunt mod thread in technical.

That's by interrupting the trace from the shunt to the MCU, and installing a tunable bypass so the MCU sees a different voltage drop across the shunt. We were doing it to change forward current, but the same thing can be done to change regen current. That stuff is so small I'm afraid to try it myself. http://endless-sphere.com/forums/viewtopic.php?f=2&t=31643&p=458366&hilit=controlled+shunt+modification#p494749

You'd just have to be careful to have your brake switch activate the bypass, to change only the regen current limit.

I can't believe we don't already have this both for regen and to have changeable current limits on the fly, maybe even tied to the throttle some way for a better throttle.

John
John in CR
100 GW
100 GW
 
Posts: 13682
Joined: Tue May 20, 2008 12:58 am
Location: Paradise

Re: Solving the Variable Ebrake-Throttle Problem

Postby Kingfish » Mon Aug 13, 2012 11:31 pm

Upon reflection <and some pints>, I came up with this schematic which might better explain the concept. Take note that I am NOT an EE, however I’ve been doing the bidding of EEs for a great long time and have designed circuit boards in times of yore… meaning your ancient history.

Allow me to explain with more detail:

Image

D1 & Q1 are tied together as an Opto-Isolator; didn’t know how to draw it in Visio (which sucks BTW except for developing crude schematics)
  • The Delay Filter is right out from my arse; I have no idea what I’m doing but I’ll explain uno momento…
The chief victims of my designs are Q2 and R12-A/B:

Since we are replacing R12, there’s no need to worry about piggyback et al. We’re gonna do this in series man!
  • R12-A represents the basic max regen situation; make it what you want to fit yer system albeit 1k or 2k… I don’t care. It could even be a 5k trim POT.
  • R12-B and Q2 are the business end:
    • User presses Ebrake, D1-Q1 activate and turn Q1 = ON.
    • Voltage flows through Q1 from the Throttle to the Base of Q2 which reacts in an analog manner.
    • The function of Q2 is to variably short R12-B which is the 5K (or whatever) hardware padding that drives the low & soft ebrake voltage. When Throttle is low, the short barely exists (or not at all with good refined circuitry).
    • If the ebrake is still enabled, and the user hits WOT :twisted: the short across R12-B is complete and we have maximum regen capability.
The Delay Filter is design purposefully to slowly rise upon charge, but discharge quickly. I have no f*king clue what I’m doing here cos I’m not an EE, but it’s the best that I can imagine. But dammit, I’d rather try and take heat… instead of naught. :wink:

I cannot for the life of me spec these parts; I’m a knucklehead, a bloody wrench-turner with some dangerous experience having to do with raising & lowering rods on fission reactors, but I digress. The truth is, I just want to see the mofo work! It came to me whilst having a cup o’ joe… not a particular cup mine you… but dammit it to hell, it seems pretty dang basic. The only hiccup I can fathom is that the Controller might have a conniption with a dynamic R12 value. :?

In conclusion... Life is short. We can waste our Life away or be wasted all our Life. Wait-a-minute, not’s not what I meant… As Yoda said, “Do! Or do not. There is no try.

I elect to Do, and make a difference. It could be possible, I just need a wee bit of hand-holding by some folks that are brighter than me. :D

Thanks for listening, KF
I bet the mod could fit on a 1x1 inch breadboard using simple discretes! :)
* My 2WD Garden Wall
* Kinaye MotorSports
* Primary ride: 2WD Disc 9C 2806-equiv / Dual Lyen 12FET / 20S7P LiPo.
* Epics: Going to California: 2011 8)
* 50-mph, 101, 10k-Club. 12,527 miles-to-date, 7037 as 2WD.

It is by caffeine alone I set my mind in motion.
It is by the beans of Java that thoughts acquire speed.
The hands acquire shakes, the shakes become a warning.
It is by caffeine alone I set my mind in motion.
User avatar
Kingfish
10 GW
10 GW
 
Posts: 4274
Joined: Wed Feb 03, 2010 11:23 am
Location: Redmond, WA-USA, Earth, Sol, Orion–Cygnus Arm, Milky Way. Age: > yesterday < tomorrow

Re: Solving the Variable Ebrake-Throttle Problem

Postby John in CR » Tue Aug 14, 2012 12:34 am

KF,

Unless I'm way off, changing R12 doesn't change regen force. It only changes the voltage cutoff of regen. To change regen force without the controller already having the ability to do so, you have to either change regen's current limit, or turn regen on and off fast enough that you can't tell it's switching and vary the width of those ON pulses to change the force.
John in CR
100 GW
100 GW
 
Posts: 13682
Joined: Tue May 20, 2008 12:58 am
Location: Paradise

Re: Solving the Variable Ebrake-Throttle Problem

Postby Kingfish » Tue Aug 14, 2012 10:00 am

John, the link to using a Shunt mod to affect Regen (and braking) is interesting and one way to solve the problem by using Current. The method I suggest uses Voltage Limits. We’re chasing the same tiger to reach similar conclusions are we not? :)

It could be that your way is simpler and easier: I don’t know. I did not plan to mod the Shunts on my controllers cos I do not have current-limitation issues. My present R12 setting provides awesome – if not really hard braking force. I just want to feather it out, particularly when both wheels go to brake. Make sense?

Also, I am intrigued with having variable ebraking through the brake lever, though I figured before I could run I must first learn to walk, and the resolving Throttle implementation is low hanging fruit:
  • No need to worry about hardware cos it’s already in place
  • And that the signals are right there on the PCB and easily accessed.
We could say the same for the Shunt mod could we not? :)

I have to try to see if the variable R12 mod works. The static implementation increased my braking power when I moved from 36V to 63V; that can’t be argued. The challenge now is to change it on the fly and see what happens.

I’m on the hunt now for some simulation software; back in the day I used OrCAD, though I see now LTSpice is available so I’ll give that a shot. Or, some clever EE could gently nudge me in the correct direction… I only ask.

One foot in front of the other, KF
* My 2WD Garden Wall
* Kinaye MotorSports
* Primary ride: 2WD Disc 9C 2806-equiv / Dual Lyen 12FET / 20S7P LiPo.
* Epics: Going to California: 2011 8)
* 50-mph, 101, 10k-Club. 12,527 miles-to-date, 7037 as 2WD.

It is by caffeine alone I set my mind in motion.
It is by the beans of Java that thoughts acquire speed.
The hands acquire shakes, the shakes become a warning.
It is by caffeine alone I set my mind in motion.
User avatar
Kingfish
10 GW
10 GW
 
Posts: 4274
Joined: Wed Feb 03, 2010 11:23 am
Location: Redmond, WA-USA, Earth, Sol, Orion–Cygnus Arm, Milky Way. Age: > yesterday < tomorrow

Re: Solving the Variable Ebrake-Throttle Problem

Postby whatever » Tue Aug 14, 2012 10:31 am

dont the xie cheng controllers have variable ebrake as an option anyway?
whatever
100 kW
100 kW
 
Posts: 1129
Joined: Thu Jun 03, 2010 2:16 am

Re: Solving the Variable Ebrake-Throttle Problem

Postby John in CR » Tue Aug 14, 2012 10:48 am

Kingfish wrote:I have to try to see if the variable R12 mod works. The static implementation increased my braking power when I moved from 36V to 63V; that can’t be argued. The challenge now is to change it on the fly and see what happens.


I'm not sure how you think changing the voltage cutoff limit will change anything other than turn regen off if you turn it lower than the pack voltage. Of course you got more braking power when you changed pack voltage, the current limit stayed the same and the voltage increased to the new pack voltage. The power going into the battery is what you have to work with plus heat losses equals the braking force at the wheel. Voltage isn't variable because it's pack voltage, so like I said before your choices are to change the current by changing the current limit or to weaken the braking force using PWM on the signal that turns regen on. Changing R12 affects a voltage limit, not actual voltage. The pack determines the voltage.

If you want the current control on the brake handle you add a separate pot to the brake handle retaining the existing switch.

John
John in CR
100 GW
100 GW
 
Posts: 13682
Joined: Tue May 20, 2008 12:58 am
Location: Paradise

Re: Solving the Variable Ebrake-Throttle Problem

Postby Njay » Tue Aug 14, 2012 10:58 am

Sorry I don't know anything about the application, what are these -EBS+5V and ThrottleSense signals? Where do they come from?
Njay
10 kW
10 kW
 
Posts: 840
Joined: Thu Sep 09, 2010 10:43 am
Location: Portugal

Re: Solving the Variable Ebrake-Throttle Problem

Postby Kingfish » Tue Aug 14, 2012 11:30 am

Njay wrote:Sorry I don't know anything about the application, what are these -EBS+5V and ThrottleSense signals? Where do they come from?

Hi Njay :)

The EBrake Signal
-EBS (held at +5V) is the trigger for Ebrake. When pulled to GND by virtue of a switch (in my case a lever switch on the handlebar hand brake) this causes the MCU to ignore the Throttle and instead create an electric brake that produces reverse current, or Regen as we call it.

D1 is a Blocking Diode; I have 2WD, and I share Ebrake, 3-Way, and Throttle between the controllers. When Ebrake is depressed, one controller reacts, however the +5V signal reverses up the 2nd controller and disables the ebrake, so if both controllers have an inline diode, this prevents reverse current, and both motors will brake. I got the idea from Lyen.

It also could be that –EBS is replaced with +12V, and it is tied into –EBS after the blocking diode though before the Switch (not indicated on the schematic; I just show -EBS already shorted to GND). Inline between the diode and +12V could be just Q1 (type unknown cos I don’t know… yet). I got the idea for +12V from Jeremy when we discussed how to implement a Brake Light off of the –EBS circuit: When brake switch is shorted to GND, it pulls –EBS and +12V to GND, causing the inline brake light (presume LED) to illuminate.

Regardless, when braking, we want –EBS to go to GND. That is key to the whole enchilada cos it disables Throttle signal to the MCU.

The Throttle Sense
Throttle can either be a HE device or Resistor. Regardless, it has a +5V supply and GND on the other. Signal from Throttle is naturally a subset, and generally between 2 to 4.5V (lots of posts on the subject, mainly due to the twitchy nature and “holes” in the range but I digress).

The idea is when Ebrake (-EBS) goes to GND, we lurk on the value of the Throttle output and use that to drive an analog-short around R12-B. That’s it.

The Delay Filter is plain ol’ gravy. Low priority, but a nice to have.

In other news, I have LTSpice up and running. Learning quickly by example, though I need to study up on transistors…

Time for another cup of Joe :)
Blazing in caffeination, KF
* My 2WD Garden Wall
* Kinaye MotorSports
* Primary ride: 2WD Disc 9C 2806-equiv / Dual Lyen 12FET / 20S7P LiPo.
* Epics: Going to California: 2011 8)
* 50-mph, 101, 10k-Club. 12,527 miles-to-date, 7037 as 2WD.

It is by caffeine alone I set my mind in motion.
It is by the beans of Java that thoughts acquire speed.
The hands acquire shakes, the shakes become a warning.
It is by caffeine alone I set my mind in motion.
User avatar
Kingfish
10 GW
10 GW
 
Posts: 4274
Joined: Wed Feb 03, 2010 11:23 am
Location: Redmond, WA-USA, Earth, Sol, Orion–Cygnus Arm, Milky Way. Age: > yesterday < tomorrow

Re: Solving the Variable Ebrake-Throttle Problem

Postby Njay » Tue Aug 14, 2012 12:38 pm

In light of current info I don't see why you must actually have the ~EBS enabling/disabling the "throttle influence" on ebreak level control to the MCU, since looks like the controller only looks at this input if the ~EBS is active (to GND), so maybe you could just simplify that control and just leave the throttle always also connected to Q2.

Then, Q2 is a bipolar transistor, meaning it is actually current controlled (you would need a base resistor too). It needs to take some current from the throttle line to work, and this can influence the actual throttle output voltage (meaning the controller will see throttle change). I would probably use a FET, like a BS170, which is a low power FET that looks like a 2N3904. The FET will take almost no current into its gate (just a tiny amount on change) and it behaves like a resistor between its S and D pins, in parallel with R12-B. The value of this resistor depends on the gate's voltage (you can check that easily on BS170's datasheet), which comes from the throttle control, but at 5V it will be like a couple of Ohm, effectively looking like a short to R12-B.
I would still add a series gate resistor should be used to slow gate charging current and another one high value to ground to make sure it is OFF while not being driven. More refinement can be done, maybe some ESD protection since these FETs are reported by some to be very sensitive to it.
Njay
10 kW
10 kW
 
Posts: 840
Joined: Thu Sep 09, 2010 10:43 am
Location: Portugal

Re: Solving the Variable Ebrake-Throttle Problem

Postby Kingfish » Tue Aug 14, 2012 2:11 pm

Hi Njay :)

Thank you for the feedback! I understand some of your parlance, though not all – please forgive my noobnessness. Using your thoughts, below is the latest version of the Schematic as drawn up in LTSpice. I am having a problem with the simulation accepting the SPICE Directive for the BS170. What am I missing?

Image

    THROTTLE = a variable Resistor (presuming 5K) though we can make it anything on the fly.
    SP = Throttle Input to the MCU
    UV = the R12 Input for HVC & LVC.
    V1 = Battery @ 15S/63VDC
    V2 = the +5V Rail.
    R12-A = Original Value
    R12-B = the softer kinder braking effect
    R100 = Series Gate Resistor?? Not quite sure I understand.
    R101 = "one high value to ground to make sure it is OFF while not being driven". Again, not sure I have this in the correct spot.

Any help is greatly appreciated.
Best, KF
* My 2WD Garden Wall
* Kinaye MotorSports
* Primary ride: 2WD Disc 9C 2806-equiv / Dual Lyen 12FET / 20S7P LiPo.
* Epics: Going to California: 2011 8)
* 50-mph, 101, 10k-Club. 12,527 miles-to-date, 7037 as 2WD.

It is by caffeine alone I set my mind in motion.
It is by the beans of Java that thoughts acquire speed.
The hands acquire shakes, the shakes become a warning.
It is by caffeine alone I set my mind in motion.
User avatar
Kingfish
10 GW
10 GW
 
Posts: 4274
Joined: Wed Feb 03, 2010 11:23 am
Location: Redmond, WA-USA, Earth, Sol, Orion–Cygnus Arm, Milky Way. Age: > yesterday < tomorrow

Re: Solving the Variable Ebrake-Throttle Problem

Postby Njay » Tue Aug 14, 2012 3:20 pm

Kingfish wrote:Using your thoughts, below is the latest version of the Schematic as drawn up in LTSpice.

Looking good :D!

Kingfish wrote:I am having a problem with the simulation accepting the SPICE Directive for the BS170. What am I missing?

Good question, I don't know. I never or very rarely use subcircuit directives, I really don't know, you'll have to dig a bit on that one. Did you use the spice directive command? The spice directive and the text commands are very similar and next to each other.

Kingfish wrote:R100 = Series Gate Resistor?? Not quite sure I understand.

Instead of connecting the gate directly to the SP node, you do it with a resistor in between (let's say 10K to start). Keep the resistor to GND next to the gate.

Your R100 is actually in the place of R101 as per your description. R101 should be removed.

"1m" is actually "1 mili" and not "1 mega" in SPICE. For MEGA you need to use "meg".

Kingfish wrote:R101 = "one high value to ground to make sure it is OFF while not being driven". Again, not sure I have this in the correct spot.

1 Meg seems fine to start, eventually it could be reduced. Anyways, for the simulation is not important.
Njay
10 kW
10 kW
 
Posts: 840
Joined: Thu Sep 09, 2010 10:43 am
Location: Portugal

Re: Solving the Variable Ebrake-Throttle Problem

Postby Kingfish » Tue Aug 14, 2012 4:08 pm

Gotcha :)

OK, slight update:
Dropped R101, and moved R100/changed value to 10K.

Image

I have tried countless ways to add a Directive but there is no clear definitive method to invoke the script. I fear that the “library” could be incompatible with this version of LTSpice. Very frustrating. :cry:

I've decided to upload the Spice file; maybe someone can make sense of it. OrCAD was so much simplier to work with way back in the day. :roll:

R12-Mod1.zip
LTSpice R12-Mod Version 1
(790 Bytes) Downloaded 59 times

This version has the SPICE Directive embedded. :idea:

whoo boy, bushed out. So close and yet so far away! Who'd have thunk adding a mosfet could be so difficult.
Reading quickly... KF
* My 2WD Garden Wall
* Kinaye MotorSports
* Primary ride: 2WD Disc 9C 2806-equiv / Dual Lyen 12FET / 20S7P LiPo.
* Epics: Going to California: 2011 8)
* 50-mph, 101, 10k-Club. 12,527 miles-to-date, 7037 as 2WD.

It is by caffeine alone I set my mind in motion.
It is by the beans of Java that thoughts acquire speed.
The hands acquire shakes, the shakes become a warning.
It is by caffeine alone I set my mind in motion.
User avatar
Kingfish
10 GW
10 GW
 
Posts: 4274
Joined: Wed Feb 03, 2010 11:23 am
Location: Redmond, WA-USA, Earth, Sol, Orion–Cygnus Arm, Milky Way. Age: > yesterday < tomorrow

Re: Solving the Variable Ebrake-Throttle Problem

Postby Kingfish » Tue Aug 14, 2012 4:14 pm

Also, this link has the SPICE Directive listed at the bottom of the spec sheet: BS170 Datasheet (pdf)

I have noted that it is slightly different than what is given in the Zetec Lib located here (152kb ASCII format). This one has parameters that cause errors in the current version of LTSpice.

I might try using the first item (pdf) directive next.

ADDENDUM: Here's the Directive from the PDF...
Spice people: What am I doing wrong? :cry:
Code: Select all
.SUBCKT BS170 1 2 3
* 1=drain  2=gate  3=source
Cgs  2 3 12.3E-12
Cgd1 2 4 27.4E-12
Cgd2 1 4 6E-12
M1 1 2 3 3 MOST1
M2 4 2 1 3 MOST2
D1 3 1 Dbody
.MODEL MOST1 NMOS(Level=3 Kp=20.78u W=9.7m L=2u Rs=20m Vto=2 Rd=1.186)
.MODEL MOST2 NMOS(VTO=-4.73 Kp=20.78u W=9.7m L=2u Rs=20m)
.MODEL Dbody D(Is=125f N=1.023 Rs=1.281 Ikf=18.01 Cjo=46.3p M=.3423
+            Vj=.4519 Bv=60 Ibv=10u Tt=161.6n)
.ENDS


Onward through the fog, KF
* My 2WD Garden Wall
* Kinaye MotorSports
* Primary ride: 2WD Disc 9C 2806-equiv / Dual Lyen 12FET / 20S7P LiPo.
* Epics: Going to California: 2011 8)
* 50-mph, 101, 10k-Club. 12,527 miles-to-date, 7037 as 2WD.

It is by caffeine alone I set my mind in motion.
It is by the beans of Java that thoughts acquire speed.
The hands acquire shakes, the shakes become a warning.
It is by caffeine alone I set my mind in motion.
User avatar
Kingfish
10 GW
10 GW
 
Posts: 4274
Joined: Wed Feb 03, 2010 11:23 am
Location: Redmond, WA-USA, Earth, Sol, Orion–Cygnus Arm, Milky Way. Age: > yesterday < tomorrow

Re: Solving the Variable Ebrake-Throttle Problem

Postby John in CR » Tue Aug 14, 2012 5:11 pm

KF,

If this is for your 2wd rig and at least one of the controllers is programmable, then I can give you a super easy way to enjoy 3 levels of regen braking force. Let me know when you get tired of the fog and I'll be more than happy to post it.

John
John in CR
100 GW
100 GW
 
Posts: 13682
Joined: Tue May 20, 2008 12:58 am
Location: Paradise

Re: Solving the Variable Ebrake-Throttle Problem

Postby Kingfish » Tue Aug 14, 2012 5:27 pm

John in CR wrote:KF,

If this is for your 2wd rig and at least one of the controllers is programmable, then I can give you a super easy way to enjoy 3 levels of regen braking force. Let me know when you get tired of the fog and I'll be more than happy to post it.

John

Yes yes, but I want to feather control it like any normal braking :)
Can your mod do that?

Thick in the Tules, KF
* My 2WD Garden Wall
* Kinaye MotorSports
* Primary ride: 2WD Disc 9C 2806-equiv / Dual Lyen 12FET / 20S7P LiPo.
* Epics: Going to California: 2011 8)
* 50-mph, 101, 10k-Club. 12,527 miles-to-date, 7037 as 2WD.

It is by caffeine alone I set my mind in motion.
It is by the beans of Java that thoughts acquire speed.
The hands acquire shakes, the shakes become a warning.
It is by caffeine alone I set my mind in motion.
User avatar
Kingfish
10 GW
10 GW
 
Posts: 4274
Joined: Wed Feb 03, 2010 11:23 am
Location: Redmond, WA-USA, Earth, Sol, Orion–Cygnus Arm, Milky Way. Age: > yesterday < tomorrow

Re: Solving the Variable Ebrake-Throttle Problem

Postby Kingfish » Tue Aug 14, 2012 6:15 pm

OK, after I downloaded the THIRD spice program I got the SPICE Directive to work. What a mofo this was:
  • OrCAD has a (FREE) Student Version of Spice, but it is so entrenched with scamware that I shivered to test it. Took two times before it would come down correctly – and then yer hamstrung without libraries or features; don’t waste your time with it!!!
  • The version that finally worked is called 5Spice and it is rather clumsy to work with as well – however, I was able to save the Directive script (exactly as I posted in the CODE window previously) as an ASCII file with the extension .LIB under the /Library directory, rebuilt the Index under the” Tools” menu, and whallah! No errors! :mrgreen: Selected “Analyze”… some minor connection point errors that took like one minute to fix, then Analyze again -> and I could click on a wire or TP to get the voltage relative to GND.


Image

Clunky interface though. It’s as bad as FEMM. No “Move” or “Drag”; got to cut & paste. Also the unregistered version sticks you with an A-Sized drawing area. WTF? And if you C&P outside of the dinky page border the application barfs and clips yer work. So much negative attitude with this exe, but it’s free so I shouldn’t complain too loudly. At least it F.Works!

I’m back at creating again… :)
Out of the tules and into the big blue sky, KF
* My 2WD Garden Wall
* Kinaye MotorSports
* Primary ride: 2WD Disc 9C 2806-equiv / Dual Lyen 12FET / 20S7P LiPo.
* Epics: Going to California: 2011 8)
* 50-mph, 101, 10k-Club. 12,527 miles-to-date, 7037 as 2WD.

It is by caffeine alone I set my mind in motion.
It is by the beans of Java that thoughts acquire speed.
The hands acquire shakes, the shakes become a warning.
It is by caffeine alone I set my mind in motion.
User avatar
Kingfish
10 GW
10 GW
 
Posts: 4274
Joined: Wed Feb 03, 2010 11:23 am
Location: Redmond, WA-USA, Earth, Sol, Orion–Cygnus Arm, Milky Way. Age: > yesterday < tomorrow

Re: Solving the Variable Ebrake-Throttle Problem

Postby Njay » Tue Aug 14, 2012 6:57 pm

I checked how I added components. It's actually easy, but I do it so rarely I just keep forgetting. See attached file with instructions and working LTSpice file.

Hint: You can use the "voltage" component (check advanced properties) to simulate a variable voltage (throttle throttle).

Oh yeah, creating just rocks :)

...
Attachments
R12Mod-2.zip
See readme.txt
(1.65 KiB) Downloaded 26 times
Njay
10 kW
10 kW
 
Posts: 840
Joined: Thu Sep 09, 2010 10:43 am
Location: Portugal

Re: Solving the Variable Ebrake-Throttle Problem

Postby Kingfish » Tue Aug 14, 2012 9:39 pm

OK, here’s my final report for this evening:

Thanks to Njay, we have the Directive correctly loading up U1 as BS170 in the LTSpice application. :mrgreen:

I ran through my theoretical values and then the actual (simulated) implementation. Some quirks had to be ironed out – although the sim looks quite promising with one large caveat: We don’t know if it will work in realtime. :|

Here’s the dope:
  • The Schematic was slightly reworked; R12 is now split between three resistors; it’s still a voltage divider but I added a trim resistor for fine-tuning.
  • R100 & R101 become a voltage divider that takes care of a pesky problem with proper Gate Voltage. It turns out that the Gate of U1 activates at about 1.9V, so when Throttle is at 0%/5K Ohms, SP will read about 3.33V which is too high for U1 to shut off… hence the divider. I don’t know enough about circuit design to say where it is a good design, but I managed through it.
  • When Throttle is at 100%/1 Ohm (can’t use Zero with the simulation), then SP climbs nearly to 5V. That's fine.

Image

We now have control over UV:
  • When Throttle is 100%, U1 bypasses R12-C. R12-A & B control the upper end for a theoretical hard braking experience by driving UV down, and R12-A is especially important to ensure we don’t go too low and wipe out the Phase-switching FETs.
  • Conversely, when Throttle is at 0% the R100 & 101 Voltage Divider drops the Gate voltage below the threshold and cuts off U1 with some small leakage (I think). R12-C controls the high end of UV for a nice soft landing.
I do not know how to use the Advanced settings and create a slope of the UV voltage, so I can’t tell if it is linear or has other oddities. But the simulation does what I want. And more importantly, the parts will likely be close to $5 USD total, not counting the breadboard. :D

There’s still one other sticky wicket and it goes back to the original design: I hate to leave this circuit enabled during normal throttling, and I still prefer to have it engage only when –EBS goes to GND. But one thing at a time. First we have to bring the child to fruition and see if the concept of changing R12 dynamically in situ really does work!

My hat is off to Njay for his help; without him I would have been lost. <nods> :wink:
Until tomorrow, KF

PS - I just went back and reworked values on R100 & 101 using 19.6K & 24K Ohms respectively; I fear too high of value would slow the Gate charge too much, but I defer to the ES EE graybeards for the final say.
* My 2WD Garden Wall
* Kinaye MotorSports
* Primary ride: 2WD Disc 9C 2806-equiv / Dual Lyen 12FET / 20S7P LiPo.
* Epics: Going to California: 2011 8)
* 50-mph, 101, 10k-Club. 12,527 miles-to-date, 7037 as 2WD.

It is by caffeine alone I set my mind in motion.
It is by the beans of Java that thoughts acquire speed.
The hands acquire shakes, the shakes become a warning.
It is by caffeine alone I set my mind in motion.
User avatar
Kingfish
10 GW
10 GW
 
Posts: 4274
Joined: Wed Feb 03, 2010 11:23 am
Location: Redmond, WA-USA, Earth, Sol, Orion–Cygnus Arm, Milky Way. Age: > yesterday < tomorrow

Re: Solving the Variable Ebrake-Throttle Problem

Postby John in CR » Tue Aug 14, 2012 11:52 pm

Kingfish wrote:
John in CR wrote:KF,

If this is for your 2wd rig and at least one of the controllers is programmable, then I can give you a super easy way to enjoy 3 levels of regen braking force. Let me know when you get tired of the fog and I'll be more than happy to post it.

John

Yes yes, but I want to feather control it like any normal braking :)
Can your mod do that?


No, just the 3 steps, but I'm pretty sure yours can't change braking force at all. Force is determined by regen current and pack voltage, not phantom voltage. Think about it. Force is real. Pack voltage is real and fixed. Only changing the current limit can change the force without PWMing the on/off switch. Going up in actual pack voltage is what changed your regen force before. The R12 mod only enabled the switch to work at the new voltage. Which part do you think I'm missing?

John
John in CR
100 GW
100 GW
 
Posts: 13682
Joined: Tue May 20, 2008 12:58 am
Location: Paradise

Re: Solving the Variable Ebrake-Throttle Problem

Postby Kingfish » Wed Aug 15, 2012 1:01 am

An unpowered spinning hub motor – cruising along or heading downhill creates both current and voltage (natch). The controller lobs off what it can’t use with HVC and with the shunts. However – I have already stated that I’m not current-blocked; I’m not even using 50% of Current (I) capacity by design; I don’t need to go down that path. Voltage is what limits my speed. My controller is capable of providing up to 100 volts before the FETS will likely go. We set HVC to safely limit that amount, and it is the differential between peak motor voltage and the pack voltage (and current) that presents the braking force.

I don’t see that as a great mystery. There is no phantom voltage; it’s quite real and I aim to use it in reverse because I’m already using it whole-hog! I am already at max-regen force; I simply want to feather it out so I’m not jarred out of my seat when I hit the brake. And that’s what we’re doing here today: Not increasing Regen, but reducing it dynamically – that’s what this circuit is going to do! :D

So it’s to my benefit to investigate; I have nothing to lose and everything to gain by trying.

Come on, be optimistic! :D
I genuflect and toast in your general direction, KF
* My 2WD Garden Wall
* Kinaye MotorSports
* Primary ride: 2WD Disc 9C 2806-equiv / Dual Lyen 12FET / 20S7P LiPo.
* Epics: Going to California: 2011 8)
* 50-mph, 101, 10k-Club. 12,527 miles-to-date, 7037 as 2WD.

It is by caffeine alone I set my mind in motion.
It is by the beans of Java that thoughts acquire speed.
The hands acquire shakes, the shakes become a warning.
It is by caffeine alone I set my mind in motion.
User avatar
Kingfish
10 GW
10 GW
 
Posts: 4274
Joined: Wed Feb 03, 2010 11:23 am
Location: Redmond, WA-USA, Earth, Sol, Orion–Cygnus Arm, Milky Way. Age: > yesterday < tomorrow

Re: Solving the Variable Ebrake-Throttle Problem

Postby Arlo1 » Wed Aug 15, 2012 1:21 am

KF I realy dont see how this will make variable regen? Have you seen Bigmooses Scematic for on the fly current adjustments? Its a wire taped into the shunt at a pont closer to the other side and feeds though you 5k pot or what ever you want to use.

So here is how I would do it.
You pull the ebrake and the regen starts but at this time you have it start soft at a light pull on the ebrake.
In side the controller you have a relay that turns on and re-routs the shunt current mesuremnt for the controller it self though a 0-5k pot hooked to your brake lever and at a light pull its 5k and pulled all the way in is 0k which makes the ca think the current is low because the mesurement is across a smalled portion of the shunt.
So the wiper of the 5k pot runs to the shunt sense wire in the controller and the positive and negative are on oposite sides of the shunt wires. or one of them will only be part way across the shunt wires for a max current limit safety.
My Leaf motor controller build. http://endless-sphere.com/forums/viewto ... 27#p963227
My YSR build http://www.youtube.com/watch?v=BRo8r5g4NBg
RC and most types of Lithium batteries you MUST know your individual cell voltages charging and discharging.
Don't keep them were you cant afford smoke or fire!
Never above 4.2v never below 2.7v EVER!!!
HI power controller design. Game Changer
User avatar
Arlo1
100 GW
100 GW
 
Posts: 8337
Joined: Sun Apr 26, 2009 10:36 pm
Location: Nanaimo BC Canada

Re: Solving the Variable Ebrake-Throttle Problem

Postby amberwolf » Wed Aug 15, 2012 2:02 am

@Kingfish: I also don't see how it will change the regen force (current) by changing anything to do with the LVC or other voltage settings. All those will do is change the point at which it *can* activate, AFAICS.

(EDIT, added: I have reread your most recent post above, and I *think* I now understand what you want to do with it--I am just not sure that it works the way you want it to, for how the controller deals with the results of the change you propose. I hope it does work, because that would be very useful. I am tempted to try this with one of my controllers, but I presently only have one working one that does regen. :( ).

(continuation of original post below:)
While this might help being able to enable regen on a battery that is actually much higher voltage than what the controller is set to allow (presuming this mod lies to the controller about what battery voltage it actually has coming in vs. what it allows as a max regen voltage), I don't see how it would change the amount of current flow or the voltage at which it happens, which would increase or decrease the amount of regen braking force.

Now, if you were to PWM the ebrake input, then changing the duty cycle of that would change the regen level--but most ebrakes have a delay to turn on that is very very long relative to any kind of PWM you would want to be doing, making it nearly pointless to do it this way. You'd just have pulses of braking, which might be up to seconds apart depending on controller response time. If there is an RC filter in there on the brake input line causing the delay, it could be removed (or altered) to fix the problem, but I suspect it is typically in the MCU code instead.

PWMing the voltage level that allows regen to occur or not (LVC, etc.) might be more effective, assuming there are no delays in controller response to this action, and assuming it won't crash the MCU or cause other errors or poorly-chosen responses to the circumstance (as the controllers are not intended or designed to have these values changed while in operation).


John in CR wrote:That's by interrupting the trace from the shunt to the MCU, and installing a tunable bypass so the MCU sees a different voltage drop across the shunt. We were doing it to change forward current, but the same thing can be done to change regen current. That stuff is so small I'm afraid to try it myself. http://endless-sphere.com/forums/viewtopic.php?f=2&t=31643&p=458366&hilit=controlled+shunt+modification#p494749


From what I understand of the electronics involved in your suggestion, it *should* work.

I *think* that Kingfish's control circuit could be used to output to that shunt mod circuit, by replacing the add-on trimpot with a voltage-controlled resistor, and having the throttle control output from that circuit (or an analog hall sensor or pot on an ebrake handle, which would be my own preference, as it wouldn't need the extra stuff of KF's circuit, just a second sensor switch on the ebrake handle to engage the ebrake line on the controller at the first change of output of the analog sensor) feed into the VCR to change the reported current to the MCU, making the MCU think it is lower than it really is for harder ebraking, and returning it to normal as soon as braking ceases.

One would need to set up scaling for the braking-level sensor's output so that it does not change the reported current so much at full braking that the controller is damaged by the actual current that's flowing thru it.

Alternately, instead of a VCR, insert a separate op-amp in the path from the shunt output to the MCU (the point at which you'd be cutting the trace for the original mod anyway), and use the throttle (or analog brake sensor) as the voltage reference input to the op-amp, and the shunt voltage output as the voltage input to the op-amp, and then the output of the op-amp back to the circuit leading to the MCU.
User avatar
amberwolf
100 GW
100 GW
 
Posts: 22647
Joined: Mon Aug 17, 2009 6:43 am
Location: Phoenix, AZ, USA, Earth, Sol, Local Bubble, Orion Arm, Milky Way, Local Group

Next

Return to Motor Technology

Who is online

Users browsing this forum: dbar and 4 guests