Cycle Analyst V3 preview and first beta release

LMH/LHM Switch Support

As mentioned in an earlier post, the V3 can support on-the-fly selection of fixed percentages of a limit parameter (e.g. Plim->MaxCurrent) using a resistor divider and either a conventional SPDT on-off-on rocker/toggle switch or a commercially available ebike 3-position LMH/LHM switch. The switch positions may be arranged either as Low|Medium|High (LMH) or Low|High|Medium (LHM). The LHM configuration is perhaps more suitable for toggle switch installations where it is typically more difficult to hit the center position (H) but very simple to sweep the toggle to either extreme (L,M). This post presents some ways to hook this up.

LHM-switch.png
There are two minor design considerations imposed by the CA:
  1. The stated max current available to power external circuits from the CA PCB +5v pads is 5ma. There is actually a little more headroom for lower voltage battery packs: The CA 5v linear regulator should be limited to 1.5W and the CA proper requires about 10ma to operate. The total available current to operate the rider throttle and Vaux divider is therefore roughly 1500mW/(Vbatt - 5v) - 10ma. So, for a pack voltage of 52v we get 1500/(52-5) - 10 ~= 20ma; for a 100v pack we get 1500/(100-5) - 10 ~= 6ma. A Magura throttle has a resistance of about 5K and so draws about 5v/5K = 1ma which must be subtracted from the total; we need to limit the divider to 19ma or 5ma for the 52v or 100v packs respectively. It's not hard to keep the total draw down to a few ma so we have a workable safety margin even for the worst case scenario with the big pack.
  2. The A/D converter input impedance should be limited to no more than 10K to achieve full 10bit accuracy. However, even if this limit is exceeded, the loss of a bit or two of accuracy will have negligible impact in this application.
There are many possible resistor/trimpot configurations - the dividers presented here were chosen largely because the two trimpot adjustments are non- or minimally interacting to simplify setup. Because of the range of ebike power and the desire by many folks to use parts on hand, each circuit is presented on an Excel worksheet that allows available parts to be substituted and evaluated.

The approach below is straightforward and allows the L and M settings to be adjusted to any 0-100% value. Even though most of the trimpot range is unused, 20-turn trimpots are very easy to adjust accurately. The three connections CA-5v, CA-POT, and CA-Gnd refer to the Potentiometer connections on the CA PCB.

resistorselector_ez_adj.gif
The circuits below give more restricted adjustment range for the L and M trimpots and so will work accurately with single turn pots. The fixed resistors (R1/R4) are optional and can eliminated if multi-turn trimpots are used. This setup requires a little more effort to select parts that are appropriate so the pots can hit the desired target values but the spreadsheet makes this pretty easy.

resistorselector_adj.gif
Here's the Excel spreadsheet with the circuits above and two more versions that use fixed resistors in place of trimpots. Select the desired circuit on the worksheet tabs on the bottom. If you do not have Excel, download and install free Apache Open Office. The spread has been verified to work with it.

View attachment Resistor_Selector_for_CAv3-0_Limit_Switches_20121009.xls
The worksheets for the first two circuits above look like this:

cav3-EZ-adj_800_2.gif
Since the first two circuits require no customization to select parts to target particular LMH range adjustments, you can just build them with the values shown. If you have some notion of the power settings that you wish, plug the LMH values into the green cells at D16,D17,D18. The matching Vaux voltages will appear in the adjacent yellow cells (1.66v and 3.33v in the worksheet pages above). You can go into the CTRL section of CA Setup and adjust the pots so the screen value of Vaux matches the voltages on the spreadsheet. Done.

The other green cells can be adjusted to accommodate parts on hand and the max current draw will recalculate appropriately. Use this feature to tweak in the parts for the second two circuits. All the sheets work essentially the same and have instructions for use.

Since the trimpots are pretty much in the set-it-and-forget-it category, if you wish you can stash them away inside the CA case and rewire the existing Auxilliary Pot cable (white connector) to the divider to support direct connection to the external LMH switch.

The Setup parameters Aux->MinAuxin and Aux->MaxAuxIn relate only to external Aux POT circuitry and are independent of ThrI and ThrO voltage settings. If the switch circuits are connected as described above, configure these parameters to 0.0v and 4.99v respectively. Modified circuits or different (+/-) supply voltages may require different parameter values.
 
