BPI SoftPWM for a fan

5 820
Hi everyone,
I have a BPI set up for media streaming etc. Now I want to cool the Pi with an external powered fan with softpwm. The PWM-Cable of the fan is attached to GPIO 0 (Phys. Pin11). Unfortunately, I have no expiriences with python or C/C++. Is there a script available for softpwm for a fan?
The fan is called Arctic Cooling AF
Max RPM 1500

Many thanks in advance for your help and sorry for my bad english :-)
Edited by tkaiser at Mon Jul 27, 2015 10:26

Based on the idea outlined in this post (defining a PWM pin and setting a value between 1 and 100) I wrote a script a few hours ago that uses a simple formula to derive the PWM value from the thermal value of the PMU (more realiable than the SoC's temperature):
  1. #!/bin/bash

  2. CheckTimeInSeconds=5
  3. MaxTemp=55000
  4. MinTemp=40000
  5. TempDiff=$(( ${MaxTemp} - ${MinTemp} ))

  6. while true ; do
  7.     read CurrentTemp </sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/temp1_input
  8.     AdjustedTemp=$(( $(( ${CurrentTemp} - ${MinTemp} )) * 100 / ${TempDiff} ))
  9.     if [ ${AdjustedTemp} -lt 1 ]; then
  10.         AdjustedTemp=1
  11.     elif [ ${AdjustedTemp} -gt 100 ]; then
  12.         AdjustedTemp=100
  13.     fi
  14.     # AdjustedTemp=$(( 101 - ${AdjustedTemp} ))
  15.     echo ${AdjustedTemp} >/sys/class/pwm-sunxi/pwm0/duty_percent
  16.     sleep ${CheckTimeInSeconds}
  17. done
Copy the Code

The outcommented line "AdjustedTemp=$(( 101 - ${AdjustedTemp} ))" would invert the value. Now when temperature is below 40°C then duty_percent will be set to 1 and if temperature rises also this value will be increased. If you uncomment this line it would work the other way around: Setting duty_percent to 100 when 40°C or colder and decreasing it constantly when the temperature rises towards 55°C.

And maybe there's a mistake since values of 0 should also be possible to completely shut the fan off (easy to fix: just replace 1 with 0 two times and change 101 to 100)

tkaiser replied at Mon Jul 27, 2015 13:25
Based on the idea outlined in this post (d ...

Great job!

Many thanks for your script
Will test the script in this week or next, i have to do my school stuff etc.

Thanks, it worked perfectly as expected.

adidas yeezy boost
moncler outlet
air jordans
ferragamo shoes
coach factory outlet online
polo ralph lauren outlet online
louis vuitton
coach outlet store
moncler coats
kate spade
puma shoes
ugg australia
kate spade outlet store
rolex watches
canada goose uk
kate spade outlet
pandora jewelry
coach factory outlet
yeezy boost 350
air jordan shoes
mulberry bags
ralph lauren uk
vans store
canada goose jackets uk
converse shoes
converse outlet store
jordan shoes
north face outlet
air max 2018
moncler jackets
canada goose outlet
nike air max
pandora charms sale clearance
yeezy boost
coach outlet online
mlb jerseys
coach outlet
adidas outlet
mont blanc pens
ralph lauren sale clearance
coach outlet store
ray ban sunglasses discount
coach outlet
mcm outlet
prada handbags
tods outlet
hermes outlet
nike store
cheap jordans free shipping
mbt shoes
pandora jewelry official site
michael kors outlet
kate spade outlet store
polo ralph lauren outlet online
polo ralph lauren outlet
nike free 4.0
polo ralph lauren outlet
coach factory outlet
cheap nike air max
coach outlet
canada goose outlet
polo outlet
hermes handbags
louis vuitton handbags
uggs canada
adidas yeezy
kate spade outlet
adidas shoes
ugg boots on sale
polo ralph lauren outlet
oakley sunglasses
nike zoom
tory burch outlet online
coach outlet
mulberry handbags
pandora jewelry official site
nike huarache
ray ban sunglasses
nike outlet store
adidas yeezy
new balance shoes
cheap nfl jerseys
adidas superstar
jordan shoes
adidas nmd
nike outlet
birkenstock outlet
canada goose
canada goose sale
supreme clothing
louboutin shoes
ralph lauren sale
ralph lauren outlet
kobe bryant shoes
timberland outlet
coach outlet
michael kors outlet canada
louis vuitton outlet
nike shoes
pandora jewelry
nike outlet online
cheap jordan shoes
nmd adidas
rolex watches
adidas yeezy
michael kors outlet
philipp plein outlet
yeezy boost
nike free run
tory burch outlet store
hermes bags
kevin durant shoes
pandora jewelry outlet
air max 97
christian louboutin outlet
coach outlet store
coach outlet
pandora outlet
pandora charms
coach factorty outlet
pandora jewelry
coach outlet
supreme clothing
ralph lauren outlet

You have to log in before you can reply Login | Sign Up

Points Rules