PWM Self-defense

Status
Not open for further replies.

Poposhka

New Member
Hi All.

I'm a software developer with little exposure to hardware and electronics, and the project I'm involved in requires me to produce a PWM output from a general port on an MCU. The technique was fairly simple, i used a programmable counter array that has a PWM mode. All good so far.

But now.
The guy I work with, the EE, told me that the output frequency is incorrect, he wants it at 25Khz. I used the system clock as the source for the PCA (22.1 MHz). the PCA is 8 bits, so my frequency would be around 86khz. I can change a pre-scale for the PCA clock source to change the frequency to 21.6 KHz, 28.8 Khz... And that's the closest i can get to 25KHz without writing the whole damn PWM routine in software... which i ended up doing to fit the requirements.

Now, the EE is unable to provide an explanation for me. So could someone in plain english explain why PWM frequency is important? We're controlling a SanAce 80 GV (Sanyo) 12V Fan.

I'm reading elsewhere that PWM frequency is only important "as long as you're fast enough", but what does that mean? The spec for the Sanyo fan has an example where they discuss 25Khz PWM, but i suspect it's only an example - not a specification, and I'm not sure my coworker understands that.

Thanks for any clarification

Edit: Here's a link to the datasheet **broken link removed**
 
Last edited:
Looks like an example to me. THe fans have a separate brushless controller in them anyways to drive the motor. It's probably reading the input PWM signal desired speed signal and driving the motor with its own PWM to meet those speeds. The other scenario is that it is rerouting your input PWM signal to the proper windings to achieve the same thing, just in a more direct way than the first- cutting out the middle man.

Either way, fast enough is good enough (too fast means lots of heat loss and too slow means choppy motion). For the PWM that's driving the It even says 25kHz is an example PWM frequency.

One possibility is that the EE wants to work off of the provided speed-duty cycle graphs. But even then I still don't see the graphs changing because of PWM frequency...it's duty cycle that controls speed.
 
Last edited:
thanks dknguyen, i tried to hint at that in a discussion, but he wouldn't hear it. he says "25Khz... it's in the part spec .. do it nao". our manager is clueless about s/w and h/w so he had me spend the extra effort to implement it all in software.. which i suspect was wasted.
 
It is really no matter of frequency.

It matters if you are working with the guy or for him. Working with the guy the problem is solved quickly by getting rid of him.

Working for him, you have two options.

Option A: get a tailored crystal to obtain the 25KHz

Option B: work out a software solution. In that case make it more expensive using an external RAM.

BTW. The data sheet says clearly that 25KHz is an example.
 
Last edited:
I agree! Stay away form "audio" frequencies. (20khz)
Probably it will work fine at 86khz.
I suggest using 25khz +/- 15%. (28.8khz)
 
after talking to some friends who work next door .. and who are a bit more familiar with hardware. i got a response like "what?". As i suspected, they'd never heard about a limitation in terms of frequency other than "natural" limits such as being (way) too slow and therefore having problems with a fan that noticeably turns on and off, or the sound issue that some of you suggested.

All things considered, I'm pretty happy that this happened. I've always suspected my coworker is a buffoon, but never had any concrete 'proof' - especially since I don't have much insight in electronics. But the more I read about the electronics about this stuff, the more it seems like something a EE would have known since community college. Or at least have some kind of hunch about - enough to not go off on a mission to create extra work for others.

I'll implement it at 28.8 Khz, and the next project meeting should be ... interesting.
 
Hi Poposhka,

I don't know what a "buffoon" is, but I guess I had one in my lab. He inadvertantly sabotaged prototype boards by placing the wrong resistors in the correct place.

Just took me some hours of intensive measurement to find out the problems.

Well, I paid him off and fired him.

Hans
 

Here is my thinking. Instead of trying to make your HW guy look foolish in a meeting, a better approach may be to ask him to justify his reason for wanting 25KHz, explain the extra work involved by you to do it.
If he refuses to provide justification, then explain to him that you will refrain from making the 25KHz change until you present your argument in the next meeting. That alone may convince him to cooperate. This is what I consider working well with others.

If you simply wait until the meeting before having a discussion about the problem, and involve all the staff with the motive to make him look foolish, then I think that is just wimpy.

There may come a time when your system is not working, due to your SW, and at that time you may have to seek the help of your HW counterpart to aid in debugging your code. If you burn him publicly, he will most certainly be less willing to assist you.


One reasoning I thought of for the 25KHz is that what the data sheet gives its specs at, appeared to be @25 KHz. The Hw guy may be concerned about current draw and is basing his system power design on predicted numbers of all parts in the system. Perhaps the 3KHz difference will throw off his numbers, and since the data sheet is not real specific on other frequencies, then the safe bet is to follow the data sheet.

Thats my view anyways.
 