Teklektik, you are the greatest. This is exactly what I was looking for! Thanks, man!

I like the idea of stashing it in the CA body. And I would love to try this as a 3-power switch in combination with a 3-speed switch connected directly to the controller. One switch to control power, and the other switch to control speed. Having a lot of power but with low maxspeed may help on the trails, whereas low power medium speed may help increase range. And of course, having high power and high speed when going full out!! All on the fly, without having to program anything!
 
fine work tek, man you are all over this.

just about to grab a v3 stand alone and was told by ben (on behalf of grin) that you cannot use the limiting functions with the v3 when its the stand alone version and you will need (to buy/join?) another shunt, or get a direct plug in. -hopefully this is just a misunderstanding.
seems strange as the stand alones have always had a shunt included, with all the limiting working, as its made to 'stand alone' from the controller?

on the other hand direct plug ins are such (directly pluging in to share the internal shunt etc) for just the kewin type controllers anyway arn't they?

hoping it is just confusion cos with a kelly there are no options left to use a v3 with limiting if he is right?
 
toolman2 said:
just about to grab a v3 stand alone and was told by ben (on behalf of grin) that you cannot use the limiting functions with the v3 when its the stand alone version and you will need (to buy/join?) another shunt, or get a direct plug in. -hopefully this is just a misunderstanding.
seems strange as the stand alones have always had a shunt included, with all the limiting working, as its made to 'stand alone' from the controller?
...
hoping it is just confusion cos with a kelly there are no options left to use a v3 with limiting if he is right?
Gee - I can't speak for Grin, but as far as I know there is no CAV3-SA version - the shunt is a separate item (see items for sale) - I believe this is the point Ben was making.

I suspect the rest of the conversation was a simple V2 - V3 mixup about the term 'limiting functions' which classically for V2 was associated with the special throttle override connection accessible only via the DP cable and not directly available for the V2-SA version. Here I assume you used the term 'limiting functions' instead to refer to the V3 software current/power/speed limiting as expressed through a direct controller throttle hookup (not the legacy DP throttle override connection which is normally unused by the V3 anyway). Probably just a nomenclature thing...

As far as the V3 'limiting functions' are concerned, I am certain that they are fully available regardless of whether you use an external shunt or controller shunt via the DP connector - the same pads on the PCB are used in both cases (+S,-S). In fact, it seems that the new V3-SA shunt dongle add-on actually plugs into the DP connector instead of having a dedicated cable of its own. I think you want a CA3-DPS, a Shunt-SA, and of course, a CA3-USB (not sure if the programming cable comes with the CA3-DPS or not - I bought the special Beta Tester package back when...).

I migrated from a V2 to a V3 and from the start have run my V3 using an external shunt - I just discarded the DP cable that came with my beta V3 and used my old V2 external shunt - works fine... :D
 
again tek, you have excelled -we are away with a v3, shunt, and how to do it. thanks.
 
@ teklektik

quick question, as you seem to be the one with good knowledge of the limiting feature set.

when i get my CA V3, i want to run the Thun BB and have it scale the assist level based upon the pedal torque input.
i realize that you don't run PAS or the Thun, but i thought i would ask your input.

what i want to do is have a rotary pot,(like the pas dial on the ezee kits) and have it so that i can dial up the level of maximum assist.
so that with the dial all the way down, i have zero assist, and when it's all the way up i would have say maximum, which would be set by the amp limit setting in the CA.

would you know if this is possible, and if yes, how might that be done ?

i don't really want to use a 3 pos LMH switch, because then i would be effectively limited to 2 different power levels. (3 if you count zero assist).

if i could find say a 5 pos rotary switch, that would also probably do better in a way.

P1=off or zero assist with P2-P4 variable limits set in the CA.
P2=250W (5A)
P3=350W (7A)
P4=450W (9A)
P5= global amp limit in the CA, basically unlimited, as i would set this limit at the controller maximum of 20A anyway.

amp ratings are approximate for 48V nominal for 12S lipo.

is this achievable ?

Jason.
 
Diamondback said:
i realize that you don't run PAS or the Thun, but i thought i would ask your input.

