Changing FOC Switching frequency

I just measured (with the vesc) each of the motors in the setup, and the two i posted plots for yesterday. The more efficient of the two (HobbyWing x-rotor 8120-100kv) is at 6.27uH The less efficient, (Turnigy 9235-100KV Multistar ) is at 11.14uH.

I’m going to set up the scope in a second and see what i can see.

@Petertaylor do you think the “more efficient” motor has lower inductance from having less iron/stator volume and therefore more room for copper… lower resistance & lower inductance… more efficiency?

good question. I’m absolutely no expert on this stuff (read on), so i really couldn’t tell. I’d like to know, but i’m not there yet :-/

Also, guess who just fried their usb o-scope? Yep, forgot that while i could drill-scope motors at low rpms and get low induced voltages, the Digilent AD2 only has a max voltage of 26v. The difference between phases on the motor was at ~50v at its peak. Looks like just one SMD component next to the usb port, but you never know. I’ll use this as an excuse to get a real scope…

So, the scope trace will have to wait until i get a real scope (few days? a week?)

Well, new scope here. Proper scope that can handle higher voltages. I was a dummy before, and it wasn’t the scopes fault. Anyhow. Currently can see each pulse, with a changing width to average to a sine wave, but need to figure out how the have the scope do the math/averaging to translate those small pulses into the sine wave it’s approximating. Any ideas?

edit: What i want is to graph the average voltage over a known and constant switching frequency. That’ll give an idea of what the sine-wave should be looking like. I’m a rookie with scopes.

1 Like

What if you did an analog low pass filter before the scope? Just a resistor and a capacitor

Yeah, that’s kinda were i think this is headed. Been futzing around with Low Pass filters on the scope directly, but the resolution of the result is either ok and noisy, or lousy resolution and smooth, but the oddities from the imperfect sine wave back emf and switching frequency changes will be lost. Grrr. It’s always something.

The worry is that by adding a filter, i’ll smooth out the stuff i’m looking to detect. Trying to simulate a filter now. since the FOC sine wave period is variable (with rpm), the filter needs to be adjustable too, unless i’m happy running tests only at one eprm. Wondering if i can’t capture a wave and do the moving average in excel ort whatever. Definitely slower, but the variables are easily controlled.

1 Like

MATLAB has some pretty powerful filtering tools in Simulink, might be worth a look

About the real life efficiency test is in my todo list, the weather is not cooperating, it hasn’t stopped raining for enough time for the pavement to dry and to make all test in one go

Yeah, i don’t have matlab, and it’s not free. I’m a student, so i think i can discounted SW, but free is better :slight_smile: I’ve used octave quite a bit, but haven’t seen anything there that looks like it’d help too much. I’m pursuing the excel path as we speak, will see how far i can get with that.
Not really a big fan of matlab or octave tbh. I don’t really see what it does that python with numpy and the various other libraries can’t do, but that’s probably my inexperience with the software/applications it’s useful for.

1 Like

Well, i’m getting the same thing when doing the analysis on the computer. Excel croaks past 1M lines, but the interface for the usb scope i blew up accepts the output from my new scope. It’s reasonably fast at processing it all too. 6M samples was enough data without taking 20 minutes to write to thumb drive, but after applying a low pass filter, the results are still total mush.

vesc%20waveform2

