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.
Working Demo:
https://youtu.be/8wGgASq5C84
Components required:
- Arduino UNO
- DC motor
- Motor Driver [L293D]
- Battery [9V]
- LCD [16 * 2]
- 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);
}
William Hill Betting Locations | Mapyro
ReplyDeleteFind 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.