 
 In my project I will have two heatsinks, and ferduino there is only one sensor to sink, Fernando Garcia asked about adding one more sensor for a second heatsink and he showed me an example.
With this example I modified the code by adding a second sensor to the heatsink without losing the features that already exist in the management of Arduino fans due to the temperature.
This second sensor will receive the address manually, by passing the address code.
Show here the modification, I'm not good programmer
 , so I'm putting here to aid others with the same need and if necessary correct or can someone give an idea to improve this change.
 , so I'm putting here to aid others with the same need and if necessary correct or can someone give an idea to improve this change.I still did not upload the code to arduino.
hugs
Code Changes:
In Ferduino_with_webcontrol_beta
This changes:
Code: Select all
//****************************************************************************************************
//***************** Variáveis dos sensores de temperatura ********************************************
//****************************************************************************************************
DeviceAddress sensor_dissipador1; // Atribui os endereços dos sensores de temperatura.
DeviceAddress sensor_dissipador2 = {0x28, 0x9C, 0xA9, 0xAA, 0x03, 0x00, 0x00, 0x44}; // Find the address using the example "tester" available in DallasTemperature. // Atribui os endereços dos sensores de temperatura.
---
//*****************************************************************************************
//*********************** Variáveis de controle da temperatura do dissipador **************
//*****************************************************************************************
float tempH1 = 0;   // Temperatura do dissipador1
float tempH2 = 0;   // Temperatura do dissipador2
//*****************************************************************************************
//*********** Variáveis temporárias de controle da temperatura do dissipador **************
//*****************************************************************************************
float temperatura_dissipador1_temp = 0; // Temperatura temporária
float temperatura_dissipador2_temp = 0; // Temperatura temporária
-------------------------------------------------------------------------------------------------------------------------------------------
IN tab A_Portuguese
This changes:
Code: Select all
prog_char texto257[] PROGMEM = "T.DISSIP. 2:"; // tabela_textos[257]
and add in tabela_texto
Code: Select all
..texto257...
-------------------------------------------------------------------------------------------------------------------------------------------
In tab emprom
This changes:
Code: Select all
void ReadDallasAddress()
{
  for (byte i = 0; i < 8; i++)
  {
    sensor_agua[i] = EEPROM.read(766 + i);    // sensor address
    sensor_dissipador1[i] = EEPROM.read(775 + i);
    sensor_ambiente[i] = EEPROM.read(784 + i);
  } 
void SaveDallasAddress ()
{
  for (byte i = 0; i < 8; i++)
  {
    EEPROM.write(766 + i, sensor_agua[i]);
    EEPROM.write(775 + i, sensor_dissipador1[i]); 
    EEPROM.write(784 + i, sensor_ambiente[i]);
  }
----------------------------------------------------------------------------------------------------
In tab Inicio
This Changes:
Code: Select all
    strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[183])));
    myGLCD.print(buffer, 212, 14);  // tabela_textos[183] = "T.DISSIPADOR1:"  
    
    strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[257])));
    myGLCD.print(buffer, 212, 28); // tabela_textos[257] = "T.DISSIP. 2:
    strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[184])));
    myGLCD.print(buffer, 212, 42); // tabela_textos[184] = "TEMP. AGUA:"
...
  myGLCD.setColor(0, 255, 0);  
  myGLCD.printNumF(tempH1, 2, 316, 14);   // Temperatura dissipador1
  myGLCD.printNumF(tempH2, 2, 302, 28);   // Temperatura dissipador2
  myGLCD.printNumF(tempC, 2, 327, 42);     // Temperatura da agua
** change variable PHA to tempC in line 3**
comented this lines
Code: Select all
//  if (bitRead(status_parametros,2)==true) 
//  {                               
//    myGLCD.printNumF( tempC, 2, 302, 28);     // Temperatura em vermelho
//  }  
and changed PHA to tempC below
Code: Select all
  if (bitRead(status_parametros,3) == true) 
  {                               
    myGLCD.printNumF(tempC, 2, 327, 42);       // Temperatura em vermelho
  }    
