Solving the Variable Ebrake-Throttle Problem

Update: Got the optocoupler to work with your opamps. I was able to figure out how to use just one. I'd still like to understand why two were used though for edification. The schematic is really messy. :lol:

This is a good time to take a break; I'll post it fresh in the morning. Many thanks Njay, and until then...

Amanhã, KF :D
 
Very good to see this topic being revisited. I am very interested because I feel regen with higher powered setups can present the danger of snapped axles.. at least from interesting ES news I've come across lately. Being able to lay on the brake to whichever desired amount of force could prolong the life of an axle (and me), especially in those situations where my regen force is too strong and I'm constantly letting on and off the brake. :mrgreen:
 
Kingfish said:
SP voltage set to emulate throttle – regardless of POT or HE type.
Yes. From your point of view, you only care about the voltage you're given. Nevertheless it needs internal resistance modeled because it's high, meaning that if you pull "much" current, the voltage will dip (sag) changing behaviour.

Kingfish said:
“base” is a 10K POT, presently at 2.8V. This sets our bottom of desiredUV.
Yes, but no, it doesn't set desiredUV's bottom. If you plot SP and desiredUV, they will cross at V(base), I don't know the exact transfer function, but there's one :). In a normal inverting amplifier base is 0V; here we're giving an offset.
Modeling "base" as a voltage source makes it much easier to set the voltage, easier than having a 5V voltage than a resistor divider.

Kingfish said:
R1 & R2 form a voltage divider which affects the voltage of UV
The inverting amplifier's gain is -R2/R1 (note the minus sign).

Kingfish said:
I see now how to correctly invert the signal, however I am at a loss to why we need the second OpAmp.
With the 1st one you have generated the voltage you want to see at UV. However, to force UV to be at that voltage you can't "impose" that voltage on UV; you have to do it indirectly by pulling a certain amount of current to GND from UV. The 2nd ampop does that job. This was the reasoning.
Now you say that you did it with just 1 ampop, I believe it, since the current needed to force UV into the desiredUV is rather small (less than 2mA if I recall) and the 1st ampop is probably able to easily force it upon the UV node. Nevertheless, a single chip package carries both ampops :).
 
Version 8

Njay: Understood; many thanks and handshakes – this is really nice works here and I greatly appreciate it! Let’s roll out the latest schematic… :D

Notes:
  • The component numbers have been reassigned.
  • This version replaces BS170 for the LM358 dual-OpAmp. It’s different circuitry, but as Njay pointed out I think it will make calibration to various battery voltages easier.
  • Some further modeling though is required to vet out different battery voltages.
  • The circuit below is set for 15S/63V with a 64-98V Regen hi/lo range when Throttle voltage (SP-OUT) is between 3 to 4V.

Spice-R12.Mod.V8A.png


There is a lot of room for Throttle adjustment:
  • Use R105 to set the light-braking force and where it begins at 0%-throttle.
  • Use R103 to set the pitch of the ramp towards hard braking when at WOT. This value can be decreased to bring the limit up sooner, or increased for wider range.
  • R103 and R105 have slight drift if setting individually, so they should be trimmed together.
ADDENDUM & EDIT: Restating the obvious, it is presumed that SP-OUT varies between systems and throttles, so it is best to measure the voltage of SP from the Throttle between 0% and 100% before applying the mod so we don't shoot through the FETs. :!:

Spice-R12.Mod.V8B.png


From the output of UV relative to SP-OUT, you can see that the starting braking force at 0%-throttle starts out nice and easy on the left - lending a feather touch (in theory) which is a nice artifact of the circuitry, and then pitches towards hard braking all the way to the end. 8)

Candidate Voltages:
If there are no more issues, I should like to investigate and begin compiling settings for various battery pack voltages when throttle is between 3 to 4 V. In terms of LiPo, the following values shall be considered:
  • 10S, 12S, 15S, 16S, 20S, 24S, 25S, 30S & 32S; generally between the 100 to 150V Phase FET voltage ranges. I’m just curious how the values will map out.

That's where we're at as of today. As said before, if there are no further issues I'll get started on a wire-wrap shortly.

<whew!> :D

Lil' bit of regen braking this week, and in the next will attempt to summit Mount Everest :lol:

'nother cup o' joe for me - and a pitcher of good beer for my friend Njay!
Cheers, KF
<slurp!>
 
Good, good :)

