Added readme for PWM fan usermod.
This commit is contained in:
parent
9d5b6eac55
commit
62e7c861bd
36
usermods/PWM_fan/readme.md
Normal file
36
usermods/PWM_fan/readme.md
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# PWM fan
|
||||||
|
|
||||||
|
v2 Usermod to to control PWM fan with RPM feedback and temperature control
|
||||||
|
|
||||||
|
This usermod requires Dallas Temperature usermod to obtain temperature information. If this is not available the fan will always run at 100% speed.
|
||||||
|
If the fan does not have _tacho_ (RPM) output you can set the _tacho-pin_ to -1 to not use that feature.
|
||||||
|
|
||||||
|
You can also set the thershold temperature at which fan runs at lowest speed. If the actual temperature measured will be 3°C greater than threshold temperature the fan will run at 100%.
|
||||||
|
|
||||||
|
If the _tacho_ is supported the current speed (in RPM) will be repored in WLED Info page.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Add the compile-time option `-D USERMOD_PWM_FAN` to your `platformio.ini` (or `platformio_override.ini`) or use `#define USERMOD_PWM_FAN` in `myconfig.h`.
|
||||||
|
You will also need `-D USERMOD_DALLASTEMPERATURE`.
|
||||||
|
|
||||||
|
### Define Your Options
|
||||||
|
|
||||||
|
All of the parameters are configured during run-time using Usermods settings page.
|
||||||
|
This includes:
|
||||||
|
|
||||||
|
* PWM output pin
|
||||||
|
* tacho input pin
|
||||||
|
* sampling frequency in seconds
|
||||||
|
* threshold temperature in degees C
|
||||||
|
|
||||||
|
_NOTE:_ You may also need to tweak Dallas Temperature usermod sampling frequency to match PWM fan sampling frequency.
|
||||||
|
|
||||||
|
### PlatformIO requirements
|
||||||
|
|
||||||
|
No special requirements.
|
||||||
|
|
||||||
|
## Change Log
|
||||||
|
|
||||||
|
2021-10
|
||||||
|
* First public release
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#include "wled.h"
|
#include "wled.h"
|
||||||
|
|
||||||
// PWM code curtesy of @KlausMu
|
// PWM & tacho code curtesy of @KlausMu
|
||||||
// https://github.com/KlausMu/esp32-fan-controller/tree/main/src
|
// https://github.com/KlausMu/esp32-fan-controller/tree/main/src
|
||||||
// adapted for WLED usermod by @blazoncek
|
// adapted for WLED usermod by @blazoncek
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ class PWMFanUsermod : public Usermod {
|
|||||||
// configurable parameters
|
// configurable parameters
|
||||||
int8_t tachoPin = -1;
|
int8_t tachoPin = -1;
|
||||||
int8_t pwmPin = -1;
|
int8_t pwmPin = -1;
|
||||||
uint8_t tachoUpdateSec = 5;
|
uint8_t tachoUpdateSec = 30;
|
||||||
float targetTemperature = 25.0;
|
float targetTemperature = 25.0;
|
||||||
|
|
||||||
// strings to reduce flash memory usage (used more than twice)
|
// strings to reduce flash memory usage (used more than twice)
|
||||||
@ -205,6 +205,7 @@ class PWMFanUsermod : public Usermod {
|
|||||||
* Below it is shown how this could be used for e.g. a light sensor
|
* Below it is shown how this could be used for e.g. a light sensor
|
||||||
*/
|
*/
|
||||||
void addToJsonInfo(JsonObject& root) {
|
void addToJsonInfo(JsonObject& root) {
|
||||||
|
if (tachoPin < 0) return;
|
||||||
JsonObject user = root["u"];
|
JsonObject user = root["u"];
|
||||||
if (user.isNull()) user = root.createNestedObject("u");
|
if (user.isNull()) user = root.createNestedObject("u");
|
||||||
JsonArray data = user.createNestedArray(FPSTR(_name));
|
JsonArray data = user.createNestedArray(FPSTR(_name));
|
||||||
|
Loading…
Reference in New Issue
Block a user