Beta CA build for R/C controllers

justin_le said:
if I I'm gonna have a vehicle that has additional gearing complexity it'll be on something much sillier like this:
http://www.unicyclist.com/forums/showthread.php?t=89581
Regarding the shifting issue with dual NuVincis, why not just mechanically link them, so they shift the same at the same time? If they need to shift opposite of each other, just reverse the link. IIRC they use a dual cable, one pulling one way for higher ratios, and the other the other way for lower ratios. Make or mod a shifter to pull two cables at the same time.

Alternately, use the MCU-controlled devkit's electronic shifter on both, and just one control for them, reversing the voltage ramp with an inverting op-amp for one of them if they must shift opposite.

(pardon the OT; I just didnt' want to intrude on the UC forum just for this, especially since I'm not certain I totally understand the problem)
 
amberwolf said:
justin_le said:
if I I'm gonna have a vehicle that has additional gearing complexity it'll be on something much sillier like this:
http://www.unicyclist.com/forums/showthread.php?t=89581
Regarding the shifting issue with dual NuVincis, why not just mechanically link them, so they shift the same at the same time? If they need to shift opposite of each other, just reverse the link. IIRC they use a dual cable, one pulling one way for higher ratios, and the other the other way for lower ratios. Make or mod a shifter to pull two cables at the same time.

(pardon the OT; I just didnt' want to intrude on the UC forum just for this, especially since I'm not certain I totally understand the problem)

This is indeed rather OT to the RC thread, but of great interest to me anyways ;). Linked shifting between two nuvinci's isn't in principle a problem, it's more the weight of two Nuvinci's that I wanted to avoid. So the ability to achieve reverse pedal torques with a single overruning clutch rather than an entire 2nd hub seems like a great plan, even if it means that the reverse direction gearing is of a fixed ratio.

Justin
 
Grinhill said:
This looks great - less wires & less boxes always good.

I have just placed my order for one.

Thanks. :D

OK guys, so we had some other rather pressing things come up at the shop this past week, and the first batch of RC/CA's didn't quite get completed and shipped out on Friday as hoped, but it's getting quite close. All are programmed and calibrated and just needing the rear enclosure screwed on:

RC CAs in Box.jpg

There are still a few unclaimed so if anyone else wants to be in on this first batch feel free to place the order at:
http://www.ebikes.ca/store/store_rc.php

And just to clarify, we will be including one of the 6-pin female JST pigtail conncetors and a pair of smaller metal shunts for free with each device so that people can try doing the direct plug to controller mod as I showed in the castle creations device. As well, the 5V output on the yellow wire goes through a schottky diode, so it won't mess anything up if you connected it to a ESC that has an onboard BEC operating at more than 5V.

Justin
 
http://endless-sphere.com/forums/viewtopic.php?f=28&t=29846&hilit=beta+cycle+analyst#p431135
justin_le said:
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.

file.php

Justin,

Any reason you are going for a 25ms between pulses? I thought the standard was 20ms.

- Adrian
 
adrian_sm said:
Justin,
Any reason you are going for a 25ms between pulses? I thought the standard was 20ms.
- Adrian

Indeed there is a reason, which is that the CA main code already operates on a 25mS loop cycle. So it was quite convenient to time the output pulse updates to that rather than have them run somewhat asynchronously, especially since it seems that all the RC controllers are quite flexible in the actual time between pulses. Hopefully this isn't an issue. If anyone is aware of any controllers that do have an issue with a 25mS rather than 20mS pulse spacing then let me know.

Justin
 
I safely received my CD-LRC, and just got a chance to wire it up and try it out on my Commuter Booster. And it works ! Yah.

Here is what I had to do to get it up and running.
- put some Anderson PP on the molded shunt
- put a servo connector on the throttle out wire
- connect everything up on the bike
- adjust a few settings (wheel size, Low Volts Limit, ITerm Min)

Too easy.

Here are my notes:
(1) Large Screen
- this is the first large screen CA I have seen, and it is huge.
- I think I prefer the smaller screen size for an ebike. But that is just my preference.

(2) Backlight
- The back light seems to dim when the ESC is turned on.
- My ESC has a BEC so I assume this has something to do with the 5.5V on the throttle out line becoming active

