Beta CA build for R/C controllers

justin_le

Administrator
Staff member
Joined
May 28, 2007
Messages
2,310
Location
Vancouver
It occurred to me quite some time ago that we could potentially use the CA's PWM output to directly drive R/C style motor controllers rather than just generating an analog voltage for ebike controllers. The nice folks at FFR trikes have encouraged the issue so in the latest Rev11 CA board, there is a new pad in the upper left labelled "PWM" which is designed to be a servo style 1-2mS pulse feed for RC speed controls.

Scope Probe_sm.jpg

Anyways, I've been playing around with the software for this and am trying to work out a new model of RC compatible Cycle Analyst, and would appreciate both feedback and beta testers since I don't have that much first hand familiarity with RC ebike builds.

What we have right now is this, Beta V2.24 firmware:
View attachment 6

In the advanced menu, there is now an option for selecting the throttle output mode, between Volts (vlt) or R/C servo pulese (R/C):
RC Mode_sm.jpg

If you select the R/C mode, then the upper and lower bounds of the throttle output instead of being settable between 0-5V, are now settable between 0-5 mS. So for an RC controller, we'd set ITermMin to about 0.8 mS and ITermMax to about 2mS. If you wanted to put a cap on the upper speed or motor RPM limit, then ITermMax could be tweaked lower:
ITermMin_sm.jpg
View attachment 3

As well, since the sensorless R/C controllers often have startup issues at low speeds, there is a new option for a low speed cutout. So the controller won't be engaged until the bike reaches a programmable threshold speed, to ensure a smooth motor start. Naturally this feature is effectively disabled if the turn-on speed is set to 0:
Turn On Speed_sm.jpg

Once these things are done, then the output on the PWM pad is a 0.8-2.0 mS pulse every 25 mS, which should be able to feed into the speed control input of any RC controller. The CA would need to be setup with the AuxVoltage function enabled, typically as a current limit. So basically you would feed a standard ebike hall effect throttle to the Vi pad of the CA to tell the CA what the desired current is, and then the CA would output a pulse stream to the RC controller varying the pulse width in order to achieve this setpoint current.

Scope Trace_sm.jpg
 
This is where i cautiously step up to the edge of the pool and dip my big toe to test the temperature...

I do not understand the technical reason for this but it seems that limiting current to sensorless controllers is a bad thing, my RC bike is using one of Fechter's throttle boxes that also provides extra capacitors but i had to disable the throttle limiting to prevent the controller from surging at high power levels.. ( might be a problem on the throttle box design.. i really don't know ) ..

But hell yeah !!.. one less black box to mount on an already crowded bike = bonus !!

http://ypedal.com/RC/RC4.htm
 
Justin,

I have been talking to Tommy about this for a loooong time. I have done everything mechanical on my end like the torque limiters to "Program" maximum torque, etc. I am glad to see more electronic solutions out there.

I would be willing to beta one for you. It may be a few weeks before I can install it, though (busy with TONS of mechanical development, though).

Matt
 
I've been anxious for something like this to come around too. The light weight of the rc controllers really interests me and starting from a dead stop isn't too big of an issue on some of my builds. Throttle response is still a concern though. Anyway, as soon as these are ready for sale, I'd love to try one.

Thanks for pushing the envelope!

How hard would it be to implement switchable custom throttle maps?
I think that's going to be really important for a lot of builds.
 
Justin.

:shock: Awesome.

