Please shows the calculation by referring the coding, theory formula and result of the coding. Coding: Result: formula:
Posted: Fri Jul 08, 2022 6:35 am
Please shows the calculation by referring the coding, theory formula and result of the coding.
Coding:
Result:
formula:
#define LM35 A1 #define RED 8 #define GREEN 7 #define sensorPin Al float lm_value; float tempc; void setup() { Serial.begin(9600); pinMode (RED, OUTPUT); pinMode (GREEN, OUTPUT); } void loop() { 1m_value= analogRead (LM35); tempe= (lm_value* 500) / 1023; Serial.println (tempc); //Temperature in Celcius. int reading analogRead (sensorPin); float voltage = reading float temperatureC= voltage* 100; Serial.print ("Voltage = "); Serial.print (voltage); = Serial.print("Temperature = "); Serial.print (temperatureC); //Condition if (tempc> 40) { digitalWrite (RED, HIGH); digitalWrite (GREEN, LOW); } else { digitalWrite (GREEN, HIGH); digitalWrite (RED, LOW); } (5.0/1024.0); delay(1000);
No. Time (Seconds) 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 0 10 20 30 40 50 60 70 80 90 100 110 120 Serial Monitor Temperature Reading (°C) 29.79 29.31 30.27 35.64 77.65 87.89 82.53 76.66 62.02 54.75 45.41 33.69 30.76 Serial Monitor Voltage Reading (V) 0.30 0.29 0.30 0.36 0.78 0.88 0.83 0.77 0.62 0.55 0.45 0.34 0.31
ADC = Where: Vin = ADC input voltage Vref= ADC reference Voltage (4.9 Volts) Vin x 1024 Vref
Coding:
Result:
formula:
#define LM35 A1 #define RED 8 #define GREEN 7 #define sensorPin Al float lm_value; float tempc; void setup() { Serial.begin(9600); pinMode (RED, OUTPUT); pinMode (GREEN, OUTPUT); } void loop() { 1m_value= analogRead (LM35); tempe= (lm_value* 500) / 1023; Serial.println (tempc); //Temperature in Celcius. int reading analogRead (sensorPin); float voltage = reading float temperatureC= voltage* 100; Serial.print ("Voltage = "); Serial.print (voltage); = Serial.print("Temperature = "); Serial.print (temperatureC); //Condition if (tempc> 40) { digitalWrite (RED, HIGH); digitalWrite (GREEN, LOW); } else { digitalWrite (GREEN, HIGH); digitalWrite (RED, LOW); } (5.0/1024.0); delay(1000);
No. Time (Seconds) 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 0 10 20 30 40 50 60 70 80 90 100 110 120 Serial Monitor Temperature Reading (°C) 29.79 29.31 30.27 35.64 77.65 87.89 82.53 76.66 62.02 54.75 45.41 33.69 30.76 Serial Monitor Voltage Reading (V) 0.30 0.29 0.30 0.36 0.78 0.88 0.83 0.77 0.62 0.55 0.45 0.34 0.31
ADC = Where: Vin = ADC input voltage Vref= ADC reference Voltage (4.9 Volts) Vin x 1024 Vref