Last edited:
BTW. The data sheet says clearly that 25KHz is an example.

It does not. The "example" is given for a waveform and not on the PWM frequency.

On page one under specification, the PWM frequency is *clearly* spec at 25KHz. All performance graphs are also spec at 25KHz too.

I agree with the EE that the OP should try hard to keep the part to work at 25KHz. If it is really impossible to get at that frequency, then the OP should contact the manufacturer and request confirmation on new operating frequency and data on possible fan performance changes. These data are needed to change the PWM frequency and to protect oneself against future problem on the product.

Don't become a scapegoat for the product in this situation.

Do not assume you can use any PWM frequency like a hobbyist as this would be a commercial product.
 
Here is my thinking. Instead of trying to make your HW guy look foolish in a meeting, a better approach may be to ask him to justify his reason for wanting 25KHz, explain the extra work involved by you to do it.
...snip...
Thats my view anyways.
Mikebits, I'd work with you any day. I like your attitude, and think it is rare in this day and age.
 
What MCU are you using. Most PCA's have multiple internal clock source options as well as an external clock source.
 
OK what you have to realize is that this guy is a total douche. His motto is "we don't have to like each other as long as we are professional".

He had our test engineer check solid state disks for partition errors. Then when the disks turned up bad later on (because of a completely unrelated issue) he broke out in a screaming fest along the lines of "i know 300% this is all your fault".

We had a systemic problem in the field we didn't really know what the cause was, so he starts ranting in an engineering meeting about how important it is that we find out what's going on, and how this is top priority. He then asks the software team to figure out a firmware fix (for something that turned out to be a hardware problem), and then he takes off golfing for 3 days.

He discussed requirements with a customer for a component but the customer has no idea what they really wanted, so his plan was to put a fully hardware controlled component on the board - basically if it doesn't fit the customer's needs, they have to spin a new board - and I commented: "is this really a good idea?". He came back with "you're not thinking like an engineer. if you can't do this, we can hire a contractor to do it for you".

He outlines a set of requirements for a future project. And the following discussion takes place.

Him: I need you to sign off on these software features.
Me: Great, when can i get a development board to verify that we even can do it?
Him: We won't have it ready until it's shipping.
Me: Okay, but I don't know if I can tell you 100% that these features will work until we try them. We don't want to sign off on something we can't deliver, right?
Him: Well obviously.
Me: So.... When do you need the signoff?
Him: As soon as possible. I'll have the ECN ready tomorrow.
Me: I'm confused. You're telling me to sign off on something I don't know will work.
Him: No, no. This is just for the customer to see that we have something to deliver, so that they can place a purchase order.

At that point, i really didn't know what to say. So I just said "allright".
 
My advice is to try and avoid confrontations and disagreements in your formal meetings, just stick to the facts. I think you will find that over a long work career that there will always be people that you have to work with, or for, that are either incompetent and or just difficult to work with. That won't change, just their names change as you and they move along with your lives.

As you are working for a company making a product, you have the advantage of a formal relationship with the parts manufacture and certainly your local parts distributor that you purchase these fans from. A simple phone call or email asking if the 25khz PWM specification example is a fixed requirement or if 21.6 KHz or 28.8 Khz would work as well. I'm sure it would work fine, but in your case I would get it in writing via a FAX or an email if they say it would work fine at your other frequency choices.

In my work, before I retired recently, there were frequently questions coming up on specific instrumentation products we were using or wanting to use that couldn't be completely answered just by the product spec sheets.

Our local manufacturer's representative (salesman) would always search out and find the answers from the factory when we requested. That was one of his job duties to justify his commission and they would always try their best for us. Sometimes it could take a few days to contact the right person in the factory, but I was always able to get some kind of answer one way or the other.

So armed with data and facts you are in a better place to bring your case before your difficult person, and I agree it's better to go to him alone, at least give him a chance to change his mind before a formal meeting. Also it would be useful if you could estimate the costs to change the software to fit the 25khz spec (but it sounds like you already did that) so as to see the cost trade-offs involved. Professional engineering is often all about making trade-off decisions.

Other solutions could be hardware based. Someone already mentioned changing the micro's system crystal clock so as to be able to hit 25khz on the nose, as long as that doesn't require having to change other software timing issues if changed. The other method is to test the fan at your 21.6 KHz or 28.8 Khz frequencies and see if any of the other specifications change (speed, air flow, device heat, current draw, etc). Fit for service tests can always be useful if there is time. I've had many products that failed to meet their specifications and always trust real world testing over published specs, especially over things like accuracy specifications.

So there are always ways to proceed with technical disagreements ,but the best ways utilize as many facts as possible. Save the flame wars for these kinds of forums and you will most likely have a more successful career. I always tried to treat others as I would like them to treat me, even if some of them were/are ********.
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…