Kingfish said:
From the output of UV relative to SP-OUT, you can see that the starting braking force at 0%-throttle starts out nice and easy on the left - lending a feather touch (in theory) which is a nice artifact of the circuitry, and then pitches towards hard braking all the way to the end. 8)
This is because the ampop is reaching its output voltage upper limit. This limit is no less than 1.5V below its supply, and will vary from device to device (manufacturing differences); since we're feeding it with 5V, the limit is around 3.5V. This can (should?) be overcome by raising its supply voltage, to the available 12V.

Have your good cups o'joe, you've earn them :)
 
Njay: 12V supply -> Good point if needed :)

I ran through some Battery voltage numbers from 10S/42V all the way up to 40S/168V to check the circuit. In the case of the former - there isn't a need for R12 adjustment, and in the case of the latter I added a 750 Ohm resistor in parallel (giving LVC as 134V over 132V safe and HVC at 195V for a 200V FET). The UV results are exactly the same. Maybe someone can cross-check me. Otherwise - I think we can place an order for parts.

Parts List for V8
including costs from Digikey

Code:
--- Bill of Materials ---						
						
Ref.	Mfg.	Part No.	Description	Source	Cost	P/N
C1	--	--	capacitor, 1µF	Digikey	0.34	445-8410-ND
C2	--	--	capacitor, 1µF	Digikey	0.34	445-8410-ND
D1	OnSemi	1N4148	diode	Digikey	0.23	1N4148-TAPCT-ND
R8	--	--	resistor, 2.2K		0	
R9	--	--	resistor, 10K		0	
R10	--	--	resistor, 10K		0	
R11	--	--	resistor, 7.5K		0	
R12	--	--	resistor, 1.2K		0	
R36	--	--	resistor, 3.3K		0	
R101	--	--	resistor, 2K, 5%	Digikey	0.09	CF18JT2K00CT-ND
R102	--	--	resistor, 22K, 5%	Digikey	0.09	CF18JT22K0CT-ND
R103	--	--	resistor, 50K POT 10% 13t	Digikey	2.94	T63YB-50K-ND
R104	--	--	resistor, 100, 5%	Digikey	0.09	CF18JT100RCT-ND
R105	--	--	resistor, 10K POT 10% 13t	Digikey	2.94	T63YB-10K-ND
THROTTLE	--	--	resistor, 1, 10W		0	
U1	Lite-On Inc	4N25	OptoIsolator	Digikey	0.5	160-1300-5-ND
U2-A	TI	LM358/NS	IC OpAmp 2-circuit	Digikey	0.55	296-1014-1-ND
U2-B	(unknown)	LM358/NS	(unknown 3rd party model)		0	
						
Subtotal					8.11	
PCB			PCB 2-Sided 2x3 inch	Digikey	6.26	V2025-ND
						
Total					14.37

Too bad the POTs & the PCB cost so much... I dunno, I might have to break into the piggy bank for this one. :roll:

I imagine this will become a very small board.
Neat! KF
 
New Quest:
For the LTSpice peoples… what PCB solution do you prefer? I have Eagle, but I also see that ExpressPCB is directly supported. Mainly I just want to layout the mod and get an idea how big it will be. Anyone export their LTSpice stuff for fabrication?

Thanks, KF
 
Alan B said:
I've used LTSpice and ExpressPCB. I'm moving to DipTrace for schematic/PCB. I have not tried LTSpice with DipTrace yet. Best place to get a couple of boards is probably Dorkbotpdx. For that you'll need Gerber files which ExpressPCB doesn't really provide.
Gotcha. Yeah that Gerber stuff could be very important to have. Below is a list of other apps compatible with LTSpice:

  • Accel, Algorex, Allegro, Applicon Bravo, Applicon Leap, Cadnetix, Calay, Calay90, CBDS, Computervision, EE Designer, ExpressPCB, Intergraph, Mentor, Multiwire, PADS, Scicards, Tango, Telesis, Vectron, and Wire List

I used Excel to map out the PCB area and came up with roughly 0.8 x 0.9 inch using discretes; < 1 inch square x 3/8ths high. Hopefully this will fit inside the tiny 6-FET controllers. Good enough to experiment anyway :wink:

~KF
 
You should breadboard it 1st
Small_Breadboard.jpg

There's nothing preventing you from testing this on the bench, bike's wheel in the air, give it throttle and measure UV with a multimeter.

Try futurlec.com for components, much cheaper.

As for CAD application, currently KiCAD is the only OpenSource unlimited option in Windows. If you run Linux you can try gEDA.
 
Ha! U R Correct: Same parts list with one exception for futurlec.com and it comes out $4.40 cheaper :)