I am very interested in trying this out on my friction drive project (https://sites.google.com/site/commuterbooster/) and would love to be a beta tester.

I'll PM you with a few more details relevant to my project, so I don't clog up this thread.

- Adrian
 
Hey guys, OK good to hear that there is some interest here for this. What I am thinking of doing is to make a single new CA model spec, say CA-LRC, that is as convenient as possible to use with RC setups. What made sense to me and I'd appreciate your feedback is to do something like this:

Wiring Diagram.jpg
Externally, it would appear like a CA-DPS but with an additional short cable with a 3-pin connector for attaching a standard ebike throttle as the input:


However, the wiring inside on the 6 conductor cable would be slightly different. The yellow wire for getting the speed from the motor hall signal (which is usually not connected in the CA-DPS) would be instead attached to the 5V bus of the CA, as the RC controllers seem to require 5V on the servo input line in order to work. And the green throttle over-ride wire would naturally be soldered to the PWM pad rather than the Th pad:
Board Wiring Diagram_sm.jpg

Then for plug and play usage, we would offer an inline shunt adapter cable that would plug into the 6-pin connector and provide a standard shunt to connect inline with the battery, and it would also break away a short 3 conductor cable that would connect to the servo input of the RC controller:
RC Shunt_sm.jpg

For those that are more adventurous, they would also have the option of forgoing this and soldering their own 6-pin connector that taps directly into the RC controller's shunt and servo input lines. Done this way it would be super tidy. Throttle plugs into the CA, and the CA plugs into the controller with a single connector. CA picks up all the voltage and current info from the controller tap, combines this with the speed pulses and handlebar throttle signal, and then sends the appropriate PWM signal back to the controller's input line. I doubt any of the RC controller companies would offer a pre-equipped "CA compatible" option with the plug pre-wired, but the hack shouldn't be any more difficult than on an ebike controller.

For those who've played with and dissected RC controllers, do they typically have a visible or accessible shunt resistor you can see on the ground return line for the current sense? Even if not it wouldn't be too hard to put a ~1mOhm shunt resistor right where the - battery lead connects to the board and use that.

Justin
 
adrian_sm said:
Justin.

:shock: Awesome.

I am very interested in trying this out on my friction drive project (https://sites.google.com/site/commuterbooster/) and would love to be a beta tester.
- Adrian

One of the things Adrian asked about which I might as well respond publicly is the ability to set all kinds of parameters, ramp-up ramp-down rates, throttle profile mapping, soft starts, etc. Unfortunately I've basically used up 99.9% of the 4K available code space in the microchip, so anything added means something else has to be removed. (As it is I already had to get rid of the 'full reset' option and a few of the scarcely used advanced setup features in order to fit the R/C code.)

So the way it would work right now is that the throttle would set the either the current set point or the speed set point of the CA. Most people I think would configure it for current control. Although there isn't a ramp rate control as such, you can effectively play with how rapidly the pulse widths could increase or decrease via the gain terms in the feedback loop, so IntAGain if you are running as a current throttle, or IntSGain and PSGain if you are running as a speed throttle, and then that would determine the smoothness of the response.

It's maybe not the level of tweaking that some people might want but I think that should work fine for the vast majority of cases. The one other control option that I am considering heavily is to have a 'pass through' mode, where the CA simply takes the analog throttle signal and generates a pulse width in proportion to that without any feedback. Then you would also get the standard 'motor voltage control' mode that the majority of controllers use, which is a bit like a poorly regulated speed throttle.
 
PI throttle control should be enough to get close to what I would like for my drive.

justin_le said:
The yellow wire for getting the speed from the motor hall signal (which is usually not connected in the CA-DPS) would be instead attached to the 5V bus of the CA, as the RC controllers seem to require 5V on the servo input line in order to work.
I have only worked with RC ESC that have integrated BEC (Battery Elimination Circuit) that provides 5 or 5.5V. So we may need to be careful about a plug and play cable that connects this to the CA 5V.

justin_le said:
For those who've played with and dissected RC controllers, do they typically have a visible or accessible shunt resistor you can see on the ground return line for the current sense? Even if not it wouldn't be too hard to put a ~1mOhm shunt resistor right where the - battery lead connects to the board and use that.

I don't believe all the controllers have a shunt, at least I couldn't find it on this controller I have in bits in front of me. I will inspect it further and a few others I have in a few days time.

Thanks again Justin for this development. I am excited. :D

- Adrian
 
lukelagunajustin.jpg
 
I would be interested in it for sure!

Most people using HV160 controllers I think may be a little over the rated currents of the standard CA shunt....no biggie just as long as you can still adjust the R value in the custom RC firmware. But as discussed earlier it isnt really the battery currents that need to be limited but the phase currents. It would be trick if you could team together with this build .... http://endless-sphere.com/forums/viewtopic.php?f=2&t=28935 ....

Adrian_SM and myself have both used throttle ramping (servo regulators) before to tame and slow down the rpm gain to give a more realistic feeling throttle (and solve a few other little problems) and I did notice this definitly decreased the max KW and amps drawn effectively in the datalogging of the hv160, so I can definitely see this working. I am not 100% sure but I think castle controllers expect power and a certain pwm to be sent to their input at power on to activate/engage (whatever you call it) otherwise they think no throttle(receiver) is connected. This must be some kind of standard though since a servo tester can do it. I love the no throttle < x km/h feature....though it might kick the bike out from under me if I were to put on a few hard pushes only to open the throttle a fraction and have 7kw+ burst out without me ready for it when it hit the speed.

Just the throttle run thru the CA is enough to make me want to buy it so Im sold on atleast 3 maybe more.....oh and will it support 0-5K resister type throttles(magura)?

Cheers
 
Awesome product Justin! I would be willing to beta test on a hub motor that I am powering with a Castle Creations HV110 controller. Might be good to see if I can smooth out the startup on a direct drive hub. I can also test it on the stock sensorless controller that came with the kit.

I hope one day we will have a computer that will be able to monitor everything from motor and controller temps and adjust powering accordingly, maybe even program routes in and it will tweak itself to assure arrival at destination without dead batteries. If it was also a BMS that allowed high power charging that would be bonus. And if it interfaced with an iPhone app as the display oh man, ebike heaven!!
 
rodgah said:
I would be interested in it for sure!

Most people using HV160 controllers I think may be a little over the rated currents of the standard CA shunt....no biggie just as long as you can still adjust the R value in the custom RC firmware. But as discussed earlier it isnt really the battery currents that need to be limited but the phase currents.

There is actually some possibility for the CA in this context to do a crude but probably good enough phase current limit as well. Does anyone know if the RC controllers work such that the input servo pulse width directly controls the motor mosfet duty cycle? So that say 1mS = 0% duty, 1.25 mS pulse = 25% duty, 1.5 mS pulse = 50% duty etc? If this is the case, then the motor phase current is approximated by Ibatt / Duty Cycle, and since the CA is telling the controller what duty cycle to use then it can assume this is the case and estimate the phase current too, and then do the feedback based on the calculated phase current.

though it might kick the bike out from under me if I were to put on a few hard pushes only to open the throttle a fraction and have 7kw+ burst out without me ready for it when it hit the speed.

Well, hopefully with the feedback gains you can at least tune things so it's a more gentle kick once you hit the threshold speed :wink: .

Just the throttle run thru the CA is enough to make me want to buy it so Im sold on atleast 3 maybe more.....oh and will it support 0-5K resister type throttles(magura)?

Yes assuming that the magura is a 3-wire pot with a center tap. The Vi input line can work with any voltage signal that spans a 3V swing, so 0-3V is typically used with a resistor throttle, while 1-4V would be implemented for a hall throttle.

I'll try to sort out and post here the purchasing details or list in the next day or two for those who are interested.

-Justin
 
justin_le said:
Does anyone know if the RC controllers work such that the input servo pulse width directly controls the motor mosfet duty cycle?
-Justin

Not quite. The end points are adjustable on the ESC. So people may not have zero throttle set at 1ms, or full throttle at 2ms. Also some controlers allow re mapping throttle input to PWM output to the motor.

So you can't rely on either of these unfortunately.

- Adrian
 
etard said:
I hope one day we will have a computer that will be able to monitor everything from motor and controller temps and adjust powering accordingly, maybe even program routes in and it will tweak itself to assure arrival at destination without dead batteries. If it was also a BMS that allowed high power charging that would be bonus. And if it interfaced with an iPhone app as the display oh man, ebike heaven!!
Other than the last thing, I had started specifying something like such a computer (with other functions as well) maybe two years ago, but found little interest in development of it by anyone that might be able to help me (as I can't write the programming myself).

(well, I did find one person over on the LadyAda forums that not only was interested, but had gotten approval to do it as his IEEE project, but he did not end up ever doing anything with it, for whatever reason, and he stopped contacting me.)

Anyhow, I could probably find the stuff I started spec'ing for it, and post that up in a thread for it, if anyone is interested.
 
I think this is a great idea, Justin, and I'd love to be involved in the testing. :)

As someone already mentioned, most RC controllers have BECs that provide +5V to the radio receiver, so I don't think this is a requirement for the CA to provide. Also, I'll have to go back over what you posted about the timing, but the way RC servo timing works is that the pulse width varies from 1ms to 2ms, and this represents 270 degrees, or in another way of specifying, +/-135% of the servo travel (not all servos can go 270 degrees). The throttles on glo engines used servos for the throttles, but limits were used, as it didn't need that much servo throw. When ESCs were first introduced, they were designed to mimic the throttle servos. All RC radios have functions that let you adjust the end points of the servo travel. All this does is adjust the min and max settings for the pulse length. The way it works out for an ESC, the active range is something like 1.25ms-1.75ms. Anyway, the ESCs use this pulse width variation to modify the PWM duty cycle for the motor FETs, thus controlling the rpm.

Down the road, if you really want to get clever, you could just integrate/marry the CA and brushless ESC functions, in one unit. :roll: :mrgreen:

-- Gary
 
Definitely will buy one when available or happy to buy now? & instal immediately and test on my RC 2 speed cruiser!? i was
in the market for a CA seeing the Turnigy mod i did has not worked well, shall hold off on buying anything until
this is available now, top work Justin you RoXz!

This would be awesome! It just has to work with only 50v but up to 200a.

Uhm...needs ALOT more than 200amp i have recorded 280amp on data logging with the hv160
i know Rodgah and Recumpence both have higher current draws also ;)

KiM
 
AussieJester said:
Definitely will buy one when available or happy to buy now? & instal immediately and test on my RC 2 speed cruiser!? i was
in the market for a CA seeing the Turnigy mod i did has not worked well, shall hold off on buying anything until
this is available now, top work Justin you RoXz!

This would be awesome! It just has to work with only 50v but up to 200a.

Uhm...needs ALOT more than 200amp i have recorded 280amp on data logging with the hv160
i know Rodgah and Recumpence both have higher current draws also ;)

KiM

I am definitely interested in buying one too. That's true about the amp draws, I personally have only seen over 200a twice, when I blew my undersized motors :p
 
adrian_sm said:
I have only worked with RC ESC that have integrated BEC (Battery Elimination Circuit) that provides 5 or 5.5V. So we may need to be careful about a plug and play cable that connects this to the CA 5V.

Hey Adrian, OK thanks for the heads up there. On the Castle Creations HV160 controller that we got from FFR trikes the controller wouldn't run at all unless the 5V was supplied to the controller from the CA. However, today I had a chance to test out a system with a Turnigy K-Force series controller with onboard BEC, and indeed it was already outputting 5.4V on the red servo wire which would not have been smart to connect up to the CA's 5V bus. So yeah, depending on the particular controller it could be required or bad news to connect the 5V on the servo line to the CA, and people will have to know whether to attach it or not.

Alternately I could put a small schottky diode inline, so it would deliver 4.7V to ESC's that don't have an onboard 5V supply, and the diode would protect it when plugged into controllers that do.

adrian_sm said:
justin_le said:
For those who've played with and dissected RC controllers, do they typically have a visible or accessible shunt resistor you can see on the ground return line for the current sense? Even if not it wouldn't be too hard to put a ~1mOhm shunt resistor right where the - battery lead connects to the board and use that.

I don't believe all the controllers have a shunt, at least I couldn't find it on this controller I have in bits in front of me. I will inspect it further and a few others I have in a few days time.

OK, I certainly couldn't see any sign of a shunt in the HV160 controller either. I am guessing that these devices must be using the voltage drop across the low side mosfets when they are in the conducting state as a crude indicator of phase current, assuming that they have any proper current regulation at all. Let me know if you find anything differently though.

-Justin
 
Ypedal said:
I do not understand the technical reason for this but it seems that limiting current to sensorless controllers is a bad thing, my RC bike is using one of Fechter's throttle boxes that also provides extra capacitors but i had to disable the throttle limiting to prevent the controller from surging at high power levels.. ( might be a problem on the throttle box design.. i really don't know ) ..