what i want to do is have a rotary pot,(like the pas dial on the ezee kits) and have it so that i can dial up the level of maximum assist.
I would just use a 5K pot with a linear taper and hook it up as shown towards the bottom of this post. This would give you the 0-100% limit adjustability that you wish without the steps. Again - no PAS-smarts in this quarter, but from a limit perspective, this should do the job.

EDIT - maybe I misunderstood and you wanted the steps - in that case, what you have proposed is achievable without difficulty...

EDIT - Standard pots use a 1/4" shaft - (the miniature pots use a 1/8" shaft) - you can pick up knobs on eBay or Radio Shack.
 
The problem with a stand alone version is it gets ground, +batt, and shunt from the connector on the shunt. The throttle output needs to get to the controller in some fashion to do the controlling. The new shunt has a DP jack on it so that takes the pins that have that function. You'll have to wire up the throttle controls somehow.
 
Alan B said:
The throttle output needs to get to the controller in some fashion to do the controlling. The new shunt has a DP jack on it so that takes the pins that have that function. You'll have to wire up the throttle controls somehow.
As you point out, the necessary throttle signal is available on the CA DP connector, so it's a small matter to slip another JST pin into the mating shunt DP connector to pick up ThO and run this to a new JST connector to mate with the controller throttle connection - a small variation on Justin's HowTo Throttle post. It's perhaps a little unfortunate that the new shunt does not have such a throttle plug already installed, but remembering that the DP connector cannot be directly used without modification in the non-SA situation for normal (non-legacy) V3 operation, this SA throttle connection issue is really no different...
 
teklektik said:
As you point out, the necessary throttle signal is available on the CA DP connector, so it's a small matter to slip another JST pin into the mating shunt DP connector to pick up ThO and run this to a new JST connector to mate with the controller throttle connection - a small variation on Justin's HowTo Throttle post. It's perhaps a little unfortunate that the new shunt does not have such a throttle plug already installed

That's actually the idea. You'll notice that there is a plugged hole in the grommet on the side that doesn't have the CA-DP wire. The plan will be to include a wire coming out of this as well that has both the CA's throttle output and speedo lines. That way those with a Stand Alone shunt can much more easily interface to either the controller's throttle input or hall signals and make it a bit more like a controller with a CA-DP plug. It's just that we need to prepare a new batch of partial-stripped cable harnesses to do that and haven't got around to it yet.

In the meantime though, you can peel back the heatshrink on the shunt's 6-pin connector, and you'll see that there is a green wire already hooked up to a pin making contact with the throttle signal from the CA. Snip this green wire (it's just a dead end into the shunt) and then extend it to connect to the throttle input of your controller and you should be good to go.

-Justin
 
teklektik said:
I would just use a 5K pot with a linear taper and hook it up as shown towards the bottom of this post. This would give you the 0-100% limit adjustability that you wish without the steps. Again - no PAS-smarts in this quarter, but from a limit perspective, this should do the job.

perfect, the fully variable solution is exactly what i want.

thanks :)

Jason.
 
A recent post reminded me of something I'd been wondering about for a little while:

teklektik said:
In this Current Throttle example, if Plim->MaxCurrent is set to 50A then WOT is 50A. Assuming the rider throttle is more or less linear, adjusting the throttle to 10% rotation yields a predictable controller output of 10% of 50A or 5A.

One of the things which I have noticed about my throttle in particular (a thumb-style hall throttle) is that it is, in fact, massively non-linear. Seems that the first 10% of rotation takes you to about 40% of voltage output, the area between 20-80% of rotation gets you from maybe 40% of output to 60% of output, and then the last 10% of physical rotation takes you from 60% to 100% of output.

I'm not kidding- most of the control is at the extreme ends of the throttle, with a huge dead spot in the middle.

Being able to actually visualize this happening in the CA3 really helped me to understand why my throttle always seemed a tad strange, and with the closed-loop current mode, I've found it pretty easy to overcome that oddity.
 
Joe Perez said:
One of the things which I have noticed about my throttle in particular (a thumb-style hall throttle) is that it is, in fact, massively non-linear. Seems that the first 10% of rotation takes you to about 40% of voltage output, the area between 20-80% of rotation gets you from maybe 40% of output to 60% of output, and then the last 10% of physical rotation takes you from 60% to 100% of output.

I'm not kidding- most of the control is at the extreme ends of the throttle, with a huge dead spot in the middle.

