Author Topic: Motion control, S-curves and other stuff >> controlling lift with DC motor  (Read 8749 times)

0 Members and 1 Guest are viewing this topic.

Offline capt bullshot

  • Super Contributor
  • ***
  • Posts: 3033
  • Country: de
    • Mostly useless stuff, but nice to have: wunderkis.de
Re: Motion control, S-curves and other stuff >> controlling lift with DC motor
« Reply #50 on: October 23, 2019, 09:14:26 pm »
Quote
I have to investigate what is the real source of that problem.
Good luck, I'm quite confident you're able to find the root cause.

Need 50kHz or not: No idea, except higher switching frequency allows for lower inductance. That particular motor indeed is pretty low inductance, so 20kHz to 100kHz looks appropriate for a rated 100uH / real 30uH. Not a big deal for modern MOSFETs.

Running the timer @ 144MHz: should work if the datasheet says so ;)

Safety devices hinder evolution
 

Offline krisRabaTopic starter

  • Regular Contributor
  • *
  • Posts: 59
  • Country: pl
Re: Motion control, S-curves and other stuff >> controlling lift with DC motor
« Reply #51 on: October 24, 2019, 08:35:21 am »
Ok, problem solved and actually it was something stupid ;-) I forgot that value written to BDTR (DTG) register to set deadtime is related to timer clock  :palm: so after increasing clock frequency effective deadtime was decreased proportionally ;-) After increasing it as well power stage is cool as usually  :-/O
And signals from MCU looks ugly now.. but only with ground lead ;-) With spring ground connection on probe it is OK.

But I will think about decreasing gate resistors a little bit. Now 10R is used so small bannana shape is visible on gate charging and discharging. Or maybe I will add diode+resistor in parallel just to turn it off faster and keep slower turn on time because of EMI...

And what is most important current ripple significantly decreased with 50kHz PWM ;-) I wonder what will be the effect of additional chokes in serie, it should be even better ;-)
 
The following users thanked this post: capt bullshot

Offline capt bullshot

  • Super Contributor
  • ***
  • Posts: 3033
  • Country: de
    • Mostly useless stuff, but nice to have: wunderkis.de
Re: Motion control, S-curves and other stuff >> controlling lift with DC motor
« Reply #52 on: October 24, 2019, 09:20:47 am »
Ok, problem solved and actually it was something stupid ;-) I forgot that value written to BDTR (DTG) register to set deadtime is related to timer clock  :palm: so after increasing clock frequency effective deadtime was decreased proportionally ;-) After increasing it as well power stage is cool as usually  :-/
Business as usual ;)

Quote
And signals from MCU looks ugly now.. but only with ground lead ;-) With spring ground connection on probe it is OK.
Business as usual ;)

Quote
But I will think about decreasing gate resistors a little bit. Now 10R is used so small bannana shape is visible on gate charging and discharging. Or maybe I will add diode+resistor in parallel just to turn it off faster and keep slower turn on time because of EMI...
I've seen higher gate resistances working just fine - depends on the MOSFETs and it's just the usual power dissipation vs. EMI tradeoff game   >:D

Quote
And what is most important current ripple significantly decreased with 50kHz PWM ;-) I wonder what will be the effect of additional chokes in serie, it should be even better ;-)
Business as usual  :-+
Safety devices hinder evolution
 

Offline krisRabaTopic starter

  • Regular Contributor
  • *
  • Posts: 59
  • Country: pl
Re: Motion control, S-curves and other stuff >> controlling lift with DC motor
« Reply #53 on: October 24, 2019, 10:00:24 am »
Quote
But I will think about decreasing gate resistors a little bit. Now 10R is used so small bannana shape is visible on gate charging and discharging. Or maybe I will add diode+resistor in parallel just to turn it off faster and keep slower turn on time because of EMI...
I've seen higher gate resistances working just fine - depends on the MOSFETs and it's just the usual power dissipation vs. EMI tradeoff game   >:D
Yes, I know. I have seen even 100R in ST BLDC controller ;) Worked well with 6-step but it was a tragedy when I was trying to implement sinusoidal driving and had to be reduced ;) So it also depends on control scheme and your needs. But I am also aware that high rise times look good on DSO but are your enemy in EMI ;) But on other hand additional inductance should add some slope ;) I have just checked that driver already has 5R of internal resistance for LOW TO HIGH transition and 0.55R for HIGH TO LOW transition so it is already asymmetric. I will leave that for further testing in the future ;)

