Changing PWM dead time or other parameters with B-G431B-ESC1 board

Hey guys, I continue to try to make a very quiet fan driver. I am getting a persistent hum/ringing sound that increases in pitch with RPM. It increases slightly with voltage but not that much, and it sort of levels off.

It occurs even in fully open loop mode, where nothing happens except looping on motor.move().

I think it must be the dead time of the PWM driver stage or something. I need to to something to scootch the volume down.

I tried to read up in the docs of how to change this parameter, but… is it possible/supported on the B-G431B-ESC1? It is noticeably louder on the Lepton for some reason. It does not appear to be related to loop time, as the frequency is similar for both boards.

I tried

driver.dead_zone = 0.05;

to see if it made it louder or quieter, I think it might be a bit louder but not much. I tried 0.02 0.01 and 0.015, too. 0.01 leads to excessive current draw and mosfet overheating so maybe the deadtime is being adjusted, or maybe it’s going in jumps or something is going wrong.

I tried adding some inductors to smooth out ripple, 130 uh and also tried 1millihenry, equal on all phases of course. Doesn’t seem to make any difference. Maybe a very small capacitor on the other side of the inductors? I should probably look at the current waveform with my crummy scope before trying that… I actually have a current amplifier thing I can gerry rig now. It isn’t really made for high speed so it might smooth the signal and miss what I’m looking for but I can try it. I should get some 1 ohm resistors of larger size, I have some 0.1 ohm ones but they are too small,the voltage is too small for the scope to trigger properly.
Any ideas?

What is the max current for your fan?

3 posts were split to a new topic: Using stm studio for variable monitoring

@Anthony_Douglas , @Juan-Antonio_Soren_E made an interesting discovery yesterday regarding the dead-time - which could affect you if you’re trying to set larger dead-times, esp. in combination with slow PWM frequencies.

I’ve pushed a fix for this to the dev branch already.

1 Like

Even if the software deadtime is the same, the effective deadtime depends on the time the signal needs to propagate through the gate driver, the turn on/rise/turn off/fall time of the mosfets:

Which will lead to different phase current curves on different boards


Can you get an app like PhyPhox for your phone and find the frequency of the noise, and then also compare that with the RPM of the motor?

But who can afford a higher voltage scope? Maybe the local maker_forum has one or definitely the University has one. Getting involved with professional lab´s for this kind of thing is not affordable.

Can you recommend a good affordable scope, that will measure say up to 12v phases?

You don’t really need a scope, look at the current the firmware is sensing.
I shared one example how I did it here with a B-G431B-ESC1

1 Like

Hmm… Good point, maybe I should se if the webUSB protocol can work, as discussed here.

I mean I used STM Studio because I couldn’t get Serial to work yet, and I wasn’t sure if it’s fast enough. Webusb was just an idea. It’s not going to happen now.

Right you are!

I am then able to visualize the phase current in STM STUDIO:

Not now, maybe tomorrow :kissing_cat:

Edit: I see it uses a SWD connection for debugging. In its own way that is awesome, but unfortunately I cant access the SWD interface. Im using the lines for other purposes. Thinking about how I can optimize this, I could potentially use the Portenta (w. High-Speed USB) to measure the current on its really fast 16bit ADC.

like 300 mA, it’s really not much as the stuff around here goes

That’s a good idea, I should have done that before now. Listening to it, I strongly suspect it is 3 times the electrical frequency, but nailing that down would be an additional clue. Will do for sure. However the apps may not be able to pluck the tone out of the background noise.

Juan, re a high voltage scope, mine does 50 volts, but I am also more interested in the current rather than the voltage. I did this once before and it worked ok, with some carefully adjusted potentiometers. Man that was like a year ago and I’m still working on a very similar problem. Back then I needed a quiet motor for different purposes entirely. I ordered some 1 ohm resistors that should arrive today which I can use for current sensing.

I’m having difficulty thinking up a solution that could consist of passive components. I’m thinking maybe a 150 uH inductor on each phase, followed by a small capacitor, say 0.1uf (one between each terminal, so 3 total) on the motor side? I can spare some extra power, anything to get the noise down. People have to live with whatever the noise this thing will make for 25-50 years.

But please show us what the phase current waveform looks like in openloop at low speed.

ok, but I don’t think I will be able to use your approach, I do not know how to use the tools you are using and stuff, it would take all day I think, and may not give me the time resolution I need anyway. I will just check one phase at a time with my scope I think… it’s more likely to give me results. I can post pics of the oscope screen, the export function has stopped working on me :(.

adding inductors and capacitors as above seems to make no difference at all. I tried capacitors from 0.15 uf all the way up to 10 uf with no difference, using 150uH and 50 uH inductors. No diff. Might be something about the waveform. Maybe it’s trying to use space vector, and the little divot at the top is the problem… I will know when I get my sense resistors, I should probably shelve this until then, which should be later today.

Does your power_stage implement limiting resistors on the gate? Maybe that is actually the best place to measure (maybe not accessibly without probe_point). There may be ringing in the gate line?

Edit: Right, this thread is for the B-G431B-ESC1, im sure it uses resistors on the gate.

1 Like


A thought…

What if the turn off time is too fast, maybe that can propa_gate through the windings as a vibration, leading to audible frequencies?

Which switching freq. are you testing?

I mean, with such low current maybe you can raise the freq?

1 Like

I never tried to change it, so I would think it is the default 25kHz which the docs say is the default for STM32 chips. Yeah I should try changing it, see if it makes any discernible difference.

edit: tried changing it to 35000, it doubles current consumption (the capacitors and inductors are removed again) but has no impact on the noise. At least my code wasn’t being ignored. At this point I’m starting to suspect the intended waveform is the issue somehow. I tried changing the waveform type from sine to trapezoid etc but it sounds exactly the same, I think maybe my commanded changes are not being obeyed.


If the G4 is running 170Mhz (170.000.000 Hz)

25Khz has a resolution of (without pre-scaler) = 6800.

If you double the freq. you get half the res.

25kHz is already not in the audible range.
Increasing the frequency might only increase switching losses ?
[EDIT] And make the deadtime represent an even higher pourcentage of the duty cycle