Changing FOC Switching frequency

quoted from another page…

in response to a question where the op had 1-16KHz choices with his ESC software.

PWM frequency has no effect on maximum torque and rpm, because at full power the PWM ratio is 100% (full on) so there is no frequency. At lower PWM ratios the frequency has an effect on motor efficiency and throttle linearity - the lower the frequency the worse it gets.

PWM controls motor speed by switching the power on and off rapidly with a varying ratio, so the motor is getting getting a series of full power pulses. At low PWM frequency this causes extra loss due to vibration and current surges, but the increased rms current and voltage at mid throttle causes the motor to produce more torque and rpm than it would with the equivalent DC voltage. So you might think that it’s more powerful, but that’s only because the throttle response is non-linear. In reality more power is lost due to the higher rms current heating up the windings more, and the vibration wasting energy in the gears etc.

As PWM frequency is increased the motor’s winding inductance begins to smooth out current flow, so the motor runs more efficiently due to lower rms current and torque ripple. On the down side, higher PWM frequency causes higher loss in the controller. So you should choose a frequency high enough to make the motor run smoothly without making the controller get too hot. Inductance is proportional to number of turns, so the 13.5T motor could get away with a lower PWM frequency than the 4.5T. However if the controller can handle it I would just choose 16KHz for both.

3 Likes

@Deckoz thanks for bearing with me on these side questions, but back to the op’s question and adjusting the F_SW, if we could. Why do you run it down at 20,000? The OP @RiGo also went down and it seems ironic as its quieter and smoother, isn’t that supposed to be happening at the higher frequency? I haven’t had a chance to mess with the F_SW yet but would like to know the possible dangers or limits. Do you think a hub motor would more so benefit from a higher frequency than a motor with a 3:1 pulley?

are you saying this is the lower limit of the F_SW? is there an upper limit or a danger in going too low or high, maybe within reason?

whats this?

1 Like

today I tested FOC-30khz on both my Maytech 4.12 (C18-Modded) vescs. The noise difference is incredible :slight_smile:

(( Default 20khz -> 30khz ))

4 Likes

Mosfet temperatures are the same?

Yeah I was concerned about that, but didn‘t observe any difference. I run the Mosfets/drvs (for now) without heatsink in a ABS enclosure. T_max 40 degC rinding pretty hard (just 7km thoug)

Built myself a VESC based Dyno system to investigate motor efficiency. This plot is pretty interesting. All runs except red on were at same settings, but default 20khz switching frequency. Red one is at 25khz. I didn’t redetect the motor, as someone mentioned above, but i kinda don’t see that changing anything. switching%20frequency%20investigation

Other than the red line, the color is a ballpark motor temperature guide. Warmer colors are warmer temperatures.

Thought y’all might be interested in some data in the conversation about switching frequency. Not that it matters to everyone, but it’s interesting and important to some.

10 Likes

Did a few more tests. Redetected for with the 16khz selected (didn’t improve matters). Reset to 20khz and ran another test (run 15, purple). It aligns nicely with prior results, so nothing much changed. However, even 1 khz above or below 20khz, and efficiency is dramatically reduced. Interesting. Seems like perhaps there is a setting that’s hardcoded in the firmware that assumes 20khz. Perhaps something optimized about the MOSFETs? Any ideas?

switching%20frequency%20investigation_2

7 Likes

are you running the latest firmware?

Yep, 3.40.

1 Like

Really interesting results, I can try to do the same route with both settings to see if in the daily use there is this big difference

Watch out a bit if you do Pedrodemio, if the lower switching frequencies really are this much less efficient, you’ll get much more heating (or noise?) from your motor/controller. Energy has to go somewhere, right?

2 Likes

I will log both rides and post here, but I will have to wait the weather to calm down, it’s pretty windy these last days which would interfere with the test, unfortunately I don’t have thermistors on the motors, but will put in a few weeks and we can see if the diference show up

But, and a big but, I remember the first time I rode this new board and was getting around 8 Wh/km, but the noise was really bad and after a few weeks changed to 30 kHz, now after lots of kilometers my global consumption is 9,7 Wh/km. I always attributed that to being accustomed with the board, but maybe there is more to it

1 Like

Do you have any documentation of your test setup anywhere? Would love to see it!

4 Likes

To confirm the temp sensor is in the motor not the esc right? Maybe it would depend on the amount of inductance and kv

Not great documentation, yet. I’ll document it a bit more completely soon (days?). For now here are the main points.

  1. Custom python script, commanding test motor, brake motor, and an arduino reading a load cell via usb/serial.
  2. Cheap Load cell, 5kg.
  3. Custom frame. The motor that is cantilevered out has a “tailstock” type support to limit vibrations i was getting at certain rpms. Two motor shafts rigidly connected together.
  4. Two identical batteries, 8s lipo, 6000mah. One draining, one regeneratively charging.

Basic script flow- Test motor commanded to run at a duty cycle or rpm (doesn’t seem to matter). Basically run as fast as it can. It has a VESC power limit of 450w (constraint simulating my application). The brake motor is spun up by the test motor. When at top speed, it’s commanded to gradually increase braking current until it’s loaded the test motor to its power limit. From here, take a set of x samples, average them, check their standard deviation. Assuming they’re pretty close, record stuff and increase the brake current a bit and do it again. If there is insufficient stability in test motor rpm, take a little longer to sample, but move on if it can’t stabilize in 100 samples. When it hits the lower test range limit, or one of the other limit parameters are reached (too much current, battery too full/empty etc), quit. It dumps a bunch of data to a csv, and i load that into excel to graph and compare.

IMG_20181107_181611

IMG_20181107_181604

IMG_20181107_181629

7 Likes

Really nice setup

These motors you are using have a nigher pole count right? Maybe the higher inductance of them has something to do, but it still doesn’t make sense that inly 20 kHz is the most efficient, have you tried something like 20001 Hz or other small variation?

Testing the other motor in this current setup. Stock length wires (hella long). This one seems to like higher switching frequencies better, leading me away from the conclusion that the VESC had some build in bias towards 20khz. Just a coincidence on the last motor. Only a few runs, but the trend is pretty clear, i think. Not really anywhere enough data to draw really confident conclusions, but it’s better than nothing.

turnigy%20multistar%20100kv

1 Like

Pedrodemio, yeah my application is a solar powered boat, so ideally i’m looking for low rpm, high efficiency motors. I’ve also tested (before the setup was as dialed as it is now; no “tailstock” before) a popular eskate motor, the Turnigy sk3 260kv. I’ll return to that one to do some more testing. I didn’t try different switching frequencies on that, didn’t think it’d have much effect, but i’m proving myself wrong on that :slight_smile:

combined_new_routine

3 Likes

Regarding the data. What does it mean in terms of torque produced?

Nice, to you have more info about it somewhere?

Also it may be worth testing in BLDC, even if it will be probably less efficient