0
Oleksii

NanoPI T4 3-pin fan with PWM suggestion needed.

Recommended Posts

I'm about to install active cooling fan on my recently delivered nanoPI T4. However, I cannot get what is a type of the soldered 3-pin fan connector on this board? What I see there is visually too small as for standard connector size. Is it something special I have no clue about yet, or it is for future proprietary Friendlyarm's fan designed specially for the board?

Any suggestions are welcome!

Thanks  

Share this post


Link to post
Share on other sites
3 hours ago, Oleksii said:

I'm about to install active cooling fan on my recently delivered nanoPI T4. However, I cannot get what is a type of the soldered 3-pin fan connector on this board? What I see there is visually too small as for standard connector size. Is it something special I have no clue about yet, or it is for future proprietary Friendlyarm's fan designed specially for the board?

Any suggestions are welcome!

Thanks  

I think you would have to wire it yourself tbh.

 

Connector wise your looking for http://www.hobbytronics.co.uk/cables-connectors/polarized-connector-housing a 3 pin one.  Dont forget the crimp pins and all. Im assuming this is the right size for the pins but you will need to check the pin size. I dont have this board so cant be certain on the pin size.

 

Share this post


Link to post
Share on other sites
4 hours ago, shaun27 said:

I think you would have to wire it yourself tbh.

 

Well, I anticipated such answer :) just a little bit of hope there might be some ready-to-go solutions already... 

Thank you!

Share this post


Link to post
Share on other sites
On 11/15/2018 at 7:46 PM, Oleksii said:

I'm about to install active cooling fan on my recently delivered nanoPI T4. However, I cannot get what is a type of the soldered 3-pin fan connector on this board? What I see there is visually too small as for standard connector size. Is it something special I have no clue about yet, or it is for future proprietary Friendlyarm's fan designed specially for the board?

Any suggestions are welcome!

Thanks  

I have the same problem, just connected a 2 pin 5V from the casual pins instead of using the fan controller designed for the board. I Also mentioned in one of my emails to FriendlyElec with another bunch of questions, yet that question remained unanswered. If you find a fan with a connector that fits, please publish it so others like me can also use the solution.

Share this post


Link to post
Share on other sites
On 11/26/2018 at 4:44 AM, morfane said:

I have the same problem, just connected a 2 pin 5V from the casual pins instead of using the fan controller designed for the board. I Also mentioned in one of my emails to FriendlyElec with another bunch of questions, yet that question remained unanswered. If you find a fan with a connector that fits, please publish it so others like me can also use the solution.

 

