faeibson / ESPPWMFanControl

ESP PWM Fan Control
GNU General Public License v3.0
30 stars 14 forks source link

ESP PWM Fan Control

This application in its predefined configuration reads the temperature from an 10 kOhm NTC (wired to 3.3V via 150 kOhm pull-up resistor) connected to A0 and enables you to automatically control three PWM channels separately. Of course, all of these values are configurable in the settings file.

Let's dig into some more details:

How to install

Simply flash the project onto your ESP board through the Arduino IDE, or try out the compiled binary. You can flash it via esptool to your Wemos D1 mini, while NodeMCU and other similar boards with an ESP-12E or F (and maybe others) should work with that binary, too.

Requirements

Hardware

Software

Possible future improvements and extensions

Screenshots

Web interface

The web interface

JSON output

All of the relevant (and some not-so-relevant) variables and configuration data is accessible in JSON format under /json. The web interface itself uses it, too, to load and refresh the displayed values. The output is like:

{
  "activeFanControlSet": 0,
  "automaticFanControlEnabled": true,
  "displayAddress": 60,
  "displayDurationPerMinute": 60,
  "displayEnabled": false,
  "displayFlipScreen": true,
  "displayIsOn": false,
  "id": "ESP",
  "ntcTemperature": 23.6,
  "ntcTemperatureTimeSinceMeasurement": 736,
  "pageRefreshTime": 0,
  "fanCount": 3,
  "fanPercentStepSize": 25,
  "maxFanControlSets": 9,
  "fanPins": [
    13,
    12,
    0
  ],
  "fanSpeeds": [
    100,
    100,
    100
  ],
  "fanSpeedsActive": [
    25,
    25,
    25
  ],
  "fanControlSets": [
    {
      "fanSpeeds": [
        25,
        25,
        25
      ],
      "tempThreshold": 0
    },
    {
      "fanSpeeds": [
        50,
        50,
        50
      ],
      "tempThreshold": 24
    },
    {
      "fanSpeeds": [
        75,
        75,
        75
      ],
      "tempThreshold": 26
    }
  ]
}

You can see that the fans are set to 25 % each at the moment and there are three configuration sets for 26 °C, 24 °C and below 24 °C measured temperature. The automatic fan control mode is enabled, whereas the last manual fan speed setting was 100 % for all three channels. The last NTC temperature was 23.6 °C which was measured 736 ms ago.
Of course, since the project is in an early state, the naming and structure probably will still change and improve.

Credits

The favicon has been made by Stefania Servidio. The previously used icon can be found here.

Changelog

1.0-beta2