Quote
And what is most important current ripple significantly decreased with 50kHz PWM ;-) I wonder what will be the effect of additional chokes in serie, it should be even better ;-)
Business as usual  :-+
I have added 2x 4,7uH in series with motor windings and just as expected, current ripple has been decreased. It is not enormous change, something about 25%, but always something is better than nothing  :-+ Does it mean that effective inductance of motor is about 37,6uH? I think so and it sounds quite realistic. It would be 36,5% of 103uH presented in datasheet and they were talking about 30-80% for calculations..
 

Offline capt bullshot

  • Super Contributor
  • ***
  • Posts: 3033
  • Country: de
    • Mostly useless stuff, but nice to have: wunderkis.de
Re: Motion control, S-curves and other stuff >> controlling lift with DC motor
« Reply #54 on: October 24, 2019, 10:11:44 am »
I have added 2x 4,7uH in series with motor windings and just as expected, current ripple has been decreased. It is not enormous change, something about 25%, but always something is better than nothing  :-+ Does it mean that effective inductance of motor is about 37,6uH? I think so and it sounds quite realistic. It would be 36,5% of 103uH presented in datasheet and they were talking about 30-80% for calculations..

Yes, I'd agree using the same rough (and probably incorrect) calculation pointing to the ballpark range. Good enough for a plausible estimate.
Safety devices hinder evolution
 

Offline krisRabaTopic starter

  • Regular Contributor
  • *
  • Posts: 59
  • Country: pl
Re: Motion control, S-curves and other stuff >> controlling lift with DC motor
« Reply #55 on: October 24, 2019, 11:03:00 am »
I have added 2x 4,7uH in series with motor windings and just as expected, current ripple has been decreased. It is not enormous change, something about 25%, but always something is better than nothing  :-+ Does it mean that effective inductance of motor is about 37,6uH? I think so and it sounds quite realistic. It would be 36,5% of 103uH presented in datasheet and they were talking about 30-80% for calculations..

Yes, I'd agree using the same rough (and probably incorrect) calculation pointing to the ballpark range. Good enough for a plausible estimate.

The formula from mentioned earlier FAQ is ΔIppmax=Vcc/(2*Ltot*freq), where Ltot=Lint+0.3..0.8*Lmot+Lext [mH], freq in [kHz], so it can be correctly estimated that way, I think. Given change in ΔIppmax is caused by given change in Ltot, the rest is kept unchanged.
 

Offline capt bullshot

  • Super Contributor
  • ***
  • Posts: 3033
  • Country: de
    • Mostly useless stuff, but nice to have: wunderkis.de
Re: Motion control, S-curves and other stuff >> controlling lift with DC motor
« Reply #56 on: October 24, 2019, 11:50:17 am »
I have added 2x 4,7uH in series with motor windings and just as expected, current ripple has been decreased. It is not enormous change, something about 25%, but always something is better than nothing  :-+ Does it mean that effective inductance of motor is about 37,6uH? I think so and it sounds quite realistic. It would be 36,5% of 103uH presented in datasheet and they were talking about 30-80% for calculations..

Yes, I'd agree using the same rough (and probably incorrect) calculation pointing to the ballpark range. Good enough for a plausible estimate.

The formula from mentioned earlier FAQ is ΔIppmax=Vcc/(2*Ltot*freq), where Ltot=Lint+0.3..0.8*Lmot+Lext [mH], freq in [kHz], so it can be correctly estimated that way, I think. Given change in ΔIppmax is caused by given change in Ltot, the rest is kept unchanged.

Okay, I did a very simple linear calculation without even looking at that formula you mentioned (4.7uH * 2 * (1/0.25)) ( = 37.6 uH). So I can't be horribly wrong ;)
Safety devices hinder evolution
 

Offline krisRabaTopic starter

  • Regular Contributor
  • *
  • Posts: 59
  • Country: pl
Re: Motion control, S-curves and other stuff >> controlling lift with DC motor
« Reply #57 on: October 24, 2019, 12:39:32 pm »
Okay, I did a very simple linear calculation without even looking at that formula you mentioned (4.7uH * 2 * (1/0.25)) ( = 37.6 uH). So I can't be horribly wrong ;)
Yeah, this is how I did it at the first time as well - value estimated just from proportions ;) Then I only posted my response to your "(and probably incorrect)" senstence to show it doesn't have to be wrong because in mentioned formula relation is also linear (so no sqrt or ^2 etc)  :-+
 

Offline capt bullshot

  • Super Contributor
  • ***
  • Posts: 3033
  • Country: de
    • Mostly useless stuff, but nice to have: wunderkis.de