Being able to actually visualize this happening in the CA3 really helped me to understand why my throttle always seemed a tad strange, and with the closed-loop current mode, I've found it pretty easy to overcome that oddity.

Hey Joe, this is common with throttles that have two distinct magnets poles facing each other with the hall sensor chip located in between them. The field intensity coming off the pole of a permanent magnet is anything but linear, so you get a large dead band area in between the two magnets with it then changing dramatically near the pole faces.

On many of the newer throttles I've seen (such as from Wuxing), there is just a single arc shaped magnetic strip that is gradually polarized from N on one end to S on the other. The hall sensor is against the side of this curved magnet piece and the output voltage response is almost perfectly linear with throttle movement. So you might want to consider getting a new throttle. I could in principle add non-linear input throttle mapping to the V3 CA, but it could get a little tricky on the setup front.

-Justin
 
justin_le said:
Joe Perez said:
One of the things which I have noticed about my throttle in particular (a thumb-style hall throttle) is that it is, in fact, massively non-linear.
Hey Joe, this is common with throttles that have two distinct magnets poles facing each other with the hall sensor chip located in between them. The field intensity coming off the pole of a permanent magnet is anything but linear, so you get a large dead band area in between the two magnets with it then changing dramatically near the pole faces.

On many of the newer throttles .. there is just a single arc shaped magnetic strip that is gradually polarized from N on one end to S on the other. The hall sensor is against the side of this curved magnet piece and the output voltage response is almost perfectly linear with throttle movement.
Here's a thread that discusses remedies for hall throttle issues. Much of the discussion is in regard to matching the throttle and CA voltage ranges which the V3 already does via Setup, but the rest outlines an add-a-magnet hack to fiddle the magnetic field that can improve linearity while relocating much of the dead zone to one end of the range of motion. I'm sure the result is nowhere near as effective as the cool arc-shaped linear magnet Justin describes, but it might be worth a try on a rainy day.
 
Hi, I have just connected and tested out the CA3 with the Thun torque sensor and it works very good. I received the CA3 with the Beta19 already installed so I haven't touched that.

The only problem I have is that when I'm in high speed (relative to max speed, my bike isn't fast) and I stop pedaling there is a delay when I start pedaling again before the motor kicks in. I noticed the same delay when using the throttle. I know there is some ramp up delay in the controller I'm using too, but it looks like the output (according to the display at least) from the CA3 ramps up slowly too. I tried changing the Up Ramp to 999 (from standard 500) but that didn't do anything.

I tried attaching a small gif video of what I see:
 

Attachments

  • CA3_Rampup_delay.gif
    CA3_Rampup_delay.gif
    221.7 KB · Views: 9,178
that's what i am worried about when i set up my CA V3 with the thun sensor.
(i have ordered most of the parts i require to set it up)

i think i will need to replace my controller with one that has minimal delay.
my current one is horribly slow to respond to throttle input.

you might find that you will need a better controller ?

Jason.
 
Diamondback said:
you might find that you will need a better controller ?
Yes, well that is easier said than done since I went for the SmartPie which has a built in controller. But it might be a good excuse to install a 72 volt controller/battery...
 
yes, i see. having a built in controller kind of limits your choices.....

mine is the 20A Ezee controller.it has about a 2 sec delay before much happens when you open the throttle.

as you said, good excuse to upgrade to a better external controller.... :D


Jason.
 
Just upgraded to 3.19 from 3.17... despite using the new flash tool and the nocal version of the hex it erased all my distance,cycles and amp/hr data and erased all the calibration and changed from km's to mph. I can't tell you how frustrating that is the one time I didn't write it all down first. I guess it was wrong to just assume it would have been tested and working properly before I tried it. One more free lesson for me I guess. Too bad I don't have any of my battery pack data now. Just a warning to any who try.
 
lizardboy said:
Just upgraded to 3.19 ... despite using the new flash tool and the nocal version of the hex it erased all my distance,cycles and amp/hr data and erased all the calibration....

Ouch, thanks for the warning. That must be really frustrating. I will start writing down my stuff.
 
Shoot sorry Lizardboy, by calibration data I meant the RShunt, current offset, V/V setting and some internal variables not directly user accessible. Life cycle totals or any of the user settings isn't part of "calibration" and I should have been more clear about that. Do you still have handy where you wrote down the totals data at the previous reflashings? If so it should be possible to do a reasonable estimate on where it would be at now given your weekly usage since then.