Frankly, I wouldn't even bother myself with active cooling, because I like silent PCs more :) I simply underestimated this RK3399's temperament. I also purchased metal case for this model which can hardly fit standard dimensions fan and provide really efficient air-flow. Thus, I will try to improve passive cooling first of all (put some copper shim + thermal grease instead of magic blue chewing gum :) e.g.).  Then,  maybe, I will look for a decent (slim and silent) PWM-capable 12V fan and connect wires by myself as shaun27 suggested before.  I've searched online shops quite a lot, and now I'm almost desperate to see thing exactly needed :( unless friendlyarm design it and start production soon.

 

Share this post


Link to post
Share on other sites

Hello !

 

Same problem, another forum: https://forum.armbian.com/topic/9105-nanopc-t4-fan-connector

 

Meanwhile I received the parts to build the connector/cable:

On board: JST BM03B-GHS-TBT
plug-housing: JST GHR-03V-S
plug-contacts: JST MINI-SSHL-002T-P0.2

 

Soldering? Just forget it. The parts are so small. I just ordered a preconfigured cable via eBay.

 

But the main problem seems to be that the fan is runnig at highest speed, ignoring the PWM signal.

Share this post


Link to post
Share on other sites
On 12/30/2018 at 8:07 AM, Hai.k.o said:

[...]

But the main problem seems to be that the fan is runnig at highest speed, ignoring the PWM signal.

It should be tough to ignore, given that it's monkeying with the duty cycle of the fan's power input. Do you have a way to measure it?

Hm... I've never measured a PWM signal with a multimeter - I've always either just plugged into a PWM-capable board or wired up a voltage divider (mostly just a pot -> ground, as the fan has a voltage source if it runs with the PWM disconnected). Beyond playing with the little resistor pigtails that come with various PC fans, I've never tried to control fan speed using the supply voltage - too unreliable, and I prefer to work with a nice, low-current speed control (if possible). The NanoPC-T4 uses a nice big MOSFET on that fan supply line, so current draw shouldn't be an issue. Looks like a higher duty cycle on GPIO4_C6/PWM1 should slow the fan, if I'm reading it right. (Am I?)

Share this post


Link to post
Share on other sites
On 1/1/2019 at 11:40 AM, pfry said:

It should be tough to ignore, given that it's monkeying with the duty cycle of the fan's power input. Do you have a way to measure it?

Hm... I've never measured a PWM signal with a multimeter - I've always either just plugged into a PWM-capable board or wired up a voltage divider (mostly just a pot -> ground, as the fan has a voltage source if it runs with the PWM disconnected). Beyond playing with the little resistor pigtails that come with various PC fans, I've never tried to control fan speed using the supply voltage - too unreliable, and I prefer to work with a nice, low-current speed control (if possible). The NanoPC-T4 uses a nice big MOSFET on that fan supply line, so current draw shouldn't be an issue. Looks like a higher duty cycle on GPIO4_C6/PWM1 should slow the fan, if I'm reading it right. (Am I?)

 

I run 3-pin fan (Noise Blocker XM-1) connected to the FAN port of the T4. It is mounted on top of a "AAB Cooling NB Cooler 1" heatsink.

 

GPIO4_C6 is exported as "pwm1" and can be used directly via sysfs:

 

# export the PWM1-pin
$ echo       0 > /sys/class/pwm/pwmchip1/export

# setup PWM (5% duty-cycle)
$ echo  normal > /sys/class/pwm/pwmchip1/pwm0/polarity
$ echo  100000 > /sys/class/pwm/pwmchip1/pwm0/period
$ echo    5000 > /sys/class/pwm/pwmchip1/pwm0/duty_cycle

# enable the PWM output
$ echo       1 > /sys/class/pwm/pwmchip1/pwm0/enable

(The 5% duty cycle works for this small, light fan. For larger fans a higher duty cycle is need to get the fan started).

 

At 100% duty-cycle the temperature of the T4 stays at 43C max under full load.

 

I havn't found a way to read back the TACH signal that's available as GPIO2_A6_FAN_TACH yet to feed the information into fancontrol later.

Edited by weigon
added ref to heatsink

Share this post


Link to post
Share on other sites

What version are you on, and did you adjust anything else? Because it does not work for me neither on regular nor dev releases.

 

I do see signal changing on the suggested tacho pin though, but haven't figured out how to read or apply them:


cd /sys/class/gpio

echo 70 > export

cat gpio70/value

Share this post


Link to post
Share on other sites

Yep, gpio70 does the trick.

 

Use the below python script to print the current measured rounds:

 

#!/usr/bin/env python

## $ pip install python-periphery
from periphery import GPIO
import datetime

def fan_rpm():
    with GPIO(70) as rpm_gpio:
        rpm_gpio = GPIO(70)
        assert rpm_gpio.supports_interrupts
        rpm_gpio.edge = "rising"

        while True:
            cur = datetime.datetime.now()
            start = cur
            end = cur + datetime.timedelta(seconds=1)
            time_left = end - cur

            rounds = 0

            while time_left.total_seconds() > 0:
                if rpm_gpio.poll(time_left.total_seconds()):
                    cur_val = rpm_gpio.read()

                    if cur_val == True:
                        rounds += 1

                cur = datetime.datetime.now()
                time_left = end - cur

            print("rounds={:3}, RPM={:4.0f}".format(
                rounds,
                rounds * 60 / (cur - start).total_seconds()))

if __name__ == "__main__":
    fan_rpm()

 

A few measurements for different fans:

 

For a Noctua NF A14 (1400x1400mm, max 1400 RPM):

 

With period: 1000ns

 

duty_cycle: 20ns, rounds/s: 0

duty_cycle: 50ns, rounds/s: 20 (1200 RPM)

duty_cycle: 52ns, rounds/s: 40 (2400 RPM)

duty_cycle: 900ns, rounds/s: 45

 

For NoiseBlocker XM1 (40x40mm, max 2800 RPM):

 

With period: 1000ns

 

duty_cycle: 20ns, rounds/s: 0

duty_cycle: 50ns, rounds/s: 45 (2700 RPM)

duty_cycle: 52ns, rounds/s: 105 (6300 RPM)

duty_cycle: 900ns, rounds/s: 110

 

 

1. using PWM to drive a DC fan leaves only a very small range that allows to control the fan-speed

2. the reported RPMs don't match the max-RPMs one would expect from the fan.

Share this post


Link to post
Share on other sites
23 minutes ago, weigon said:

1. using PWM to drive a DC fan leaves only a very small range that allows to control the fan-speed

2. the reported RPMs don't match the max-RPMs one would expect from the fan.

 

I just found out that the PWM freq should be 25kHz and that the TACH signal gives 2 ticks per round. 

 

That means: In the script I pasted earlier "rounds/s" were just ticks and the "RPM" were "twice the RPM".

 

After adjusting the PWM freq the corrected measurements for the Noctua NF A14:

 

duty_cycle: 170ns, stops

duty_cycle: 180ns, ticks: ~3, RPM: 90

duty_cycle: 190ns, ticks: ~4, RPM: 120

duty_cycle: 200ns, ticks: 8, RPM: 240

duty_cycle: 250ns, ticks: 16, RPM: 480

duty_cycle: 300ns, ticks: 22, RPM: 660

duty_cycle: 350ns, ticks: 34, RPM: 1020

duty_cycle: 400ns, ticks: 40, RPM: 1200

duty_cycle: 500ns, ticks: 47, RPM: 1400

duty_cycle: 800ns, ticks: 36, RPM: 990 [*]

duty_cycle: 2000ns, ticks: 24, RPM: 720 [*]

duty_cycle: 2000ns, ticks: 26, RPM: 780 [*]

duty_cycle: 4000ns, ticks: 40, RPM: 1200 [*]

 

[*] fan is faster, but ticks aren't consistent.

Share this post


Link to post
Share on other sites

After removing the noise from the input-data, I now got quite reasonable RPM values for the Noctua NF A14:

 

RPM per duty_cycle [ns]
duty_cycle RPM
180 158
200 476
250 637
300 938
400 1111
500 1200
2000 1251

 

Below 180ns the fan stops, above 500ns it doesn't really increase anymore.

 

fan.svg

Share this post


Link to post
Share on other sites

Just for reference, a simplified version that works with both linux 4.4 and the linux 4.20 kernel:

 

# make the PWM port available to sysfs
$ echo 0 | sudo tee /sys/class/pwm/pwmchip1/export
0
# set the PWM-freq to 25kHz (=40000ns)
$ echo 40000 | sudo tee /sys/class/pwm/pwmchip1/pwm0/period
40000
# enable the PWM
$ echo 1 | sudo tee /sys/class/pwm/pwmchip1/pwm0/enable
1

It starts the fan at fullspeed as by default the polarity of the PWM is inversed: duty_cycle of "0" == "always on".

$ cat /sys/class/pwm/pwmchip1/pwm0/polarity
inversed
$ cat /sys/class/pwm/pwmchip1/pwm0/duty_cycle
0

To slow the fan down with inversed polarity one needs to bring the duty_cycle close to the "period" set before

$ echo 35000 | sudo tee /sys/class/pwm/pwmchip1/pwm0/duty_cycle
35000

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
0