CodeOhms
Posts: 5
Joined: Sat Jul 07, 2018 8:27 am

This is how to control fan based on temperature

Sat Jul 07, 2018 11:08 am

Hi everyone,
I've recently created a program for my pi to control multiple fans. Just thought I'd share it :) . https://github.com/CodeOhms/RPi_Fan_Controller


Features
  • Configurable
  • PWM - varying speeds
    :arrow: Works with basic two pin fans. Don't have a proper pwm fan so I can't test for that
  • Control multiple fans, each assigned to a group
    :arrow: Each fan group is associated with a temperature sensor. Support currently only exists for the internal sensor - if enough want it I can add support for external sensors
    :arrow: Each group is assigned a speed from 0 to 100
  • Runs on start up
Please share this with your friends.

User avatar
Z80 Refugee
Posts: 337
Joined: Sun Feb 09, 2014 1:53 pm

Re: This is how to control fan based on temperature

Sun Jul 08, 2018 8:11 am

Not being a programmer, it is not immediately obvious to me how FanController.conf defines what pin(s) are controlling your fans. Does the default file define one fan on pin 18 by any chance? If so, that's just a guess and the comments could be a lot more explicit.

I think you should also include information (or links to information) on how to connect a fan - novices may well think you can just wire one to an RPi pin.
Military and Automotive Electronics Design Engineer (retired)

For the best service: make your thread title properly descriptive, and put all relevant details in the first post (including links - don't make us search)!

CodeOhms
Posts: 5
Joined: Sat Jul 07, 2018 8:27 am

Re: This is how to control fan based on temperature

Thu Jul 12, 2018 5:51 am

Hey mate,
sorry for the late reply - busy with work, the usual.

I've added some more information in the configuration file. This is, essentially, what I wrote:
numbers between the inner square brackets [ ] are the gpio pins to which an individual fan is connected. Each set of brackets is assigned a number starting from zero upwards. This number is the group ID number. Here is the excerpt which I included:
# Fan group ID derived from index, and fanID is associated output pin
fanInfo = [ [18] ]
# Above translates to: group 0 => fan connected on pin 18
# Example with multiple fans and groups
# [ [18, 16], [15] ] -> group 0 => fans connected on pins 18 and 16
# -> group 1 => fan connected on pin 15
For reference, here is a picture of the RPi gpio pin layout https://www.element14.com/community/ser ... 3_gpio.png.

CodeOhms
Posts: 5
Joined: Sat Jul 07, 2018 8:27 am

Re: This is how to control fan based on temperature

Thu Jul 12, 2018 6:33 am

This is how each fan should be wired, assuming a 5v motor.
Please note I am not responsible for any damage incurred by undertaking this.

Here is a discussion goes into depth about wiring a fan for you RPi: viewtopic.php?f=41&t=194621.
Attachments
RPi_fan_circuit_schem.png
RPi_fan_circuit_schem.png (81.18 KiB) Viewed 74 times

Return to “Other projects”

Who is online

Users browsing this forum: No registered users and 26 guests