PWM don't works

Peer support for Air Manager desktop users

Moderators: russ, Ralph

Message
Author
teds
Posts: 15
Joined: Fri Dec 24, 2021 7:24 pm

Re: PWM don't works

#31 Post by teds »

Ralph wrote: Sat Dec 25, 2021 7:47 am Which frequency are you using?
Did you try a much lower frequency? Around 1 kHz for example.
In Air Manager 4.1 (BETA 29), I'm using 25kHz and so far, it has worked 100% of the time that I've tried it up to this point.
In Air Manager 4.0.2, it worked some of the time, but when it didn't work, it didn't matter which frequency I set it to -- it just didn't work. In AM 4.0.2, I successfully turned the fan off with a 1 kHz signal, but I never tried turning the fan on with a 1 kHz signal. I am concerned about going outside of the manufacturer's specifications.
I do not want to declare that the issue is fixed with the new software, but right now, I am inclined to stick with Air Manager 4.1 (BETA 29) and will continue to see if it ever stops working.
jph wrote: Sat Dec 25, 2021 8:01 am I agree with @Ralph 100% that a pull down resistor would be a definite choice in this case. as according to the datasheet the PWM VIL (LOW LEVEL) for the fan input is a MAXIMUM of 0.8V ! - the Arduino may well not give a Vlow of this level (ie - it may be greater!) - hence a pulldown resistor would be desirable. a value of 680 ohms to 1.5k ohms should be fine - simply connect this resistor from the Arduino pin in use to GND. The fan also has pull ups enabled internally so no worry for the high level at all as, in fact, anything over 0.8 would be considered high. If it were me I think I would use a Schmitt trigger buffer such as the 74HC7014 which is rail to rail and ignore the pull down. That is the ideal solution and dirt cheap with no other components needed.

to The OP - do you have an oscilloscope ? - probably not but worth asking.
I'm not the OP, but I assume you mean me. (I latched onto someone else's dead PWM topic rather than starting a new one.)
I do not have an oscilloscope. I wish I did, but I am not a maker. My intention is to do this one project and that's it. I'm trying not to buy additional hardware that I'll never use again, and I also don't feel right buying something, using it once, and returning it. Right now, everything works perfectly in Air Manager 4.1 (BETA 29) and I don't know why, but I'll take the result.

I know very little about electronics and will defer to everyone's expertise about the resistor/Schmitt trigger. My limited understanding is that we are trying to limit the PWM signal to stay under a certain voltage threshold to ensure that the fan does not get destroyed. Please correct me if I am wrong.

I'm brand-new to these forums and not sure if it's best to start a new topic on this resistor or keep it right here. Judging by the bikini pic earlier, I'm guessing you guys are a little more informal than other message boards I've been on. ;) So here are my questions, and please tell me if we should pull it off into a second thread somewhere:
  1. My goal is to put two case fans on the back of a Stay Level Avionix panel. How do I add this resistor or Schmitt trigger without slapping a bread board on the back of the panel? I have (or more accurately, will have) PCB standoffs when they finally come in the mail, and ideally, this resistor would sit on its own independent PCB that I could affix to the back of the panel with the PCB standoffs. Is there such a product out there?
  2. Could someone help point me to a product, on, say, Amazon.com with exactly what I should buy? If I look up "pull down resistor", I just get a bunch of resistors and it's not clear what I should buy.
jph wrote: Sat Dec 25, 2021 9:08 am It is best, where possible, to power the arduino from a voltage LOWER than 12V regardless of the quoted maximum. Around 8V is far better if available and take the 12V for the fan etc from another source. The reason is quite simply that the higher the input voltage to the Arduino then the greater the Vreg has to drop to the working voltages. This produces heat. The heat is dependent on the current draw from the Arduino pins. Overheating the Vreg will cause it to release the magic smoke.
Basically, the higher the input voltage the less total current available from the Arduino pins and visa versa.
Thanks for the suggestion. My goal is not to over-complicate things. I don't want to introduce a 5V power supply for the Arduino and a 12V power supply for this as well as another relay that I have that also takes 12V. This is on top of another power supply for my Flight Illusion gauges plus another power supply for my Brunner yoke. I'm trying to avoid plugging in 25 different things when I play Flight Simulator. I'm now a little concerned if using a power supply voltage that the Arduino is designed to accept is going to cause it to overheat.

