Skip to main content

arduino-fan-speed-controlled-temperature


    arduino-fan-speed-controlled-temperature

  1. #include <LiquidCrystal.h>
  1. //source: http://www.electroschematics.com/9540/arduino-fan-speed-controlled-temperature/
  1. LiquidCrystal lcd(7,6,5,4,3,2);
  1. int tempPin = A1; // the output pin of LM35
  1. int fan = 11; // the pin where fan is
  1. int led = 8; // led pin
  1. int temp;
  1. int tempMin = 30; // the temperature to start the fan
  1. int tempMax = 70; // the maximum temperature when fan is at 100%
  1. int fanSpeed;
  1. int fanLCD;
  1.  
  1. void setup() {
  1. pinMode(fan, OUTPUT);
  1. pinMode(led, OUTPUT);
  1. pinMode(tempPin, INPUT);
  1. lcd.begin(16,2);
  1. }
  1.  
  1. void loop() {
  1. temp = readTemp(); // get the temperature
  1. if(temp < tempMin) { // if temp is lower than minimum temp
  1. fanSpeed = 0; // fan is not spinning
  1. digitalWrite(fan, LOW);
  1. }
  1. if((temp >= tempMin) && (temp <= tempMax)) { // if temperature is higher than minimum temp
  1. fanSpeed = map(temp, tempMin, tempMax, 32, 255); // the actual speed of fan
  1. fanLCD = map(temp, tempMin, tempMax, 0, 100); // speed of fan to display on LCD
  1. analogWrite(fan, fanSpeed); // spin the fan at the fanSpeed speed
  1. }
  1. if(temp > tempMax) { // if temp is higher than tempMax
  1. digitalWrite(led, HIGH); // turn on led
  1. } else { // else turn of led
  1. digitalWrite(led, LOW);
  1. }
  1. lcd.print("TEMP: ");
  1. lcd.print(temp); // display the temperature
  1. lcd.print("C ");
  1. lcd.setCursor(0,1); // move cursor to next line
  1. lcd.print("FANS: ");
  1. lcd.print(fanLCD); // display the fan speed
  1. lcd.print("%");
  1. delay(200);
  1. lcd.clear();
  1. }
  1.  
  1. int readTemp() { // get the temperature and convert it to celsius
  1. temp = analogRead(tempPin);
  1. return temp * 0.48828125;
  1. }

Comments

Popular posts from this blog

Inverted Linear Quadtree: Efficient Top K Spatial Keyword Search

Inverted Linear Quadtree: Efficient Top K Spatial Keyword Search ABSTRACT: In this paper, With advances in geo-positioning technologies and geo-location services, there are a rapidly growing amount of spatiotextual objects collected in many applications such as location based services and social networks, in which an object is described by its spatial location and a set of keywords (terms). Consequently, the study of spatial keyword search which explores both location and textual description of the objects has attracted great attention from the commercial organizations and research communities. In the paper, we study two fundamental problems in the spatial keyword queries: top k spatial keyword search (TOPK-SK), and batch top k spatial keyword search (BTOPK-SK). Given a set of spatio-textual objects, a query location and a set of query keywords, the TOPK-SK retrieves the closest k objects each of which contains all keywords in the query. BTOPK-SK is the batch processing of sets...

A simple and reliable touch sensitive security system CODING

#include <REGX51.H> #include "lcd.c" #define MAX_DELAY() delay(65000) sbit Vibra_Sense=P3^1; sbit Buz=P1^0; void intro() {  lcd_init();  lcd_str("Touch Sensitive ",0x80);  lcd_str("Security System ",0xc0);  MAX_DELAY();MAX_DELAY();  lcd_clr();  }  void main()  { unsigned int i = 0, j= 0; intro();    while(1)    { lcd_str("Security Syst On",0x80); lcd_str("No Vibra Detectd",0xc0); Buz = 1; if(Vibra_Sense == 1) { while(Vibra_Sense == 1) delay(1000); } else { while(Vibra_Sense == 0) delay(1000); } Buz = 0; lcd_str("Vibraton Detectd",0xc0);delay(65000); while(1);    }  }

A Time Efficient Approach for Detecting Errors in Big Sensor Data on Cloud

A Time Efficient Approach for Detecting Errors in Big Sensor Data on Cloud Abstract                                                                                                                                                      ...