The exception is that instead of getting some pre-drilled FR4 board, I'd get the white plastic breadboard. Njay: Good idea :idea:

Hot dang, I feel... I feel like a pro! :lol:

Bring it! KF 8)
 
For an extra $0.95 (strip) or $1.50 (dot) I think it's worth to get the protoboard...
http://futurlec.com/Protoboards.shtml
Just in case everything works fine :)
 
John in CR said:
KF,

Unless I'm way off, changing R12 doesn't change regen force. It only changes the voltage cutoff of regen. ...

I suspect John may be right, R12 merely adjusts the point at which regen is disabled.

Before building your proposed design this characteristic should be checked as it is an enabling requirement of this design.
 
I'm not sure where it is controlled, but at least some controllers like my generic 12FET (probably ecrazyman?) have two or more levels of regen--above some speed, maybe about 15MPH, it has a lower regen than below that speed, and then below some very low speed it doesn't appear to have any effect at all, perhaps due to BEMF being too low, but I don't know.

Perhaps there could be a way to leverage this function for greater or lesser regen, if the speed is not directly calculated inside the MCU off the hall lines (but it probably is).
 
Njay: Good point. I was going to order Qty-2 anyways for both controllers just in case :D

Alan B: I believe that setting HVC to higher voltage leads to stronger force, just as setting lower will result in a weaker force. I mean – that’s the whole point of faking R12 out to get more regen. I can tell you that my braking affect is very strong because I already have mine set to around 96V.

However – the only way to know for certain is to try. <nods>

I am prepared for failure. I am prepared to accept that when ebrake is selected that the controller reads the value of R12 and just provides one level of regen based on an R12 value (whatever it may be when sampled). I see it has being one of three realities:
  • It reads the R12 value at boot
  • It reads it once when ebrake is selected
  • It reads it constantly at a fixed sampling rate or when it changes.
My money is on the last. And frankly – I don’t think the controller is all that smart; I think it’s just doing the simplest processing possible and handling some basic math on the voltage limit on every cycle because it has to know when to cut off/truncate excess voltage.

Either way, we’re going to find out. And you guys have a front row seat! :wink:

Gosh, maybe I ought to order a scope and video the results. What do you guys think of this one: Rigol DS1052E 50MHz DSO?

~KF
 
You mean this scope:

DSC_7622.JPG


I can't argue with your scope choice, that's mine showing a DDS project I did recently. :)

So you have already verified that changing R12 changes the regen current. At least that's what I think you implied. :)

That's not how I would expect the controller software to work. I would expect it would have one input for HVC via R12 and that would cut off regen. I would expect the value it regulates on is the current. The only thing it controls is the PWM.

The regen battery charging voltage is generated by inductive flyback, which rises uncontrollably in voltage until the battery absorbs the current. The PWM controls the current during regen, not the voltage. At least that's how it looks to me at this point.

If it doesn't work this way, I'd like to know how it does work!

Perhaps setting up a simple experiment with two values of R12 with a switch would be worthwhile. Actuate the switch during regen to parallel a resistor with R12 and see what happens. Cost - one switch, one resistor, some wire. Just a test for science. :)
 
I would think that once the brake is applied, the mcu pulls the R12 value and uses it for the duration of the braking cycle. AkA, you would still have to let off the brake to refresh the R12 value and deal with the lag.

We really just need someone fluent in chinese to phone the people making these things...
 
hillzofvalp said:
I would think that once the brake is applied, the mcu pulls the R12 value and uses it for the duration of the braking cycle. AkA, you would still have to let off the brake to refresh the R12 value and deal with the lag.

If that is the case, I have an idea for a workaround :D

Some Clarity:
  • I haven’t tested the Mod cos I don’t have the parts. I’ll order that in the morning.
  • R12 affects braking strength <period>. I know this from experience before and after I have applied the R12 mod on several 6- and 12-FET controllers. Setting it so that the HVC limit is higher does not create a longer braking experience, but a stronger braking force – as in nearly jerking me out of the seat! The strength of that force is directly proportional to the differential between pack voltage and HVC.
  • I like the idea of a simple switch to change R12 value on the fly; that’s certainly a viable inexpensive test and I support that.
  • Scope: I don’t own it yet; it’s been on my Amazon Wish List for nearly a year now. I am willing to drop the coin for it though if it’s good enough for the type of work we are doing (or will do) on these controllers. :)

