PWM don't works

Peer support for Air Manager desktop users

Moderators: russ, Ralph

Message
Author
ericRacer
Posts: 22
Joined: Wed Oct 23, 2019 11:23 pm

PWM don't works

#1 Post by ericRacer »

Hi,
I want to use the PWM function to command a IB-2 driver board. Here is my script :

Code: Select all

RpwmPinPitch = hw_output_pwm_add("Right PWM Pitch, k, d7", 1000, 0.1)
hw_output_pwm_duty_cycle(RpwmPinPitch, 0.4)

At first , i though it was the board (MEGA2560), i changed it but nothing. I checked with my scope and i don't have any signal.

then, i tried this command :

Code: Select all

 led_id = hw_led_add("Battery power, k , D7", 0.2)
and now i have a beautiful PWM but without the particularity of changing the frequency.
I have AM 3.7. Then i wonder why the PWM command doesn't works ?

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

Re: PWM don't works

#2 Post by Ralph »

Did you check the comments in the hardware ID list?
http://siminnovations.com/wiki/index.ph ... _MEGA_2560

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

Re: PWM don't works

#3 Post by teds »

I am having the same problem. I am brand new to Air Manager, so I may not know what I am doing, but here's my setup and use case:
  • 12V PWM fan attached to an Arduino Mega 2560 R3
  • Arduino has been flashed in Air Manager, using channel A
  • Arduino status reflects as:
    • Channel A
    • Mode: Pin mode
    • State: Connected
  • 12V DC power supply attached to the Arduino barrel jack
  • Power and ground pins attached to Arduino Vin and GND pins, respectively (for those who do not know, attaching a pin to Vin will give the raw power output from the barrel jack, which in this case is 12VDC)
So far, so good. The fan is powered and runs properly at 100%.

Now, here's where it no longer works.
  • Fan PWM pin attached to pin D11, which, according to the aforementioned documentation, looks to be fine
  • I have added a very simple hardware function to start with (obviously I'll eventually add more, but right now, this doesn't even work).

Code: Select all

pwm_id_fan = hw_output_pwm_add("ARDUINO_MEGA2560_A_D11", 25000, 0.0)
hw_output_pwm_duty_cycle(pwm_id_fan, 0.0)
I would expect that I only need the first line to turn off the fan, but I included both lines, because neither line turns off the fan when I run it.

When I run it, I get this message in the hardware tab:
image.png
image.png (7.32 KiB) Viewed 1233 times
So it looks like it should work, but it doesn't. I don't have any meter to check what's coming out on the D11 pin, but I'm assuming there's something I'm doing wrong, first.

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: PWM don't works

#4 Post by Keith Baxter »

Hi @teds

We are a friendly polite bunch here. Welcome to the forum.

Do you have the specs for the fan you are using?




Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

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

Re: PWM don't works

#5 Post by teds »

Thank you, Keith! Nice to be in a polite flight simulation forum for once! ;)

The fan is a Noctua NF-A8 PWM chromax.black.swap. I don't think there's anything too crazy about this fan, but here you go:
https://noctua.at/en/products/fan/nf-a8 ... cification

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

Re: PWM don't works

#6 Post by Ralph »

25.000 Hz?! :o Why?!
Also, are you using a pull down resistor, you can never be too sure.

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: PWM don't works

#7 Post by Keith Baxter »

teds wrote: Fri Dec 24, 2021 8:32 pm Thank you, Keith! Nice to be in a polite flight simulation forum for once! ;)

The fan is a Noctua NF-A8 PWM chromax.black.swap. I don't think there's anything too crazy about this fan, but here you go:
https://noctua.at/en/products/fan/nf-a8 ... cification
Hi

Ok so I found this.

https://noctua.at/pub/media/wysiwyg/Noc ... _paper.pdf

You have connected the fan so?

Take a look at your duty cycle. Your value seems very high.

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: PWM don't works

#8 Post by Keith Baxter »

Ralph wrote: Fri Dec 24, 2021 8:50 pm 25.000 Hz?! :o Why?!
Yes exactly.

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

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

Re: PWM don't works

#9 Post by Ralph »

Noctua specifies 18 to 30 KHz, that's quite high... I doubt if it even needs to be that high. Give it a try at a for example 1000. And don't forget the pull down for extra safety.... < jph insert joke here

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

Re: PWM don't works

#10 Post by teds »

So here's something I don't understand. I put my computer to sleep after writing my last post. When I saw on my phone that people had responded, I started up the computer again, and now, the fan works exactly as expected without changing the code.

I'm very happy that it's working, but I'm also nervous because I don't know what changed between putting it to sleep and starting it back up. I hope that there isn't some magical incantation that I need.

Post Reply