Jump to content

Easy Fan install and Software Daemon, self speed tuning. Orange Pi Zero (probably others aswell).


Recommended Posts

Posted

Trival endevour, though fun and easy to do.

 

Text and diagram taken from zip file attached.

 

Orange Pi Zero fan self adapting to temperature, inside Shenzhen Xunlong Software CO.,Limited manufacturered low profile (non-expansion board version) case.
Probably can be used with other SBC's. FanDaemon source provided.

 

Comes with no warranty of any sort. Use at your own risk.

 

The software included works with Mainline Kernel 4.13 Armbian image.

 

Run armbian-config - system - hardware, use arrow keys to highlight "pwm" and press spacebar to [*] enable it. Select save and reboot.

 

Install the fan how you wish.

fan-mosfet-wiring-orangepi-zero.jpg.26721c3a1ab637fa76497310dc98827a.jpg
I used a 5volt 3cm wide (bigger will not fit), 1cm thick blower fan from ebay (sucks air in from below, blows from side) glued to the ceiling of the case against the top vents.
Could also cut holes into the roof and mount a regular fan to blow air out the top, or on top of the sbc and leave vents unaltered.
Use sticky tape to cover the extra vent slits and round the blower fan if there is a gap, to stop leakage.
I filed the power cable hole in the case wider, to allow more air flow.

 

Mosfet I used was "FQP30N06L/FQP30N06" very common and cheap if you can wait several weeks for shipping from ebay.
10kohm resistor between outer pins using wires with 2.54 header plugs. Tight fit but doable.

 

You can use either the +3.3v power rails (pin 1 or 9 on 26 pin header) or +5v for faster fan speed, or for fans that do not handle the lower voltage.
For some reason when using +5v, I only got a very narrow range of operation or 2 effective speeds whereas with 3.3v, duty cycles 20% to 100% worked.
For +5v, pin 1 on the 13 pin header can be used, however the wire tends to hand right on top of fan and risks it being sucked into the blades.

 

Put the fand executable where ever you want and do...
chown root fand
chmod u+x fand
(I used midnight commander and used in its File menu, set owner can execute and chown adding file to root user and root group)

fand software needs root priviledges for manipulating the pwm interface in /sys folder. Maybe another user in wheel group would do?

 

run
sudo crontab -e