(3) Throttle Out PWM
- PWM loop cycle was measured at 40Hz, so 25ms loop cycle appears to be accurate.
- but PWM pulse widths appears to be a little off.
- I had ITerm Max @ 2.00 ms, and ITerm Min @ 1.10 ms, but measured 2.10ms & 1.16ms with my osciloscope.
IMAGE023.png
IMAGE024.png

(4) Hall Throttle
- disconnecting the hall throttle input, makes the drive go full throttle :shock:
- disconnecting the hall throttle input, and turning the ESC off (so no 5V supplied) makes the CA screen contrast go weird, making the screen difficult to read.
fr_1064_size580.jpg
fr_1063_size580.jpg
- There is a lot of dead range on the hall throttle at both bottom end and top.:
--- 0-30% rotation = zero throttle
--- 30-50% rotation = 0-100% throttle
--- 50-100% rotation = 100% throttle

(5) Throttle response
- is very rapid with default settings
- I haven't adjusted the settings yet.

(6) Shunt
- Current readings appear to be off. This is a comparison between CA display, and readings by a DMM
---- (zero throttle) CA = 0.21A , DMM = 0.098 Amps
---- (full throttle) CA = 5.3A, DMM = 3.70 Amps
- Set RShunt = 1.000mOhm

(7) Volts
- Volt readings seem about right.
- CA = 19.1 V
- Turnigy Watt Meter = 19.27 V
- DMM = 19.25 V

So my questions are:
(1) Can I adjust the input throttle range to suit the hall throttle?
(2) The current readings seem to be out by a fair way. Should I just zero the amps, test again, and adjust the RShunt value accordingly?

- Adrian
 
Nice bit of detail there Adrian. Thanks for that. Gives me a heads up on what to expect when I fire mine up tomorrow for some testing. The throttle control when Justin demonstrated the unit looked quite linear over the full range so hopefully is just a bit of tuning required.
 
adrian_sm said:
I safely received my CD-LRC, and just got a chance to wire it up and try it out on my Commuter Booster. And it works ! Yah.

Hey Good.

(2) Backlight
- The back light seems to dim when the ESC is turned on.
- My ESC has a BEC so I assume this has something to do with the 5.5V on the throttle out line becoming active

The backlighting brightness will indeed be a function of how much current the CA is drawing, since all the CA current flows through the LED. So if there is something on the 5V line that is drawing current then that will increase the brightness a bit, and if this current draw stops then the backlight will dim to the normal state. Hopefully in most people's application the current draw on the 5V line if they are using it will remain steady so there isn't ever any flicker or change in brightness.

(3) Throttle Out PWM
- but PWM pulse widths appears to be a little off.
- I had ITerm Max @ 2.00 ms, and ITerm Min @ 1.10 ms, but measured 2.10ms & 1.16ms with my osciloscope.

Correct! I forgot to mention that, but due to limited code space I didn't have the ability do an exact scaling between what was initially a voltage input and turning it to a mS value. I need to look at the code again to get the exact scaling value, but yes as it is the output pulse will be about 5% longer than the "ITerm" entry. So if you want a 1.00 mS minimum pulse, you'll need to use 0.95 mS for ITermMin.

(4) Hall Throttle
- disconnecting the hall throttle input, makes the drive go full throttle :shock:

Aye, you're the second person to point this out. As it is the Vi is a floating high impedance input so if nothing is connected it could drift either high or low. In future builds that have a throttle output like this, we will add a pull-down resistor between Vi and Gnd, and then it will be forced low if the throttle is unplugged. If anyone else has this issue, any resistor between 10K to 100K soldered between the throttle signal line and Gnd will ensure that system goes off if throttle unplugged.

- disconnecting the hall throttle input, and turning the ESC off (so no 5V supplied) makes the CA screen contrast go weird, making the screen difficult to read.

That would probably be because your ESC is for some reason drawing power from the 5V line of the CA. If your ESC has an onboard BEC and doesn't need the 5V from the CA, try just detaching the yellow 5V line from the CA-DP cable. In general, the CA and ESC should both always turn on and off together via a switch or connector on the battery pack.

