the program works just only for 3 hours or 5., i cant just sure of it.,
after many hours of working is suddenly on and off the relay., every seconds
what would be my problem?
i use power supply for arduino uno an 13.8 volts 3a.
since arduino has its own voltage regulator.
can you identify my problems?
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 6
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
void setup(void)
{
pinMode(2, OUTPUT); // maintain bulb small bulb ; this connected to relay controlling ac bulb
pinMode(3, OUTPUT); // two bulb;this connected to relay controlling ac bulb
pinMode(8, OUTPUT); // exhaust fan;this connected to relay controlling ac fan
pinMode(10, OUTPUT); this connected to relay controlling ac fan
Serial.begin(9600);
Serial.println("Dallas Temperature IC Control Library Demo");
sensors.begin();
}
void loop(void)
{
sensors.requestTemperatures(); // Send the command to get temperatures
delay(2000);
float sensorT = sensors.getTempCByIndex(0);
//-----------------------------
if (sensorT < 36.9){
Serial.println("less than normal temp");
Serial.println(sensorT);
digitalWrite(2, HIGH); // maintain bulb small bulb
digitalWrite(3, HIGH); // two bulb
digitalWrite(8, LOW); // exhaust fan
digitalWrite(10, LOW); // pakanat fan
}
else if ((sensorT >36.9) && (sensorT < 37.5 ))
{
Serial.println("normal temp");
Serial.println(sensorT);
digitalWrite(2, HIGH); // maintain bulb small bulb
digitalWrite(3, LOW); // two bulb
digitalWrite(8, LOW); // exhaust fan
digitalWrite(10, LOW); // pakanat fan
// break;
}
else if (sensorT > 37.5 && sensorT < 38)
{
Serial.println("higher 37.5 temp");
Serial.println(sensorT);
Serial.println(digitalRead(2));
digitalWrite(2, HIGH); // maintain bulb small bulb
digitalWrite(3, LOW); // two bulb
digitalWrite(8, HIGH); // exhaust fan
digitalWrite(10, LOW); // pakanat fan
}
else
{
Serial.println("higher 38 temp");
Serial.println(sensorT);
Serial.println(digitalRead(2));
digitalWrite(2, LOW); // maintain bulb small bulb
digitalWrite(3, LOW); // two bulb
digitalWrite(8, HIGH); // exhaust fan
digitalWrite(10, HIGH); // pakanat fan
}
delay(2000);
}