Hi, Sorry to hijack this thread, I am trying to follow this but am struggling as I know very little about coding. I am still learning but this is beyond me

I am trying to do a very similar thing but using the ambient temp sensor as that is my controller enclosure temp and I want to control the fan that keeps the enclosure cool when it gets too hot (led drivers are also in the enclosure so it may get hot in there)
This is what I have so far but not sure if its enough
In Ferduino_with_webcontrol_beta
Code: Select all
const byte desativarFanPin = 1; // Pino que desativa os coolers.
const byte desativarFanPinA = 7; // Pino que desativa os coolers.
//*****************************************************************************************
//*********************** Variáveis de controle da temperatura do dissipador **************
//*****************************************************************************************
float tempH = 0; // Temperatura do dissipador
float tempA = 0; // Temperatura do dissipador
byte tempHR = 60; // Temperatura para reduzir potência dos leds
byte potR = 30; // Porcentagem a ser reduzida.
//*****************************************************************************************
//*********** Variáveis temporárias de controle da temperatura do dissipador **************
//*****************************************************************************************
float temperatura_dissipador_temp = 0; // Temperatura temporária
float temperatura_ambiente_temp = 0; // Temperatura temporária
byte tempHR_t = 0; // Temperatura temporária para reduzir potência dos leds
byte potR_t = 0; // Porcentagem temporária a ser reduzida.
boolean temperatura_alta = false; // Sinaliza que a temperatura dos leds está alta.
boolean temperatura_baixou = false; // Sinaliza que a temperatura dos leds esteve alta.
In tab Inicio
Code: Select all
myGLCD.setColor(0, 255, 0);
myGLCD.printNumF(tempH, 2, 316, 14); // Temperatura dissipador
myGLCD.printNumF(tempA, 2, 316, 14); // Temperatura dissipador
myGLCD.printNumF(tempC, 2, 302, 28); // Temperatura da agua
myGLCD.printNumF(PHA, 2, 327, 42); // PH aqua
myGLCD.printNumF(PHR, 2, 316, 56); // PH reator
myGLCD.printNumI(DEN, 293, 70); // Densidade
myGLCD.printNumI(ORP, 245, 84); // ORP
myGLCD.printNumF(tempA, 2, 312, 195); // Temperatura ambiente
In leds
Code: Select all
if((tempH >= tempHR) || (tempA >= tempHR) )
{
reduzir = (1 - (potR *.01));
temperatura_alta = true;
temperatura_baixou = false;
}
if(temperatura_alta == true)
{
if((tempH <= (tempHR - 5)) && (tempA <= (tempHR - 5))) // Se a temperatura estiver 5°C abaixo do especificado a potência volta ao valor normal.
{
reduzir = 1.00;
temperatura_alta = false;
temperatura_baixou = true;
}
else
{
reduzir = (1 - (potR *.01));
temperatura_baixou = false;
}
}
In parametros
Code: Select all
if(tempH < HtempMin) // Desativa os coolers se a temperatura estive abaixo da mínima definida.
{
digitalWrite(desativarFanPin, LOW);
}
else
{
digitalWrite(desativarFanPin, HIGH);
}
if(tempA < HtempMin) // Desativa os coolers se a temperatura estive abaixo da mínima definida.
{
digitalWrite(desativarFanPinA, LOW);
}
else
{
digitalWrite(desativarFanPinA, HIGH);
}
Not sure if I need Fanspeed 1 & 2 or not.
Otherwise, how does this look to you

Guy