Enthusiasm: And now a few words about my disease… It’s called “incurable optimism”. I was diagnosed with it at a very young age, and have suffered from it since. Even in the withering face of danger and deceit, it carries me forward. There are times when the harsh reality gets a leg up over me and I’m pinned below the gutter… however, no matter how dark the day and night become, somehow I cycle back to the illumination of positive thought – then dust off that thinking cap, give the propeller a little spin… and the next thing you know I’ve got a new idea on how to solve the problem! :mrgreen:

When we go to test this circuit live in the real world, no matter the outcome, there’s always another way to solve the problem. I just want to understand, to characterize and document what happens when we change R12 dynamically. I’m just that crazy curious down to my marrow to find out the little truth. If it works – great! If not, well – we’ll have some data upon which we can act. But we have to try first and foremost before moving to the next step.

Without being sappy: Someone had to make the first bread-slicing machine before we had the quote “The best thing since sliced bread!

Well... we are aiming to slice bread! :wink:
I'm excited! KF
 
Although, more precisely, we're trying to control the slicing of the bread...we have long had a knife to cut it with, and even an axe to chop it up wholesale, and even an automatic slicer we could unbolt blades from to change slice sizes.

Now we (you, actually :)) are making one that lets us change the slice size on the fly. ;)

I know, I know....I'm not helping. ;)
 
amberwolf said:
Although, more precisely, we're trying to control the slicing of the bread...we have long had a knife to cut it with, and even an axe to chop it up wholesale, and even an automatic slicer we could unbolt blades from to change slice sizes.

Now we (you, actually :)) are making one that lets us change the slice size on the fly. ;)

I know, I know....I'm not helping. ;)
Yes yes, but I like the analogy! Very clever & enjoyable :wink: :lol:

Hmmm, where's the PnJ? KF
 
KF for a few $ more I would get this one. http://www.rigolna.com/products/digital-oscilloscopes/ds1000e/ds1102e/
Scoping switching times on mosfets and watching what we need to watch its smart to get the fastest scope you can.

I want to get a 4 channal but they cost a lot more!
 
Arlo1 said:
KF for a few $ more I would get this one. http://www.rigolna.com/products/digital-oscilloscopes/ds1000e/ds1102e/
Scoping switching times on mosfets and watching what we need to watch its smart to get the fastest scope you can.

I want to get a 4 channal but they cost a lot more!
DS1102E: Actually that's a better price than the DS1052E at Amazon! Many thanks! I think I'll go that route 8)

In other news:
Call it what you will, but I just had to twiddle some more to characterize the circuit properly… dot I’s & cross T’s, and I became curious once more.

Spice-R12.Mod.V8B.png

Reference V8 output.

I checked the voltage on my HE Throttle before going into the controller, and the signal that would be SP (not SP-OUT) varies between 0.86V @ 0% to 3.65V @ 100% throttle. I went to go model this in the V8 schematic and we have problems in River City. Actually there are issues that we need to resolve before building the solution:

As SP/SP-OUT rises, we need to drop UV in a near linear fashion (natch). The slope of UV has these properties:
  • Starting-V of UV when Throttle is at 0%
  • Ending-V of UV when Throttle is at 100%
  • The width of –Gain as SP rises.
  • The SP voltage at which UV reacts.
Spice-R12.Mod.V8A.png

Reference V8 schematic.

With reference to the V8 schematic,
  • We control (A) Starting-V with R105 (this is actually a voltage divider circuit with +5V -> R (10.5K) -> tap to +IN @ U2-A -> R (20K) -> GND which provides roughly +3.3V.
  • With (B), Ending-V is controlled by R103. In fact, my exploration says we don’t need to jack with R12 at all and R12 should just be a 10K resistor and move on. R103 does the trick of setting the floor.
  • With (C), Width of –Gain is a bit trickier and I’m struggling with it. I can sort of control width by twiddling R102 and R103, though this is problematic.
  • With (D)... This is the fur ball right here: I cannot get this to move left far enough so UV ramps down at the onset of the rise of SP. I’ve toyed with R101 but reducing that value creates too much current through U1.
Wondering out loud, could U1 turn on more quickly, or could U1 be swapped out for a more sensitive device? As it happens, the 4N25 device turns on at +3.2V and I'd like to knock that down to +0.5V or some minor forward current on the optical side. Anyway, I’m glad to keep working at this. I have a Magura Throttle too, so I’ll get some numbers from that in a bit just to really twist the knickers in a bunch. :twisted:

Sanity checking, KF
 
Magura Throttle varies SP from 0.25V @ 0% to 4.47V @ 100%.

We need to handle these throttle properly, and it we do our job correctly, One Mod Board could Rule Them All :twisted:

hehe... more coffee! KF
 
Back
Top