2Views0Replies

Author Options:

Temperature monitoring? Answered

Hello sir/mem,

I want to monitoring a temperature with Arduino Uno r3. I write a code but Arduino get temperature reading without connect lm35 temperature sensor

My code


const int temp1 = 1;
const int temp2 = 2;
const int temp3 = 3;
const int temp4 = 4;

#include
#include //is necesary for the library!!
Sim800l Sim800l; //to declare the library
char text[161]=""; //buffer to store message
char number[11]=""; //phone number to send message
int cnt;
bool error; //to catch the response of sendSms



void setup()
{
Serial.begin (9600);
pinMode (temp1, INPUT);
pinMode (temp2, INPUT);
pinMode (temp3, INPUT);
pinMode (temp4, INPUT);


Sim800l.begin(); // initializate the library.
Serial.begin(9600);
}
void loop()
{


// left_1

float Real_Voltage1 = analogRead(temp1)* 0.004882814;
float Temp1_C = Real_Voltage1 * 100.0;
float Temp1_F = Temp1_C * (9.0/5.0) + 32.0;
Serial.print(analogRead(temp1));
Serial.print("Voltage_A1: ");
Serial.print(Real_Voltage1);
Serial.print("A1_l_1_C: ");
Serial.print(Temp1_C);
Serial.print("A1_l_1_F: ");
Serial.print(Temp1_F);

if ( Temp1_C >= 135.0)
{
Serial.println("Warning: The system is hot");
delay(1000);
}
else if (Temp1_C <= 25.0)
{
Serial.println("Warning: The system is cold");
delay(1000);
}
else
{
Serial.println("The system is functioning well ");
delay(1000);
}



// left_2

float Real_Voltage2 = analogRead(temp2)* 0.004882814;
float Temp2_C = Real_Voltage2 * 100.0;
float Temp2_F = Temp2_C * (9.0/5.0) + 32.0;
Serial.print(analogRead(temp2));
Serial.print("Voltage2: ");
Serial.print(Real_Voltage2);
Serial.print("A1_l_2_C:: ");
Serial.print(Temp2_C);
Serial.print("A1_l_2_F: ");
Serial.print(Temp2_F);

if ( Temp2_C >= 135.0)
{
Serial.println("Warning: The system is hot");
delay(1000);
}
else if (Temp2_C <= 25.0)
{
Serial.println("Warning: The system is cold");
delay(1000);
}
else
{
Serial.println("The system is functioning well ");
delay(1000);
}


// right 1


float Real_Voltage3 = analogRead(temp3)* 0.004882814;
float Temp3_C = Real_Voltage3 * 100.0;
float Temp3_F = Temp3_C * (9.0/5.0) + 32.0;
Serial.print(analogRead(temp3));
Serial.print("Voltage3: ");
Serial.print(Real_Voltage3);
Serial.print("A1_R_1_C:: ");
Serial.print(Temp3_C);
Serial.print("A1_R_1_F: ");
Serial.print(Temp3_F);

if ( Temp3_C >= 135.0)
{
Serial.println("Warning: The system is hot");
delay(1000);
}
else if (Temp3_C <= 25.0)
{
Serial.println("Warning: The system is cold");
delay(1000);
}
else
{
Serial.println("The system is functioning well ");
delay(1000);
}

// right 2

float Real_Voltage4 = analogRead(temp4)* 0.004882814;
float Temp4_C = Real_Voltage4 * 100.0;
float Temp4_F = Temp4_C * (9.0/5.0) + 32.0;
Serial.print(analogRead(temp4));
Serial.print("Voltage4: ");
Serial.print(Real_Voltage4);
Serial.print("A1_R_2_C:: ");
Serial.print(Temp4_C);
Serial.print("A1_R_2_F: ");
Serial.print(Temp4_F);

if ( Temp4_C >= 135.0)
{
Serial.println("Warning: The system is hot");
delay(1000);
}
else if (Temp4_C <= 25.0)
{
Serial.println("Warning: The system is cold");
delay(1000);
}
else
{
Serial.println("The system is functioning well ");
delay(1000);
}

}

Discussions