Skip to main content

Crystal LCD, Temperature Sensor and DC Motor

Motor control using Temperature sensor

Description: 

The DC motor is controlled through the Temperature Sensor using the following criteria. 
  • When the Temperature reading is above 90' F, the motor is turned ON. "Motor is ON" status and Temperature value is displayed on the LCD screen. 
  • When the Temperature reading is less than 90' F, the motor is turned OFF. "Motor is OFF" status and Temperature value is displayed on the LCD screen. 

Components required:

  1. Arduino UNO
  2. DC motor
  3. Motor Driver [L293D]
  4. Battery [9V]
  5. LCD [16 * 2]
  6. Temperature Sensor [TMP36]

Schematic diagram:



Code: 

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

int celsius = 0;
int fahrenheit = 0;
int Ena=7;
void setup()
{
  lcd.begin(16, 2);
  pinMode(A0, INPUT);
  pinMode(13, OUTPUT);
  pinMode(8, OUTPUT);
  analogWrite(Ena,255);
}

void loop()
{
  celsius = map(((analogRead(A0))), 0, 1023, 30, 70);
  fahrenheit = ((celsius * 9) / 5 + 32);
  Serial.print(celsius);
  Serial.print(" C, ");
  Serial.print(fahrenheit);
  Serial.println(" F");
  
   if (fahrenheit < 100) 
   {
     lcd.setCursor(0, 0);
    digitalWrite(8, LOW);
    digitalWrite(13, LOW);
    lcd.print("Motor is off");
    lcd.setCursor(0, 1);
  lcd.print(fahrenheit);
     lcd.setCursor(2, 1);
     lcd.print("-F");
     lcd.setCursor(4, 1);
     lcd.print(" ");
     
  }
  
  if (fahrenheit > 100)
  {
    digitalWrite(13,LOW);
    digitalWrite(8, HIGH);
    lcd.setCursor(0, 0);
    lcd.print("Motor is on "); 
    lcd.setCursor(0, 1);
    lcd.print(fahrenheit);
    lcd.setCursor(3, 1);
    lcd.print("-F");
  }
  
  delay(1000); 
}

Comments

  1. William Hill Betting Locations | Mapyro
    Find William bsjeon.net Hill sports https://sol.edu.kg/ betting locations in Maryland, West Virginia, Indiana, Pennsylvania, South Dakota, West 출장마사지 Virginia https://octcasino.com/ and more. https://septcasino.com/review/merit-casino/ BetRivers.com.

    ReplyDelete

Post a Comment

Popular posts from this blog

Control DC Motor using Temperature sensor

Control DC Motor using Temperature sensor Description:  The DC motor is controlled through the Temperature Sensor using the following criteria.  When the Temperature reading is greater than 40' C, the Motor is ON  and the Red LED is turned ON .  When the Temperature reading is less than 40' C, the Motor is OFF and the Green LED is turned ON. Working Demo:  https://youtu.be/L-koKBFJmVI Components required: Arduino UNO DC motor Motor Driver [L293D] Battery [9V] Temperature Sensor [TMP36] Schematic diagram: Code:  int celsius = 0; int fahrenheit = 0; int Ena=7; void setup() {   Serial.begin(9600);   pinMode(A0, INPUT);   pinMode(13, OUTPUT);   pinMode(8, OUTPUT);   pinMode(2, OUTPUT);   pinMode(3, OUTPUT);   analogWrite(Ena,255); } void loop() {   celsius = map(((analogRead(A0))), 0, 1023, 30, 70);   fahrenheit = ((celsius * 9) / 5 + 32);   Seria...