and below "# m h dom mon dow    command" add (#how to customise below)
@reboot sleep 10 && nohup /root/fand/./fand 48000 5 1 65 10 100 &

 

Remember to press enter after "&" as the crontab requires a new empty line after declaring the last cronjob.
Sleep is added as I found if the daemon was started too early, there was a chance the fand would fail to start for whatever reason.
* e.g. above for FanD executable located in /root/fand/ sets Duty Cycle freqency to 48000Hz (or something or rather), temperature check at 5 second intervals temperature/DT% 1c(10%DT) to 65c(100%DT)

#fand command line is as below
/(path to execultable)/./fand duty cycle (Duty Cycle (DT) frequency) (polling interval in seconds) (min temperature, lowest DT% => 1) (temp for max DT%) (& to fork into background)

 

FanD shows Duty Cycle % in its process name when using the "top" command, scroll down using down arrow if you cannot see it at first.

To compile included fand.c source, if you edit it or do not trust the included binary.
gcc -std=gnu99 fand.c -o fand

Daemon has negligible memory and cpu usage.

 

You can also set a fixed speed with console commands in a script as root. You may need to experiment with values.
echo 0 > /sys/class/pwm/pwmchip0/unexport
echo 0 > /sys/class/pwm/pwmchip0/export
echo normal > /sys/class/pwm/pwmchip0/pwm0/polarity
# set the DT period to 30000 ns
echo 30000 > /sys/class/pwm/pwmchip0/pwm0/period
# e.g. set the duty cycle to 15000 ns (50%DT?)
echo 15000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable

 

to disable pwm (and the fan), as root enter...
echo 0 > /sys/class/pwm/pwmchip0/pwm0/enable

 

Longer DT periods/lower DT frequency, if used, produces a humming sound from the motor. 

 

Credits to FanD software to Andrea Cioni.
Forked by me from github version for better compatibility with Orange Pi Zero. Did not comment changes I made, on account of being too lazy.
DT polarity corrected and device in unready state (preventing daemon start) bug improved.

 

I have ceramic heatsinks on both the ram and soc chip bonded using Artic Silver. Dries and cements the heatsinks to surface rather well.
With cpu governor set to performance (constant 1200mhz), ambient air about 22celcius at idle the cpu temperature is 40-45celcius using the cronjob given above.

 

OrangePiZero-FanDaemon-and-wiringdiagram-src&binary.zip

Posted

Rollmeister,


do you know the changes to orangepizero 4.14.70-sunxi ?  I am missing pwm0

 

root@orangepizero:~/FanDaemon# ls -al /sys/class/pwm/pwmchip0/
total 0
drwxr-xr-x 3 root root    0 Oct 14 09:47 .
drwxr-xr-x 3 root root    0 Oct 14 09:47 ..
lrwxrwxrwx 1 root root    0 Oct 14 09:47 device -> ../../../1c21400.pwm
--w------- 1 root root 4096 Oct 14 08:48 export
-r--r--r-- 1 root root 4096 Oct 14 09:47 npwm
drwxr-xr-x 2 root root    0 Oct 14 09:47 power
lrwxrwxrwx 1 root root    0 Oct 14 09:47 subsystem -> ../../../../../../class/pwm
-rw-r--r-- 1 root root 4096 Oct 14 09:47 uevent
--w------- 1 root root 4096 Oct 14 09:53 unexport

 

 

regards

mohorst
 

Posted
On 1/6/2018 at 9:54 PM, Rollmeister said:

Trival endevour, though fun and easy to do.

 

Text and diagram taken from zip file attached.

 

Orange Pi Zero fan self adapting to temperature, inside Shenzhen Xunlong Software CO.,Limited manufacturered low profile (non-expansion board version) case.
Probably can be used with other SBC's. FanDaemon source provided.

 

Comes with no warranty of any sort. Use at your own risk.

 

The software included works with Mainline Kernel 4.13 Armbian image.

 

Run armbian-config - system - hardware, use arrow keys to highlight "pwm" and press spacebar to [*] enable it. Select save and reboot.

 

Install the fan how you wish.

fan-mosfet-wiring-orangepi-zero.jpg.26721c3a1ab637fa76497310dc98827a.jpg
I used a 5volt 3cm wide (bigger will not fit), 1cm thick blower fan from ebay (sucks air in from below, blows from side) glued to the ceiling of the case against the top vents.
Could also cut holes into the roof and mount a regular fan to blow air out the top, or on top of the sbc and leave vents unaltered.
Use sticky tape to cover the extra vent slits and round the blower fan if there is a gap, to stop leakage.
I filed the power cable hole in the case wider, to allow more air flow.

 

Mosfet I used was "FQP30N06L/FQP30N06" very common and cheap if you can wait several weeks for shipping from ebay.
10kohm resistor between outer pins using wires with 2.54 header plugs. Tight fit but doable.

 

You can use either the +3.3v power rails (pin 1 or 9 on 26 pin header) or +5v for faster fan speed, or for fans that do not handle the lower voltage.
For some reason when using +5v, I only got a very narrow range of operation or 2 effective speeds whereas with 3.3v, duty cycles 20% to 100% worked.
For +5v, pin 1 on the 13 pin header can be used, however the wire tends to hand right on top of fan and risks it being sucked into the blades.

 

Put the fand executable where ever you want and do...
chown root fand
chmod u+x fand
(I used midnight commander and used in its File menu, set owner can execute and chown adding file to root user and root group)

fand software needs root priviledges for manipulating the pwm interface in /sys folder. Maybe another user in wheel group would do?

 

run
sudo crontab -e

and below "# m h dom mon dow    command" add (#how to customise below)
@reboot sleep 10 && nohup /root/fand/./fand 48000 5 1 65 10 100 &

 

Remember to press enter after "&" as the crontab requires a new empty line after declaring the last cronjob.
Sleep is added as I found if the daemon was started too early, there was a chance the fand would fail to start for whatever reason.
* e.g. above for FanD executable located in /root/fand/ sets Duty Cycle freqency to 48000Hz (or something or rather), temperature check at 5 second intervals temperature/DT% 1c(10%DT) to 65c(100%DT)

#fand command line is as below
/(path to execultable)/./fand duty cycle (Duty Cycle (DT) frequency) (polling interval in seconds) (min temperature, lowest DT% => 1) (temp for max DT%) (& to fork into background)

 

FanD shows Duty Cycle % in its process name when using the "top" command, scroll down using down arrow if you cannot see it at first.

To compile included fand.c source, if you edit it or do not trust the included binary.
gcc -std=gnu99 fand.c -o fand

Daemon has negligible memory and cpu usage.

 

You can also set a fixed speed with console commands in a script as root. You may need to experiment with values.
echo 0 > /sys/class/pwm/pwmchip0/unexport
echo 0 > /sys/class/pwm/pwmchip0/export
echo normal > /sys/class/pwm/pwmchip0/pwm0/polarity
# set the DT period to 30000 ns
echo 30000 > /sys/class/pwm/pwmchip0/pwm0/period
# e.g. set the duty cycle to 15000 ns (50%DT?)
echo 15000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable

 

to disable pwm (and the fan), as root enter...
echo 0 > /sys/class/pwm/pwmchip0/pwm0/enable

 

Longer DT periods/lower DT frequency, if used, produces a humming sound from the motor. 

 

Credits to FanD software to Andrea Cioni.
Forked by me from github version for better compatibility with Orange Pi Zero. Did not comment changes I made, on account of being too lazy.
DT polarity corrected and device in unready state (preventing daemon start) bug improved.

 

I have ceramic heatsinks on both the ram and soc chip bonded using Artic Silver. Dries and cements the heatsinks to surface rather well.
With cpu governor set to performance (constant 1200mhz), ambient air about 22celcius at idle the cpu temperature is 40-45celcius using the cronjob given above.

 

OrangePiZero-FanDaemon-and-wiringdiagram-src&binary.zip 89.16 kB · 272 downloads

Hi... 

I have an Orange PI PC running Armbian_20.05.2_Orangepipc_buster_current_5.4.43 (Armbian_20.05.2_Orangepipc_buster_current_5.4.43.img) with unbound and pi-hole, working very well by the way ...

I'm trying to deploy your cooling solution and I'm not getting it to work ...

I bought the MOSFET IRFZ44N, I did all the wire assembly correctly, I followed the instructions correctly in the post and it didn't work ...

Can you help me solve where I might be wrong?

Cheers, from Brazil ..

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines