Get Maximum Control Over Your Fans with PWN Fan Controller with Temperature Sensing and Button Override

13 May 2023 Balmiki Mandal 0 µC - µP

Introducing the PWN Fan Controller with Temp Sensing and Button Override

Are you looking for a fan speed controller that can give you ultimate control over the temperature in your home? Look no further than the PWN Fan Controller with Temp Sensing and Button Override. This fan controller gives you the flexibility to precisely regulate the temperature of your room without having to manually adjust the fan speed.

The PWN Fan Controller is equipped with a temperature sensor that continuously monitors the room's temperature. If the temperature rises above the set point, the fan speed will automatically adjust to maintain the desired environment. Additionally, the fan speed can be manually adjusted with the on-board button override switch.

The PWN Fan Controller also features power saving modes. When enabled, the fan controller will reduce the fan speed when the temperature drops below the target temperature. This helps save energy and reduces fan noise.

Whether you need to maintain an ideal temperature for sleeping, working, or entertaining guests, the PWN Fan Controller with Temp Sensing and Button Override gives you the ultimate control over the temperature in your environment. Try it today and enjoy the perfect climate all year round.

Here is an example code for a PWM fan controller with temperature sensing and button override using an Arduino:

// Include libraries
#include <OneWire.h>
#include <DallasTemperature.h>

// Define pins
#define FAN_PIN 3
#define BUTTON_PIN 4
#define TEMP_SENSOR_PIN 5

// Define temperature thresholds
#define TEMP_HIGH 30.0
#define TEMP_LOW 25.0

// Initialize variables
OneWire oneWire(TEMP_SENSOR_PIN);
DallasTemperature sensors(&oneWire);
int fanSpeed = 0;
bool buttonPressed = false;

void setup() {
  pinMode(FAN_PIN, OUTPUT);
  pinMode(BUTTON_PIN, INPUT_PULLUP);
  Serial.begin(9600);
  sensors.begin();
}

void loop() {
  // Read temperature sensor
  sensors.requestTemperatures();
  float tempC = sensors.getTempCByIndex(0);
  
  // Check temperature thresholds
  if (tempC > TEMP_HIGH) {
    fanSpeed = 255;
  } else if (tempC < TEMP_LOW) {
    fanSpeed = 0;
  } else {
    float tempRange = TEMP_HIGH - TEMP_LOW;
    fanSpeed = (tempC - TEMP_LOW) / tempRange * 255;
  }
  
  // Check button state
  if (digitalRead(BUTTON_PIN) == LOW) {
    buttonPressed = true;
  } else {
    buttonPressed = false;
  }
  
  // Override fan speed if button is pressed
  if (buttonPressed) {
    fanSpeed = 255;
  }
  
  // Set fan speed
  analogWrite(FAN_PIN, fanSpeed);
  
  // Debugging output
  Serial.print("Temperature: ");
  Serial.print(tempC);
  Serial.print("C, Fan Speed: ");
  Serial.println(fanSpeed);
  
  delay(1000);
}

In this example, the fan speed is controlled by PWM output on pin 3, and a button is connected to pin 4 to override the temperature-based control. A temperature sensor is connected to pin 5 to measure the ambient temperature.

In the setup() function, the pins are initialized as output or input with pull-up resistor, and the temperature sensor is initialized with the OneWire and DallasTemperature libraries.

In the loop() function, the temperature sensor is read and the fan speed is adjusted based on the temperature thresholds defined by TEMP_HIGH and TEMP_LOW. If the temperature is above TEMP_HIGH, the fan speed is set to maximum (255). If the temperature is below TEMP_LOW, the fan speed is set to minimum (0). Otherwise, the fan speed is linearly interpolated between 0 and 255 based on the temperature range between TEMP_HIGH and TEMP_LOW.

The state of the button is checked using digitalRead(BUTTON_PIN), and the buttonPressed variable is set accordingly. If the button is pressed, the fan speed is overridden to maximum (255).

The fan speed is set using analogWrite(FAN_PIN, fanSpeed), and the temperature and fan speed are output to the serial console for debugging.

Note that this is a simplified example and does not include error handling or advanced features such as hysteresis or fan ramping. The actual implementation may depend on the specific fan and temperature sensor used, as well as the desired performance and functionality.

BY: Balmiki Mandal

Related Blogs

Post Comments.

Login to Post a Comment

No comments yet, Be the first to comment.