Interesting. Well I was lucky that yesterday a local fellow who happened to have a Kepler drive not yet installed saw this thread and came into the shop, so I had a chance to try it out with more of a complete system:
Kepler Drive.jpg

I was using a potentiometer (visible just behind the turnigy lipo) rather than an ebike throttle in order to be able to precisely adjust the input voltage to the CA, and even with no load on the motor it was able to do current control pretty well. The no load current at full throttle was about 5 amps, and I could easily regulate it to anywhere between 0 to 5A but adjusting the pot. Here it is with the throttle set to a 3A command current:
3A draw, no load.jpg

Then if I used my hand to load the motor, the RPM's went way down with the current draw staying at 3A all the while as regulated by the CA:
3A loaded.jpg

So it doesn't seem like there are any issues using a current control loop to regulate the RC controller. Of course this is at low currents with minimal load, but the loop stability as far as the feedback goes shouldn't change much at higher currents and power levels. Hopefully it won't be too long before we can hear about road tests, but on the bench at least everything tests out OK so far.

Man I gotta say though, there isn't much in the build quality of the Turnigy motor that inspires confidence!

-Justin
 
The low side shunts are the only thing I've ever seen in an RC controller capable of measuring current, and they are going to be reading hundreds of amps optimistic when hot or spiked past saturation.

Your shunt will be drastically more accurate.
 
e-bike problem = checking an internet thread for updates every hour..... :D
 
Back
Top