Also, with my limited understanding of electronics, I also thought it would be best for the PWM signal from the Arduino and the power to share a common ground. Please correct me if I am wrong.

User avatar
jph
Posts: 2856
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: PWM don't works

#32 Post by jph »

Hi @teds
All understood, no problems. Folks here will always help someone who has at least made some progress where possible or are prepared to. Yes, we are a pretty relaxed group. Egg Nog helps :D
If it working ok at the moment and is 100% reliable then there is a case for leaving it as it is and changing nothing - if not - then......
If you are having issues - even occasionally, then the following info will help, or, indeed, if you just want to know about pull down resistors and circuits then by all means read on.
Ok, a pull down resistor ... here is a bit of an explanation as to what it is and why you may need it. but as a first note -
When PWM is operating the signal from the Arduino 'pin' is, in a basic sense, a series of high and low levels (5V and 0V) - we can call these 'high' and 'low'
For the device - in this case your fan - to register the pwm signal then there is a voltage threshold at which a 'high' is noted and also at which a 'low' is noted.
It is quite common for a 5V PWM device to consider the low level as - for example - anything BELOW around 1.3 to 1.5V. Any level ABOVE that is considered a 'high'
The Arduino should always - in theory - give an exact 0V as a low and 5V as a high, Theory and the real world are almost always not the same although the Arduino port pins are pretty good at 'low' levels being close to 0V.

The high level is a very different issue on some Arduino pins due to a thing called open collector outputs (or more precisely open drain) but that is a completely different animal that we can discuss in another topic if anyone is interested ?. This is a case where we have to manually control the high level output. - but, ignore that here as it does not apply.