There are very few pending changes to the eeprom mapping at the moment so once that is locked in in preparation for release then it will be easy to flash the firmware without any settings getting changed, and you won't have to reinput that stuff.

-Justin

lizardboy said:
Just upgraded to 3.19 from 3.17... despite using the new flash tool and the nocal version of the hex it erased all my distance,cycles and amp/hr data and erased all the calibration and changed from km's to mph. I can't tell you how frustrating that is the one time I didn't write it all down first. I guess it was wrong to just assume it would have been tested and working properly before I tried it. One more free lesson for me I guess. Too bad I don't have any of my battery pack data now. Just a warning to any who try.
 
lollandster said:
Hi, I have just connected and tested out the CA3 with the Thun torque sensor and it works very good. I received the CA3 with the Beta19 already installed so I haven't touched that.

Super! It'll be great to hear more of your experience and thoughts on the Thun. One thing I'm not sure if we included was adhesive shrink-wrap to cover up the tiny molex connectors between the thun sensor and the cable harness that goes to the CA. Since this bit is exposed to water spray from the front wheel, it will be important to properly seal the connector itself from any water exposure or else the pins will probably corrode away.

We got some very nice 4:1 adhesive shrink from Waytex which completely seals around the cable sheath and keeps the connector dry:
http://www.waytekwire.com/products/1381/Tubing/&Shrink-Ratio=4-1


The only problem I have is that when I'm in high speed (relative to max speed, my bike isn't fast) and I stop pedaling there is a delay when I start pedaling again before the motor kicks in. I noticed the same delay when using the throttle. I know there is some ramp up delay in the controller I'm using too, but it looks like the output (according to the display at least) from the CA3 ramps up slowly too. I tried changing the Up Ramp to 999 (from standard 500) but that didn't do anything.

This can be the result of integral feedback gains being on the low side. Try increasing the value of the various IntSGain, AGain, WGain to see if that makes the ramping faster. I will be tweaking the code a bit in next release so that even with low integral gains there won't be this resulting rampup period, but as it is now if you drop off the throttle and then re-apply it, some of the other terms can result in a ramp limit slower than your "up ramp" value even though you aren't exceeding the limits. This is a minor consequence of another optimization designed to greatly reduce overshoot when you do exceed a limit.
 
lizardboy said:
Just upgraded to 3.19 from 3.17... despite using the new flash tool and the nocal version of the hex it erased all my distance,cycles and amp/hr data and erased all the calibration and changed from km's to mph.
I ran a suite of trials this evening attempting reflash of v3B19_NoCal on top of V3B17 and V3B19 Setups and looking only at the Calibration data for resultant data corruption.

Code:
1. Setup Calibrtion     Data< 1.00 mohm >
    1. Cal -> Range = { [Lo (W)] | Hi (kW) } 
    2. Cal -> RShunt = [1.000] mOhm 
    3. Cal -> V Scale = [31.05] V/V
    4. Cal -> Zero Amps (aka Amps Offset)
It appears that the v3B19_NoCal version does not preserve Cal->Range but rather causes it to be set to Lo. Other Calibration parameters appear to be preserved properly.

  • In the case where Cal->Range is initially set to Hi and is then improperly set to Lo by V3B19_NoCal then the Cal->RShunt value appears corrupted since the stored value is interpreted incorrectly. However, manually restoring Cal->RShunt to Hi in this situation causes the Cal->RShunt value to reappear with the proper preserved value.
  • In the case where Cal->Range is initially set to Lo, then that value (erroneously) appears to be preserved when V3B19_NoCal overwrites the value with Lo and all the Calibration data appears to be preserved correctly. This Lo value was part of my original test scenario as reported in this post.
    teklektik said:
    Using the new Firmware Flash Utility from the CAV3 page of the Grin Tech site, I flashed v3B19, trying both the plain vanilla and NoCal versions. ... the NoCal version preserved the settings in the Setup 'Calibration' section.
Except for this issue, the Cal->RShunt and Cal->VScale values were consistently preserved by V3B19_NoCal when re-flashing from either V3B17 or V3B19. Since there was no handy display of the current Amps Offset, that last value was not verified.
 
Back
Top