Low pass filtering just isn’t the way. All the detail is gone (stands to reason peter, duh). The switching is clearly visible, and the underlying sine is there too. It’s the right frequency (i was running at 12000erpm so 200 electric revs/sec = 5ms period. There has to be a smarter filter to apply, or some other method. Perhaps not trying to see the sine wave but more looking for the noise or deviation from a perfect sine of the same frequency?

I’m measuring one phase relative to ground. Don’t think there is any other way to do it differently.

Not sure what the right way is. Also, i’ve gotten sidetracked. Seeing the waveform is interesting, and i don’t like to back down from a challenge/failure, but having the knowledge that for whatever reason efficiency is highest at 20khz (vesc 6) is the thing i came for. I’ve got a few more motors to test on the dyno. I’ll give the waveform question some thought. If someone has some good ideas, i’d like to know. I can do some more testing as suggestions pop up. if anyone wants the raw capture data (120mb csv file), lemme know. I’ll ask the grey-beards i know too.

One day i’ll figure it all out.

2 Likes

I got lost a bit, what are you trying to visualize? The sine wave smoothed out? Like the motor would see?

So i’m trying to figure out what’s changing, or why there is a drop in efficiency when the PWM switching frequency is changed from the default of 20khz.

I hoped to be able to run a motor at a constant load on the dyno, scope the waveform, change the switching frequency, run the same motor, same load, same everything (except pwm freq.) and scope that new waveform. I expected to see something that illuminated why 20khz was preferred. Is the sine fatter? Skinnier? Is there a lump in it? I guess i’m hung up on seeing a sine wave. That likely isn’t necessary. Perhaps a FFT plot will show some harmonic? Maybe looking at each pulse away from 20khz will show a weird shape, slow rise or fall time? Not sure what would cause this decrease in efficiency, but it’s gotta be in there somewhere…

In general, lower pwm frequencies should deliver high efficiencies, and yet that’s not what my tests have shown, on two seperate motors with multiple runs out of sequence with each other.

1 Like

Yeah, FFT is your best bet, if something is different it will definitely show there

Another thing, where are you getting the current sensing? Using vesc itself to log? Maybe there is something going on just on the measurements of the power and energy

1 Like

Measure with the motor attached or another inductor – and run motor detection with the scope attached first. Maybe?

Definitely agree to use external power measurement from the vesc. Depending on duty cycle/sampling window/load I’ve seen very strange outputs from the current sensing of the vesc at times.

1 Like

I think that only real life test without having an external meter would be run the board to empty ridding at the same conditions

I may do that but only charging to 36v or something like that, doing the same circuit at constant speed for 40km does not sound fun, did it once to test my range under ideal conditions

Deodand, Pedrodemio I’ve been doing the current and voltage measurement from the vesc via python. Seems accurate enough for what i’m doing, particularly since i’m averaging 10 samples to come up with my measurements. Likely the vesc is already doing some averaging internally to get the result it presents. I’ve got an inline current sensor i can use, it’d just take changing the code, and having the arduino read that input and send it to the computer. Don’t think it’ll matter though. Look at the curves posted earlier. Pretty obvious trends for the most part.

I’m not measuring current at all on the scope however, just voltage. I guess the inductive qualities of the motor might(/should if the controller is doing its job?) be enough to smooth/average the wave and let me see what i want to see on the scope. Not sure how to best measure current on a scope without expensive probes :-/

I did try a super low tech idea, which was to probe a wire wrapped around one of the insulated phases coming out of the vesc. Saw a steppy looking wave that approximated a sine, but it was at 10khz (this was with the other vecc, 4.12 hardware, so half of 20khz programmed frequency). That frequency means it’s just a modified version of the pwm pulses, and not indicative of current sine wave. I should have got 200hz for the current sine wave. The steps were the EM waves from the nearby two other phases, i think. Thoughts?

b624, not sure what that would get me. Do you think the scope is interfering with the motor and should be in the system during detection? It should be basically invisible to theses voltages and currents.

I think it’s worth a try using your external current measurement, as @Deodand said the vesc measurements can be really off it for example the energy sampling is hardcoded somewhere and it gets out of sync by changing the switching frequency

Did you post anything or vedders forum? He take a long time to reply but this discussion is extremely important in my point o view, we try a lot of thing to make our boards more efficient, but if we throwing energy out just to make out boards silent it needs to be reviewed

@trampa could you please talk to Benjamim about it? Just see what he has to say, thanks

1 Like

I will, but please open a thread on vesc-project.com. For the motors we use, standard settings work just fine. There is probably little reason to change that, and little gain. We tested a 30kW 0.7uH inrunner last weekend and such a motor definitely needs a lot higher switching frequency. Most of the motors used in skateboarding are pretty similar outrunners.

Probably it’s possible to auto tune the switching frequency. Benjamin is currently working on auto everything that can possibly be automated. Many things are not trivial though.

Or if you throw energy out using no gearing…The correct transmission and matched motor has magnitudes more impact on efficiency. Also choice of wheels, surface of the track, ride style etc. impacts the efficiency a lot. Battery pack size, battery voltage, voltage sag, twin or single drive… If your motor and ESC stays cool, you are not experiencing drastic losses. Losses always go into heat. You could just monitor temperatures while playing around. Things will also depend on the design of the ESC. The three phase shunts design of the VESC 6 improved FOC big time. Data readings are more precise and in consequence FOC computation is a lot more precise.

1 Like

Interesting point, if you had identical vesc’s the delta T of each one could be looked at as a possible measure of efficiency for the motor controller itself at the end of the test… of course the motor itself may have more or less losses depending on switching frequency also. I’d guess it depends on the impedance of the L-R circuit within the windings, such a circuit will have a frequency response plot and will be most efficient near the peak of said plot.

Also @trampa I think this project can be seen as a good way to look at individual factors and how they play into the vesc performance alone. One need not take a global view of the entire skateboard all the time. Even if the efficiency gain for the entire system isn’t significant it could improve the relative efficiency of the vesc itself which would enable larger current throughput at that stage provided you have ample sized motors to handle it.

3 Likes