So, on our 'low' level out, that should be 0V, it is sometimes possible for it to be not quite 0V.
On the fan data for the item that you use the PWM voltage for the fan 'low' level is a MAXIMUM of 0.8V - which is quite low for most 5V devices (devices here referring to the thing that is attached to the Arduino. The 'device' itself may also have some influence on the 'low' level due to internal circuitry.
What does this all mean ? -
Well, according to the fan datasheet then ANYTHING from the Arduino that is ABOVE 0.8V is considered a 'high' hence to properly register a 'low' then the device needs to see a voltage level BELOW 0.8V.
If the level between the Arduino and device is not less than 0.8V when it is supposed to be 'low' then we can assist this by forcibly 'pulling down' the output pin of the Arduino when the Arduino is outputting it's low level.
All this needs is a suitable value of a cheap basic resistor to be added between the pin on the Arduino and GND. that is it. It then assists in 'pulling down' the low level to more or less 0V if needed.
The value may have to be fairly low as the fan data states it has internal 'pull ups' but doesn't state the value (again - that is a different subject). A value of around 1K would probably do the job nicely as I very much doubt the pull UPs in the fan would be any lower than 10K.
So, if you want to add the 'pull down' resistor then you simply need a 1K cheap small resistor and connect it between the Arduino PWM pin in use and ground.
If you are buying a few resistors then you might as well get some 330ohm as well as they are a common value used for adding an LED to an Arduino pin (you cant just add an led without a resistor)

As for what to buy ? it would be a 1/4 watt carbon film cheap nasty resistor. I have looked on Amazon and they are a totally ridiculous price. These things are a Penny each or less !.
Don't be tempted to buy a resistor 'kit' as they are totally full of values you would never use.
here is an example of what the price should be.
https://www.aliexpress.com/item/1005002 ... mainSearch
you can order from here but make sure you select AliExpress saver shipping
I just looked at the price for 100x1Kohm plus 100x330ohms plus AliExpress saver shipping and the total is €2,81 including Taxes to me here in Portugal. !
As said, the 330ohm are great for leds with the Arduino so worth having around
I know you don't need 100 of each but at a penny each it is not worth them selling them in less quantities.

You could also try a specialist
hifi repair store - one of the small ones that does real repairs, not just swapping out boards, and tell them you want a couple of 1k 1/4W resistors. They might charge you 10 cents.
Oh, and as for common grounds, yes, absolutely !
That was supposed to be brief haha. :D (I Daren't mention 'briefs' as ) :lol: )
If there is anything you need help on just ask and we will try to answer. Although I am a reasonably competent programmer my field is more electronical engineering and microprocessor integration so feel free to ask for any info you like if you don't mind long answers. :o ;) :D
There are amazing people here with absolutely superb programming skills and also amazing graphics skills and all combinations of all aspects of AM - There are always folks here who also know far more than us so we all keep learning.
These are people with REAL skills, not from the university of google search.
Just be tolerant of the old gimmers like me and others I cannot mention :? ;)
All the best,
Joe
Joe. CISSP, MSc.

User avatar
jph
Posts: 2856
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: PWM don't works

#33 Post by jph »

teds wrote: Sat Dec 25, 2021 9:12 pm My goal is to put two case fans on the back of a Stay Level Avionix panel. How do I add this resistor or Schmitt trigger without slapping a bread board on the back of the panel? I have (or more accurately, will have) PCB standoffs when they finally come in the mail, and ideally, this resistor would sit on its own independent PCB that I could affix to the back of the panel with the PCB standoffs. Is there such a product out there?
@teds
I just read this in more detail and and had no idea at all what this panel was. After looking it up on the net it seems to be a really simple instrument panel with some optional Garmin overlays and space for Saitek or similar stuff.
Are you simply intending to use the fans for cooling of the rear of the panel based on temperature ? -if so, there are some REALLY easy to use and ready made plug and play solutions for less than 10 Euro that doesn't involve ANY AM coding....
Or, are you trying to make some speed dependent face vents etc ???? :shock: :o
Joe
Joe. CISSP, MSc.

teds
Posts: 15
Joined: Fri Dec 24, 2021 7:24 pm

Re: PWM don't works

#34 Post by teds »

Hi @jph,
Thanks for the reply. Despite reading three articles on pull-down resistors, your explanation makes more sense than any of them. Now, I understand Ralph's thoughts about adding it.
jph wrote: Sun Dec 26, 2021 9:15 am If it working ok at the moment and is 100% reliable then there is a case for leaving it as it is and changing nothing - if not - then......
That's where my mind is, right now. Since switching to AM 4.1 (BETA 29), it has worked every single time and has now been tested a lot. My only concern is, will it still be putting out the right voltage in say, five years? I don't know how these things wear down. And if I did put in a resistor, I still don't know how I would do it without putting a bread board on the back of my panel, which would look very un-professional.
I just hope that whatever changed in 4.1 to make this work wasn't accidental and that it won't go away at some point in the future.
jph wrote: Sun Dec 26, 2021 9:15 am If there is anything you need help on just ask and we will try to answer. Although I am a reasonably competent programmer my field is more electronical engineering and microprocessor integration so feel free to ask for any info you like if you don't mind long answers. :o ;) :D
Haha, thank you for the help you have given so far! I don't mind long answers -- it helps me learn a lot! But I do feel guilty when someone else writes so much on my behalf.
jph wrote: Mon Dec 27, 2021 9:24 am Are you simply intending to use the fans for cooling of the rear of the panel based on temperature ? -if so, there are some REALLY easy to use and ready made plug and play solutions for less than 10 Euro that doesn't involve ANY AM coding....
Or, are you trying to make some speed dependent face vents etc ????
Sorry, earlier I said that I would describe my use case and I never did. I am building a hardware panel using mostly commercial off-the-shelf components. However, there are three non-simulation products going into the panel. One is a real 12V Hobbs meter (which I will connect to the Arduino via a relay), another is dimmable LED lighting, and the third is these fans. The fans are going to be mounted behind salvaged aircraft air vents and they are there to keep me cool. Last summer, I discovered how hot MSFS makes my room, despite air conditioning, so I wanted to add these fans. The PWM signal jumps from 0% to 20% at a certain airspeed threshold and increases as airspeed increases, up to a certain point. Air Manager + the Arduino will control many of the components.

User avatar
jph
Posts: 2856
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: PWM don't works

#35 Post by jph »

That's where my mind is, right now. Since switching to AM 4.1 (BETA 29), it has worked every single time and has now been tested a lot. My only concern is, will it still be putting out the right voltage in say, five years? I don't know how these things wear down. And if I did put in a resistor, I still don't know how I would do it without putting a bread board on the back of my panel, which would look very un-professional.
I just hope that whatever changed in 4.1 to make this work wasn't accidental and that it won't go away at some point in the future.
Hi,
No problems.
Regarding the above, if it works now, it will work in 5 years as far a voltage levels are concerned. They don't wear out or wear down so no worries there. You will never damage the fan using the arduino PWM as the voltage can never be greater than the arduino supply (5V).
If you ever decide to add items behind your panel, which as I can see is a CONSIDERABLE investment, then the best way would be to put and parts that are add ons in a nice little plastic box. In the case of a pulldown resistor, this could be simply soldered onto the arduino itself and you would never see it providing it was a small enough package such as a 1/8th watt carbon film.
Sounds like a great project Ted. Keep us updated.
Joe
Joe. CISSP, MSc.

teds
Posts: 15
Joined: Fri Dec 24, 2021 7:24 pm

Re: PWM don't works

#36 Post by teds »

Thank you very much for your help!

teds
Posts: 15
Joined: Fri Dec 24, 2021 7:24 pm

Re: PWM don't works

#37 Post by teds »

This thing has stopped working again, and I don't know why. I stopped using it after my last comment, and at the time, it worked 100% of the time when I changed the duty cycle dozens of times.

Now, the fan is behaving as if it is not receiving any PWM signal at all, and that happens whether I send a signal at 1 kHz or 25 kHz. I have no idea what's changed. The code has not.
Last edited by teds on Thu Jan 27, 2022 5:21 pm, edited 1 time in total.

User avatar
Ralph
Posts: 7924
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: PWM don't works

#38 Post by Ralph »

Did you ever try the beta?
https://siminnovations.com/wiki/index.p ... sktop_BETA
Don't forget to flash.

User avatar
Ralph
Posts: 7924
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: PWM don't works

#39 Post by Ralph »

Can you try setting the frequency at 50 Khz? It looks like the frequency gets divided by 2 :?

teds
Posts: 15
Joined: Fri Dec 24, 2021 7:24 pm

Re: PWM don't works

#40 Post by teds »

Ralph wrote: Thu Jan 27, 2022 3:51 pm Can you try setting the frequency at 50 Khz? It looks like the frequency gets divided by 2
Thanks. Tried that, too, and it didn't work. :(
Ralph wrote: Thu Jan 27, 2022 3:40 pm Did you ever try the beta?
https://siminnovations.com/wiki/index.p ... sktop_BETA
Don't forget to flash.
Actually, originally it worked perfectly and repeatedly on BETA 29 but not in 4.0.2. I came back, upgraded to BETA 33 or 34 (I forget which) and it didn't work. Thinking the software was the problem, I downgraded back to BETA 29 and re-flashed, and it still didn't work. Now I'm on BETA 36 and it doesn't work, either, with the flash.

I've tried it with different wires, different Arduino ports (went from D11 to D6 in the Arduino 2560, both of which support PWM), different frequencies, different duty cycles. In all of these cases, the fan keeps going but never stops. One interesting thing is that the fan does seem to speed up a tiny amount if I unplug the PWM cable. The fan's whitepaper does say it operates at full speed if it does not detect a PWM signal, so it's interesting that it operates at some slightly slower percentage of that speed (90%? 95%?) with the wire plugged in.

I'm open to other debugging steps from the community. The only other idea I have is to try it with another fan, which I will do. Or go out and buy an oscilloscope, which I really don't want to do.

Post Reply