---------------------------------------------------------------------------------------------------------
In tabs Leds
Code: Select all
//---------------------------LED levels---------------------------
Changed this
  if((tempH1 >= tempHR) || (tempH2 >= tempHR) )
  {
    reduzir = (1 - (potR *.01));
    temperatura_alta = true;
    temperatura_baixou = false;
  } 
  if(temperatura_alta == true)
  {
    if((tempH1 <= (tempHR - 5)) || (tempH2 <= (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 tab parametros
This changes:
Code: Select all
void checkTempC()
{ 
  contador_temp ++;
  sensors.requestTemperatures();                                          // Chamada para todos os sensores.
  temperatura_agua_temp += (sensors.getTempC(sensor_agua));               // Lê temperatura da água
  temperatura_dissipador1_temp += (sensors.getTempC(sensor_dissipador1));   // Lê temperatura do dissipador
  temperatura_dissipador2_temp += (sensors.getTempC(sensor_dissipador2));   // Lê temperatura do dissipador
  temperatura_ambiente_temp += (sensors.getTempC(sensor_ambiente));       // Lê temperatura do dissipador
  if(contador_temp == 12)
  {
    tempC = temperatura_agua_temp / 12;
    tempH1 = temperatura_dissipador1_temp / 12;
    tempH2 = temperatura_dissipador2_temp / 12;
    tempA = temperatura_ambiente_temp / 12;
    contador_temp = 0;
    temperatura_agua_temp = 0;
    temperatura_dissipador1_temp = 0;
    temperatura_dissipador2_temp = 0;
    temperatura_ambiente_temp = 0;
  }
 int tempval1 = int(tempH1 * 10);
  int tempval2 = int(tempH2 * 10);
  int fanSpeed1 = map(tempval1, (HtempMin * 10), (HtempMax * 10), 0, 255);       // Controle de velocidade das ventoinhas do dissipador
  int fanSpeed2 = map(tempval2, (HtempMin * 10), (HtempMax * 10), 0, 255);       // Controle de velocidade das ventoinhas do dissipador
  if ((fanSpeed1 < 0) || (fanSpeed2 < 0))
  {  
    fanSpeed1 = 0;
    fanSpeed2 = 0;
  }    
  if ((fanSpeed1 > 255) || (fanSpeed2 > 255))
  {
    fanSpeed1 = 255;
    fanSpeed2 = 255;
  }
  analogWrite(fanPin, fanSpeed1);
  analogWrite(fanPin, fanSpeed2);
  if((tempH1 < HtempMin) || (tempH2 < HtempMin)) // Desativa os coolers se a temperatura estive abaixo da mínima definida.
  {
    digitalWrite(desativarFanPin, LOW);
  }
  else
  {
    digitalWrite(desativarFanPin, HIGH);
  }
}
-------------------------------------------------------------------------------------
In tab processMyTouch
This changes:
Code: Select all
         contador_temp = 0;
          temperatura_agua_temp = 0;
          temperatura_dissipador1_temp = 0;
          temperatura_dissipador2_temp = 0;
          temperatura_ambiente_temp = 0;
          sensors.requestTemperatures();   // Chamada para todos os sensores.
          tempC = (sensors.getTempC(sensor_agua));  // Lê a temperatura da água
          tempH1 = (sensors.getTempC(sensor_dissipador1)); // Lê a temperatura do dissipador.
          tempH2 = (sensors.getTempC(sensor_dissipador2)); // Lê a temperatura do dissipador.
          tempA = (sensors.getTempC(sensor_ambiente)); // Lê a temperatura do ambiente.
Setup:
Code: Select all
  sensors.begin();     //Inicia as leituras das sondas de temperatura.
  sensors.setResolution(sensor_agua, 10); // Define a resolução em 10 bits.
  sensors.setResolution(sensor_dissipador1, 10); // Define a resolução em 10 bits.
  sensors.setResolution(sensor_dissipador2, 10); // Define a resolução em 10 bits.
  sensors.requestTemperatures();   // Chamada para todos os sensores.
  tempC = (sensors.getTempC(sensor_agua));  // Lê a temperatura da água
  tempH1 = (sensors.getTempC(sensor_dissipador1)); // Lê a temperatura do dissipador.
  tempH2 = (sensors.getTempC(sensor_dissipador2)); // Lê a temperatura do dissipador.
  tempA = (sensors.getTempC(sensor_ambiente)); // Lê a temperatura do ambiente.


 Portal
Portal Forum
Forum Login
Login Register
Register Search
Search Contact
Contact Images
Images Videos
Videos Web Control
Web Control

 
                            
                        


 
                            
                        