Re: Motion control, S-curves and other stuff >> controlling lift with DC motor
« Reply #58 on: October 24, 2019, 12:54:56 pm »
Okay, I did a very simple linear calculation without even looking at that formula you mentioned (4.7uH * 2 * (1/0.25)) ( = 37.6 uH). So I can't be horribly wrong ;)
Yeah, this is how I did it at the first time as well - value estimated just from proportions ;) Then I only posted my response to your "(and probably incorrect)" senstence to show it doesn't have to be wrong because in mentioned formula relation is also linear (so no sqrt or ^2 etc)  :-+

Yes, linear the relation is, no doubt, so linear estimation is correct. I'm still wondering if the ratio applied (1/ 0.25) is correct for this kind of relative change, or if I have to apply something like 1/x or (1 - x) on the 25% change, but meh, it's just an estimate, and I'm not in the mood to think about basic math ;)
Safety devices hinder evolution
 

Offline krisRabaTopic starter

  • Regular Contributor
  • *
  • Posts: 59
  • Country: pl
Re: Motion control, S-curves and other stuff >> controlling lift with DC motor
« Reply #59 on: October 24, 2019, 01:30:33 pm »
The formula from mentioned earlier FAQ is ΔIppmax=Vcc/(2*Ltot*freq), where Ltot=Lint+0.3..0.8*Lmot+Lext [mH], freq in [kHz], so it can be correctly estimated that way, I think. Given change in ΔIppmax is caused by given change in Ltot, the rest is kept unchanged.

You have two situations:

ΔIppmax=Vcc/(2*Ltot1*freq)  -> without additional inductance, Ltot1= Lmot_eff, where Lmot_eff = (0.3..0.8*Lmot)

and

0,75*ΔIppmax=Vcc/(2*Ltot2*freq) -> with additional inductance (Lint=2x4,7uH), Ltot2=Lint+Lmot_eff, where Lmot_eff = (0.3..0.8*Lmot)

then you can replace ΔIppmax in second one with the first one, so you get

0,75*(Vcc/(2*Ltot1*freq)) = Vcc/(2*Ltot2*freq)

and then you can remove things that are on both sides by multiplying both sides of the equation with (2*freq/Vcc) so this is what remains

0,75/(Ltot1) = 1/(Ltot2)

so finally

Ltot1 = 0,75*Ltot2

so

(Lmot_eff) = 0,75 * (Lint+Lmot_eff)

(1-0,75)*(Lmot_eff) = 0,75 * Lint

uhm.. s#!t..
(Lmot_eff) = 0,75 * Lint / 0,25 = 0,75 * 9,4uH / 0,25 = 28,2uH... ekhm... something is wrong here  :palm: :scared:

Eh, whatever  :-DD
« Last Edit: October 24, 2019, 01:35:19 pm by krisRaba »
 

Offline capt bullshot

  • Super Contributor
  • ***
  • Posts: 3033
  • Country: de
    • Mostly useless stuff, but nice to have: wunderkis.de
Re: Motion control, S-curves and other stuff >> controlling lift with DC motor
« Reply #60 on: October 24, 2019, 01:37:18 pm »
At least, 28.2 is a 25% error from 37.6 - perfectly matches the 25% lesser ripple. ROFLMAO and as I said - can't be horribly wrong and doesn't really matter for an expected 0.3 to 0.8 range of 100uH. Math is an asshole  8)
Safety devices hinder evolution
 

Offline krisRabaTopic starter

  • Regular Contributor
  • *
  • Posts: 59
  • Country: pl
Re: Motion control, S-curves and other stuff >> controlling lift with DC motor
« Reply #61 on: October 24, 2019, 01:50:08 pm »
Oh, interesting.. there was an error in previous estimation, I think, because when you compare results for calculations of ΔIppmax with Ltot1=Lmot_eff=28,2uH and with Ltot2=9,4+Lmot_eff=9,4+28,2=37,6uH ratio is 75% as it should.
When you take Ltot1=Lmot_eff=37,6uH and Ltot2=9,4+Lmot_eff=9,4+37,6=47uH ratio is 80% ;)
 

Offline capt bullshot

  • Super Contributor
  • ***
  • Posts: 3033
  • Country: de
    • Mostly useless stuff, but nice to have: wunderkis.de
Re: Motion control, S-curves and other stuff >> controlling lift with DC motor
« Reply #62 on: October 24, 2019, 02:03:46 pm »
I never stated whether 37.6uH is the total or motor only inductance  >:D
In fact, I believe I thought of it as the total inductance.

If you have a decent current probe in your lab, you can verify the theory by a practical measurement (calculate inductance from applied voltage step and current ramp over time). Kind of real time math, I like it that way, let the physics do all the hard calculation work in real time, and observe the results by accelerated electrons based (or a modern solid state variant) visualisation.
Safety devices hinder evolution
 