- There is a lot of dead range on the hall throttle at both bottom end and top.:
--- 0-30% rotation = zero throttle
--- 30-50% rotation = 0-100% throttle
--- 50-100% rotation = 100% throttle

The start of throttle range you set with the VAuxThresh value. So if you measure say 0.8V on the throttle signal line when it is off, you can set VAuxThresh to 0.85V if you want it to engage at the slightest throttle twist.

Remember that the CA is operating in current control mode, so unless you have the motor heavily loaded, the controller will go to 100% duty cycle even at just partial throttle. When the bike is loaded, you should find a fairly linear relationship in your current draw (From 0 to the Amps Limit value in the CA) to the throttle position.

(5) Throttle response
- is very rapid with default settings
- I haven't adjusted the settings yet.

Again, be sure to test it loaded on a bike rather than free standing

(6) Shunt
- Current readings appear to be off. This is a comparison between CA display, and readings by a DMM
---- (zero throttle) CA = 0.21A , DMM = 0.098 Amps
---- (full throttle) CA = 5.3A, DMM = 3.70 Amps
- Set RShunt = 1.000mOhm

Dopes, that was a mistake on my part, I wasn't around when the CA's got shipped and forgot to tell Adam to be sure that those devices going with a molded shunt had the RShunt value preset correctly. Try putting 1.42 mOhm in the RShunt and it should match the DMM pretty close.

Let us know how it goes after that (Calibrating RShunt, pull-down resistor on throttle, and using it with motor loaded on an ebike or with some kind of bench load)

-Justin
 
Also received my CA-LRC and hooked up directly to the HV160 as per Justin pictures on the previous page. So far so good, no dead spots using a Magura throttle on the unloaded test setup running at 6s. Will bump it up to 12s and see if I can test it out a bit more over the weekend.

2011-08-04223028.jpg


2011-08-04222735.jpg


2011-08-04222721-1.jpg
 
Thanks Justin.

ITerm Min & Max
- I adjusted them both down by ~5%
- now get the correct PWM signals.

RShunt
- Adjusted RShunt to 1.43 mOhm (from 1.00 mOhm(
- now getting accurate current readings.

Throttle Response
- previous testing was conducted under loaded conditions on a magnetic resistance bike trainer.
- the default settings were too aggressive for my system (Friction drive ~2000w)
- But mine is not a typical ebike, I have the added complexity that for the first fraction of a second the drive is not actually loaded, as I use the reaction torque from the motor startup torque to lift the motor into engagement with the tire. This obviously creates a step change in the load that takes time for the PI control to handle. By this time it has rapidly accelerated the motor to full RPM.
- So for this reason I need to slow down the acceleration rate of the motor to create the require reaction torque.

PI tuning
- Adjusted the IntAGain down from 300 to 50
- I now have the required slow throttle response (for my friction drive), and it seems to settle on load changes fairly well on the bike trainer.

Request
- A throttle pass through would be good.
- I expected when I turned Aux Voltage to Off, that it would just pass through the hall throttle signal to a PWM signal without any limitting be performed.

Summary:
- It works !
- Once the pull-down resistor on the throttle is implemented, this will be a great solution for RC drives. Both direct drive (via chain/belt etc), and friction drives like mine or Keplers.


Again, awesome work Justin.

Cheers, Adrian.
 
adrian just wondering if you have tried it while on the bike yet.....

I have fired mine up and played a little with the settings but i get this feeling if you set say 30% throttle, the motor will still reach 100%rpm. This in my mind seems fine as you would accelerate up to a speed and then cruise at say 60km/h where once that would of been 95% thottle position - > is now 25% throttle position because that is all the Amps it takes to overcome the drag of travelling at that speed. I just wonder whether it feels like that in real application or whether it feels abnormal.

One other thing i noticed was there was sometimes a harsh start up and sometimes not, say if i set the amplimit to 2A (bench testing) and gave it a very small amount of throttle (5%) it would start up slowly building rpm...like you would expect. But if i then released the throttle and waited for the motor to stop and applied it again to around 5% or so the motor would jump to life and not have the steady increase that it had before. Also when doing these kind of low throttle tests I also noticed there was a delay in the motor starting, that was not always present. Maybe that might be due to a dead zone between the CA output and the esc start up pwm that I could tune out of it with the settings. These problems might also be a product of the current limiting built into the hv160 which I havnt turned off.

Lastly the only other thing that is a bit annoying is that (using a castle hv160) when you enter the setup menu and the power is removed (i forget where from) the esc becomes disabled (which is fine.....who wants to be changing settings while flying down a track) but the problem is when you exit the menu and the power is reapplied, the esc thinks its had an event of loosing signal from the receiver (CA....which it did) and beeps constantly till it is power cycled. This may be not changeable but worth while noting in the manual that the system will need a power cycle after entering the setup menu.

Im so keen to test it out on an actual bike....pitty i dont have any even close to being finished yet LOL

Cheers
 
Hey,

I am on kiddy duties now Monday's & Tuesday's, and weekends are generally a right off, so I won't get a decent road ride until Wednesday.

rodgah said:
I have fired mine up and played a little with the settings but i get this feeling if you set say 30% throttle, the motor will still reach 100%rpm. This in my mind seems fine as you would accelerate up to a speed and then cruise at say 60km/h where once that would of been 95% thottle position - > is now 25% throttle position because that is all the Amps it takes to overcome the drag of travelling at that speed. I just wonder whether it feels like that in real application or whether it feels abnormal.

Yep. This sounds like you are describing the difference between a current throttle, and a "normal" throttle that just enforces a certain PWM.
But remember BEMF will come into play so I doubt it would be 25% throttle at 60kph. But it should give you much more feel, and would have been an awesome option for your twin astro setup.

rodgah said:
One other thing i noticed was there was sometimes a harsh start up and sometimes not, say if i set the amplimit to 2A (bench testing) and gave it a very small amount of throttle (5%) it would start up slowly building rpm...like you would expect. But if i then released the throttle and waited for the motor to stop and applied it again to around 5% or so the motor would jump to life and not have the steady increase that it had before.

Hmm. Maybe something to do with how the PID is tuned. If it still has too much "I" component, it may have a smaller "I" error accumulated, and therefore be respond slower. Just a guess. I ams still learning how to tune PID loops properly.

rodgah said:
Also when doing these kind of low throttle tests I also noticed there was a delay in the motor starting, that was not always present. Maybe that might be due to a dead zone between the CA output and the esc start up pwm that I could tune out of it with the settings. These problems might also be a product of the current limiting built into the hv160 which I havnt turned off.

I would put money on the PWM range not being right, but I don't have any experience with the CC ESCs.

I'll get some decent road time on Wednesday (weather permitting) and post up the results.

- Adrian
 
Fired my unit up today on the Kepler eboost drive. nice tidy installation with the potted shunt fitting inside the ESC compartment of the drive leaving only the battery wires and CA plug protruding from the drive for connection.

I haven't had an opportunity to road test yet but the main thing is that it all works and was very easy to install.

I am not sure if current control is going to be my preferred control method but cant judge until I get some testing in.

Do we have the option of of running in voltage mode or are we locked into current mode only?
 
Kepler said:
Fired my unit up today on the Kepler eboost drive. nice tidy installation with the potted shunt fitting inside the ESC compartment of the drive leaving only the battery wires and CA plug protruding from the drive for connection.

I haven't had an opportunity to road test yet but the main thing is that it all works and was very easy to install.
I am not sure if current control is going to be my preferred control method but cant judge until I get some testing in.
Do we have the option of of running in voltage mode or are we locked into current mode only?

At the moment you can choose to run in current mode or actual speed control mode, as determined by the VAux setting. I'm quite curious to hear if it works well as a speed throttle or not. Since it's just a PI controller and not a PID controller, it can be a bit prone to overshoot - undershoot around the target speed and not stabilize as smooth as one would want, but depending on how you tune the two gains you might be able to get it to run well in this option.

Otherwise though yeah, there isn't a direct way to have the throttle just pass through proportionally into a PPM signal to the controller with the V2.24 beta firmware in these units.

-Justin
 
Hey Adrian and thanks for the additional feedback. Now that we know for sure that you aren't BigFail I can finally follow-up! (total teasing :wink: only just caught that whole thread today)

What you say below about the expected behavior of AuxVoltage Off expecting to be a pass through would make total sense in the context of an RC specific CA. But in the context of how AuxVoltage initially came to be implemented as a way to on the fly adjust either the speed or the current limit, when the CA's output normally sits and 5V and only goes down when one of those limits is exceeded, then you can understand the behavior that it did have.

The good news is that microchip finally released a 20pin chip in the same 16F family last month that has 8K rather than 4K of flash memory, so once I port it to that we can finally move past all of these memory space limitations and implement the throttle pass-through and other features without having to remove additional stuff.

-Justin

adrian_sm said:
Request
- A throttle pass through would be good.
- I expected when I turned Aux Voltage to Off, that it would just pass through the hall throttle signal to a PWM signal without any limitting be performed.

Summary:
- It works !
- Once the pull-down resistor on the throttle is implemented, this will be a great solution for RC drives. Both direct drive (via chain/belt etc), and friction drives like mine or Keplers.

Again, awesome work Justin.
Cheers, Adrian.
 
justin_le said:
Hey Adrian and thanks for the additional feedback. Now that we know for sure that you aren't BigFail I can finally follow-up! (total teasing :wink: only just caught that whole thread today)
:lol: I was actually really stressing over all that. But I am sure you have gone through a lot more stress than me over the last few days. :( I also want to join in the chorus in saying a huge thanks for all your efforts.

justin_le said:
What you say below about the expected behavior of AuxVoltage Off expecting to be a pass through would make total sense in the context of an RC specific CA. But in the context of how AuxVoltage initially came to be implemented as a way to on the fly adjust either the speed or the current limit, when the CA's output normally sits and 5V and only goes down when one of those limits is exceeded, then you can understand the behavior that it did have.
Ah. That make sense. I just assumed it was a memory limitation thing.

justin_le said:
The good news is that microchip finally released a 20pin chip in the same 16F family last month that has 8K rather than 4K of flash memory, so once I port it to that we can finally move past all of these memory space limitations and implement the throttle pass-through and other features without having to remove additional stuff.

-Justin
Hey that is great. I am sure there are quite a few little tweaks to the firmware and functionality that this will enable.

adrian_sm said:
I'll get some decent road time on Wednesday (weather permitting) and post up the results.
Unfortunately weather sucks today (and likely still wet for the next few days), and I still haven't waterproofed all the electronics for my test mule, so.... more road testing has been delayed. Sorry guys.

- Adrian
 
adrian_sm said:
justin_le said:
Hey Adrian and thanks for the additional feedback. Now that we know for sure that you aren't BigFail I can finally follow-up! (total teasing :wink: only just caught that whole thread today)
:lol: I was actually really stressing over all that. But I am sure you have gone through a lot more stress than me over the last few days. :( I also want to join in the chorus in saying a huge thanks for all your efforts.

- Adrian

Adrian's interaction on the forum and his excellent support of his friction drive has always been completely positive.
Now with Justin's CA-LRC both Adrian's and Kepler's friction drives will be that much more compelling.
 
Okay managed to get some testing in. I had the PI gains tuned for a low 10 amp limit (5s LiPo battery), and it had nice smooth engagement, no overshoot that I noticed on the bike (even though the CA managed to record a 28 amp peak), and it nicely kept amps at my selected setting. 8)

Then I upped the amp limit to 25 amps. This time throttle response is much much quicker (and not ideal for my drive), and oscillation was evident while it tried to keep amps at 25. Obviously I need to tweak the PI gains for my new power level.

But in an ideal world it would be nice if the gains didn't require tweaking if the amp limit changes. Any PID gurus out there know if this is even possible. Most people will probably just set it up for one limit and leave it alone so this is not a problem. but if you did want to change the amp limit, it does take quite a bit of tweaking to get the gains right again.

Oh, and here are some pics of it on my bike. And yes I tested it with a loose half twist throttle on my road bike, hence just a quick ride.

- Adrian

View attachment 1
 
I wish I could get out and test. Weather has been shocking. Maybe a bit tonight if I get home from work early enough.

Adrian, are you finding you need to set the IntAGain lower with a higher power setting to stop hunting?
 
I only had a quick play on the side of the road, as I didn't have much time. From memory I dropped both PSGain & ISGain by a factor of 2.5 thinking that would help, but didn't. Then decided I should actually understand what I am changing more before I stuff something up. Lucky I did because I was adjusting the wrong thing. :roll: RTFM

Now that I glanced at the manual, and tweaked things, it is playing nice at a higher power level. 8)
Smooth engagement, no overshoot, just works.

So now the settings for my CommuterBooster with a 63-74 200kv motor on 5s LiPo are (drum roll):
Code:
Amps Limt:      25A
Turn-On Speed:  6 kph
PSGain:         0.08
ISGain:         200
AGain:          10           (default was 300, 50 was the setting for 10 Amp limit)
VGain:          800
Th Mode:        R/C
ITerm Max:      1.90 ms      (this gives 2.00 ms PW)
ITerm Min:      1.05 ms      (this gives 1.10 ms PW)
Aux Voltage:    Amps Limit
Aux Threshold:  0.087 V      (can't remember if I tweaked this)
All in all very happy.

- Adrian
 
Thanks Adrian. Gives me a starting point. I will post up my teaks as soon as I have something useful. I need to understand the gain interactions better. For some reason I was under the impression that PSGain and ISGain had no effect in current mode with AGain being where main adjustments were needed. Need to read the manual descriptions very carefully :)
 
No. I think you are right. AGain is the one to tweak.
 
If you google for "PI tuning" you should find plenty of info that talks about various approaches. I know there are several different techniques. Some require you to know properties of the system, while others are purely experimental which is probably what you'd need here. You'd need to read the manual very carefully, though - there are several different ways to implement a PI controller, so you'd need to know at least a little bit about how Justin did it to be able to tune it properly. The most important difference I can think of is that sometimes the P and I gains are completely independent, while sometimes the I is chained after the P, so if you adjust P you need to change I to compensate.

AFAIK, though, the max current probably shouldn't affect the tuning. For the current control loop, I think the tuning will mostly depend just on the electrical characteristics of the motor and controller. Mostly the motor R. I don't think it should matter (much) what the current limit is, or whether you tune it while riding or on a trainer or whatnot. I suppose its possible there could be some impact depending on exactly how Justin implemented it...
 
I have had a chance to do some road testing last night and this morning. Really very easy to get the CA dialed in. I started with Adrian's settings which basically worked fine for my drive also.

I did my testing with a 63-74 200kv, Turnigy K-Force 100 ESC, and 6S pack.

Dialed in a 40A limit and found that the AGain needed to be lower. Ended up going down to an AGain of 2 which makes for a nice soft ramp and ensures no sync loss issues even when slamming the throttle to full at low speeds. Also set the start speed to 8 kph just for a little more sync safety margin.

I think higher quality ESCs like a Castle will handle higher AGain settings but its really nice to be able to make these low cost ESCs work nicely also.

Its worth setting the ESC's inbuilt ramp to the fastest setting also so the CA inputs will react more quickly and give better control.

The only minor issue I have is that there is no ramp down on throttle off. For most applications this isn't an issue but for my drive, it benefits from a ramp down on throttle off so it hits the park end stop more softly. I think I should be able to get around this though by using a Turnigy servo travel speed module in the in between the CA and ESC.

I really like the current control setup of the CA and seems to suit my drive perfectly. Also its ability to control the current in a stable manor is very good.

Well done Justin. You are onto a winner here and i think it will prove to be a very popular choice for the RC ebike builders out there.

One last comment. Although the large screen is brilliant to see, its physical size does overpower the overall look of the bike. If a bike is purely an ebike then this is not such an issue. However, if you are looking for a more stealth approach as some of these RC drives are looking to do, the huge screen does end up spoiling the effect a little.

My personal vote is for the smaller screen however I fully understand need to try and standardise a product to reduce manufacturing costs. Certainly the large screen wont stop me purchasing further units however I think the feed back is important.
 
Back
Top