Offline krisRabaTopic starter

  • Regular Contributor
  • *
  • Posts: 59
  • Country: pl
Re: Motion control, S-curves and other stuff >> controlling lift with DC motor
« Reply #63 on: October 24, 2019, 07:49:17 pm »
I have to limit things that are not usefull in problems solving. Estimated value sounds realistic, current ripple decreased and along with 50kHz PWM looks much better on DSO now ;) Sometimes it is good to know some details, sometimes I am just curious and I dig a little bit deeper than needed but generally I have to move forward ;)

I think that it will be good to oversample and average current for smoother readings so I will try to sample in the middle of ON and OFF states (=100kSPS) and skip every second cycle in calculations (=25kHz), as in original controller, so I will have 4 samples to average before each current control loop call  :popcorn:
 

Offline krisRabaTopic starter

  • Regular Contributor
  • *
  • Posts: 59
  • Country: pl
Re: Motion control, S-curves and other stuff >> controlling lift with DC motor
« Reply #64 on: October 25, 2019, 04:52:41 pm »
I think that it will be good to oversample and average current for smoother readings so I will try to sample in the middle of ON and OFF states (=100kSPS) and skip every second cycle in calculations (=25kHz), as in original controller, so I will have 4 samples to average before each current control loop call  :popcorn:
Done! :D Maybe except "control loop call" :P But I have finally changed edge-aligned PWM to center-aligned mode, configured additional channel in asymmetric mode to generate TRGO2 with controlled delay that compensates feedback loop lag, and some additional "magic" on ADC to get 4 samples before interrupt that will execute current control loop :) A lot of tests performed to check all that synchro on DSO  :-DMM and it perfectly hits defined moments  :-+
Gosh, I love flexibility of these MCUs  :-*
 

Offline capt bullshot

  • Super Contributor
  • ***
  • Posts: 3033
  • Country: de
    • Mostly useless stuff, but nice to have: wunderkis.de
Re: Motion control, S-curves and other stuff >> controlling lift with DC motor
« Reply #65 on: October 25, 2019, 06:26:01 pm »
Great!  :-+ I like to follow your progress, and I acknowledge you focusing on the main progress. Often interesting details can distract from the actual work to do, I know this quite well.
Safety devices hinder evolution
 

Offline krisRabaTopic starter

  • Regular Contributor
  • *
  • Posts: 59
  • Country: pl
Re: Motion control, S-curves and other stuff >> controlling lift with DC motor
« Reply #66 on: October 25, 2019, 07:53:12 pm »
Nice to hear that ;-) I can still see a lot of views but visitors muted their keyboards ;-) So I was wondering if they are already bored :=\ or it's an effect of overwhelming calculations expanding to full screen  :wtf:  :-DD
I have to admit that many times when I open some document and see all these formulas I get a headache ;-) and feel high pressure to click [X]  :-DD

But this forum is great anyway because on some other I usually talk to myself, no response at all ;-) It also helps sometimes because I have to explain something and some ideas sprinkles when I have to organize information but it is always more interesting with any interaction ;-)
 

Offline capt bullshot

  • Super Contributor
  • ***
  • Posts: 3033
  • Country: de
    • Mostly useless stuff, but nice to have: wunderkis.de
Re: Motion control, S-curves and other stuff >> controlling lift with DC motor
« Reply #67 on: October 25, 2019, 08:03:36 pm »
Nice to hear that ;-) I can still see a lot of views but visitors muted their keyboards ;-)
...
But this forum is great anyway because on some other I usually talk to myself, no response at all ;-)

Yes, I know. I've opened a small number of threads regarding my private projects (rather presenting some results and linking to my homepage than asking for a particular help, but interested in comments), get visitors and a few comments, but forgotten after a few days.
Your project and thread is quite interesting, making a motor controller from scratch and you're not a pointless beginner asking very basic questions showing no knowledge at all. More like a dialogue with an fellow engineer. Such a dialogue is a source of inspiration and whatever ...

Safety devices hinder evolution
 

Offline krisRabaTopic starter

  • Regular Contributor
  • *
  • Posts: 59
  • Country: pl
Re: Motion control, S-curves and other stuff >> controlling lift with DC motor
« Reply #68 on: October 25, 2019, 08:42:58 pm »
So thumbs up for all "fellow engineers" that pushed this issue forward :-+ :-+ :-+ Even if responses count fades out quite a lot of usefull hints have been posted so far :)
And of course it's not over yet  :box:  ;)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf