Arduino freeze!

Hi, this a refrigeration control using an arduino mega, and lcd , and 8relay board and a power source.

Outside

interior

Interior

We use the arduino to control a refrigeration chiller… so, the temperature range is between 3 and 5C… the problem is the arduino freeze on some point during the refrigeration cycle making the temperature drops even as low as -9C…

I installl the control and was working fine until past yesterday, wen the chiller star to frezee…
I have some problems earlier with the contacts opening and generating an spark and frezing the arduino, but after install some snubbers everything works fine, until know…

I add a reset each 5 refrigeration cycles, using something like this;
http://weblog.jos.ph/development/arduino-reset-hack/
I know isnt the best solution, but I was consider the sotware doing domething wrong… But even after this, The program frezees at a random point. So …

I enable the relay configuration for opto/coupled like is described here
https://arduino-info.wikispaces.com/RelayIsolation

Know I have leave the system for a test run today and tomorrow… Searching there it was some troubles with IC2 screens and the add a transistor to activate the relay, unfortunately there is no diagram,there was a mention to a small transistor and a small capacitor. I dont know if its necesary, or only the optocuplers o the relay board will do the trick.

Know for a more robust control Im thinking on add a arduino promini and a separate temperature probe to some sort of “hardware reset”… if the pro-mini sees the temperature going low or high than
the pre-programed, will set the reset the pin of the control board, this will have the advantage of
have an added safety, never the least i leave my current code in here, to see if there is anything I may doing wrong.

Is there a more robust way to enable the relays, to avoid the HV peaks freexing the arduino?
In

//=====================================LIBRERIAS==================================================//
#include <Wire.h>
#include <OneWire.h>
#include <dht.h>                     //Libreria para DTH
#include <DallasTemperature.h>       //Libreria Ds1820
#include <LiquidCrystal_I2C.h>       //Libreria IC2 


//#define WDT0_8S 8

//=====================================COSNTRUCTORES =============================================//

LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

#define ONE_WIRE_BUS 2               //Pin Sensor temperatura
OneWire oneWire(ONE_WIRE_BUS);       //define un bus para comunicarse con cualquier sensor 
DallasTemperature sensors(&oneWire); // Pass our oneWire reference to Dallas Temperature. 
DeviceAddress insideThermometer;     // arrays to hold device address



//=====================================VARIABLES GLOBALES=========================================//
const byte resetPin = 12;
const byte solenoid = 4; 
const byte compressor = 5; 
const byte dif1 = 6; 
const byte dif2 = 7; 

const byte ledSol = 8; 
const byte ledcomp = 9; 
const byte ledDif1 = 10; 
const byte ledDif2 = 11; 

float tempC =   0;             //lectura del termometro 
float newTemp = 1;             //lectura para revisar si hay cambio y reimprimir la temperatura 

byte resetVar = 0;

unsigned long compDelay = 5000; 
unsigned long compTime  = 0; 
unsigned long compPastTime = 0; 
boolean wasOn = true; 

//variables to startCompressor soubrotine------------------
byte ofcomp = 0;                  //  rool over from 0 to 4 
boolean compressorBegin = true; 
unsigned long compSMtime = 0; 
unsigned long compSMdelay = 1500;

//variables de pantalla de bienvenida ---------------------
unsigned long bienvenidaT  = 0; 
unsigned long bienvenidaDelay = 3000;
unsigned long bienvenidaStart = 0;
byte bienvenidaVar= 0;
byte pasBievenida = 0;

boolean prueba = false;

//variables to OffCompressor soubrotine------------------
byte offSystem = 0; 
boolean compressorStop = true;
unsigned long compOfftime = 0; 
unsigned long compOffdelay = 00;
unsigned long OFFScreenTime =2000;
byte OFFcomp = 0; 
byte pastOFFcomp = 0; 

byte var = 1;
//=====================================VOID SET UP ==================================================//
void setup(void)
{
 digitalWrite(resetPin, HIGH); 
 delay(250);
  
 Serial.begin(9600);
 lcd.begin(20,4);

pinMode(resetPin, OUTPUT);

pinMode(solenoid, INPUT_PULLUP);
pinMode(compressor, INPUT_PULLUP);
pinMode(dif1, INPUT_PULLUP);
pinMode(dif2, INPUT_PULLUP);

pinMode(ledSol,  INPUT_PULLUP); 
pinMode(ledcomp , INPUT_PULLUP); 
pinMode(ledDif1 , INPUT_PULLUP); 
pinMode(ledDif2 , INPUT_PULLUP); 

pinMode(ledSol,OUTPUT); 
pinMode(ledcomp,OUTPUT); 
pinMode(ledDif1,OUTPUT); 
pinMode(ledDif2,OUTPUT); 

pinMode(solenoid, OUTPUT);
pinMode(compressor, OUTPUT);
pinMode(dif1, OUTPUT);
pinMode(dif2, OUTPUT);

digitalWrite(solenoid, HIGH); 
digitalWrite(compressor, HIGH); 
digitalWrite(dif1, HIGH); 
digitalWrite(dif2, HIGH); 

digitalWrite(ledSol, HIGH); 
digitalWrite(ledcomp, HIGH); 
digitalWrite(ledDif1, HIGH); 
digitalWrite(ledDif2, HIGH); 

  //-----------------------------------SENSOR DS1820-------------------------------------------------//
  // locate devices on the bus
  sensors.begin();
  Serial.print(sensors.getDeviceCount(), DEC);
  //Linea para debug 
  if (!sensors.getAddress(insideThermometer, 0)) Serial.println("Unable to find address for Device 0"); 
  Serial.print("Device 0 Address: ");
  //Funcion para imprimir la direccion del dispositivo  --printAddress(insideThermometer);
  // set the resolution to 9 bit (Each Dallas/Maxim device is capable of several different resolutions)
  sensors.setResolution(insideThermometer, 10); 
 
  bienvenida(); 

//wdt_enable(WDT0_8S);
}

void loop (){
 
  if(resetVar >= 5) DoReset();        //this will reset the micro each x times 
  
  Serial.print("The program has run "); Serial.print(resetVar); Serial.println(" Times"); 
  if(tempC <= 3.5) turnOffCompressor();
  Serial.println("Safe is on"); 

  sensors.requestTemperatures(); // Comando para obtener temperatura
  printTemperature(insideThermometer); // print the data on var tempC 
        
        if(tempC != newTemp )  //just print the temperature if has changue 
        {
          tempScreen();
          Serial.print("nueva temperatura  ");  
          newTemp = tempC; 
        }
      
//      if(tempC >= 6.5 && tempC >= 7.00) 
        if(tempC >= 4.5 && tempC >= 5.00) 
        {
         turnOnCompressor();  
        }
  
//      if(tempC <= 3.00 && tempC <= 3.5)      
        if(tempC <= 3.50 && tempC <= 4.50)
        {
        turnOffCompressor();  
        }
        
        
        
        compTime = millis(); //keep ticking the clokc 

}


//-------------- function to print the temperature for a device
void printTemperature(DeviceAddress deviceAddress)
{
  tempC = sensors.getTempC(deviceAddress);
}

void tempScreen()
{
  lcd.clear(); 
  lcd.setCursor(0,0); lcd.print("      CAMARA 5"); 
  lcd.setCursor(0,1); lcd.print("    Temperatura"); 
  lcd.setCursor(7,2); lcd.print(tempC); 
  
  Serial.print("Temp C: ");  Serial.print(tempC);   Serial.println("   ");  
}




          
void DoReset(){
 digitalWrite(resetPin, LOW);  
 
  
}

Thanks ins advance.
-Alex.

PD… there is a lot of unsigned long variables to handle the screen changes and in the last time they were eliminated for some simple.

And the mains sub fuctions;

void turnOnCompressor()

/*
This soubroutine is intended to stop the refrigeration cycle in to steps
avoiding the high voltage peaks on the line 

the compressor has its own off time to pump down the liquid line and avoid 
liquid on the compressor carter. 

*/
{

if(wasOn == false){
{
      Serial.print(F("Caso 1---------------"));
      lcd.clear(); 
      lcd.setCursor(0,0);  lcd.print("                    ");
      lcd.setCursor(0,1);  lcd.print("      INICIANDO     ");
      lcd.setCursor(0,2);  lcd.print("    REFRIGERACION   ");
      lcd.setCursor(0,3);  lcd.print("                    ");
      delay(2000);
      
      Serial.print(F("Caso 2---------------"));
      lcd.setCursor(0,0);  lcd.print("      INICIANDO      ");
      lcd.setCursor(0,1);  lcd.print("    REFRIGERACION    ");
      lcd.setCursor(0,2);  lcd.print("                     ");
      lcd.setCursor(0,3);  lcd.print("                     ");
      delay(2000);
      //wdt_reset();
      
      Serial.print(F("Caso 3---------------"));
    
      lcd.setCursor(0,2);  lcd.print("     ENCENDIENDO      ");
      lcd.setCursor(0,3);  lcd.print("      SOLENOIDE      ");
      digitalWrite(solenoid, LOW);
      digitalWrite(ledSol, LOW);
      delay(2000);
      
      lcd.setCursor(0,2);  lcd.print("     ENCENDIDENDO     ");
      lcd.setCursor(0,3);  lcd.print("      COMPRESOR      ");
      digitalWrite(compressor, LOW);
      digitalWrite(ledcomp, LOW);
      delay(2000);
      
      Serial.print(F("Caso 4---------------"));
      lcd.setCursor(0,2);  lcd.print("     ENCENDIENDO      ");
      lcd.setCursor(0,3);  lcd.print("     DIFUSOR 1        ");
      digitalWrite(dif1, LOW); 
      digitalWrite(ledDif1, LOW);
      delay(2000);

      
      Serial.print(F("Caso 5---------------"));
      lcd.setCursor(0,2);  lcd.print("                     ");
      lcd.setCursor(0,3);  lcd.print("                     ");
      
      lcd.setCursor(0,2);  lcd.print("     ENCENDIENDO     ");
      lcd.setCursor(0,3);  lcd.print("     DIFUSOR 2       ");
      digitalWrite(dif2, LOW); 
      digitalWrite(ledDif2, LOW); 
      
      delay(2000);
    
}
wasOn = true;
}   
}
void bienvenida(){

          Serial.println(F("bienvenida Caso 1--------------------------------"));
          lcd.clear();
          lcd.setCursor(0, 0);  lcd.print("   INSTALADO  POR   ");
          lcd.setCursor(0, 1);  lcd.print("                    ");
          lcd.setCursor(0, 2);  lcd.print("       SANHER       ");
          lcd.setCursor(0, 3);  lcd.print("     INGENIEROS     ");
          delay(2000);

          Serial.println(F("bienvenida Caso 2--------------------------------"));
          lcd.clear();
          lcd.setCursor(0, 0);  lcd.print("      CAMARA 5       ");
          lcd.setCursor(0, 1);  lcd.print(" PARA  CONSERVACION  ");
          lcd.setCursor(0, 2);  lcd.print("    DE PRODUCTO      ");
          lcd.setCursor(0, 3);  lcd.print("     TERMINADO       ");
          delay(2000);
          
          Serial.println(F("bienvenida Caso 3-------------------------------"));
          lcd.clear();
          lcd.setCursor(0, 0);  lcd.print(" FUNCIONANDO  DESDE  ");
          lcd.setCursor(0, 1);  lcd.print("                     ");
          lcd.setCursor(0, 2);  lcd.print("     30/09/2015      ");
          lcd.setCursor(0, 3);  lcd.print("                     ");
          delay(3000);  
}
void turnOffCompressor()
/*
This soubroutine is intended to stop the refrigeration cycle in to steps
avoiding the high voltage peaks on the line 

the compressor has its own off time to pump down the liquid line and avoid 
liquid on the compressor carter. 

*/
{

if(wasOn == true){
{
      Serial.print(F("Caso 1---------------"));
      lcd.clear(); 
      lcd.setCursor(0,0);  lcd.print("                    ");
      lcd.setCursor(0,1);  lcd.print("      TERMINANDO    ");
      lcd.setCursor(0,2);  lcd.print("    REFRIGERACION   ");
      lcd.setCursor(0,3);  lcd.print("                    ");
      delay(2000);
      
      Serial.print(F("Caso 2---------------"));
      lcd.setCursor(0,0);  lcd.print("      TERMINANDO     ");
      lcd.setCursor(0,1);  lcd.print("    REFRIGERACION    ");
      lcd.setCursor(0,2);  lcd.print("                     ");
      lcd.setCursor(0,3);  lcd.print("                     ");
      delay(2000);
      //wdt_reset();
      
      Serial.print(F("Caso 3---------------"));
    
      lcd.setCursor(0,2);  lcd.print("       APAGANDO      ");
      lcd.setCursor(0,3);  lcd.print("      SOLENOIDE      ");
      digitalWrite(solenoid, HIGH);
      digitalWrite(ledSol, HIGH);
      delay(2000);
      
      lcd.setCursor(0,2);  lcd.print("       APAGANDO      ");
      lcd.setCursor(0,3);  lcd.print("      COMPRESOR      ");
      digitalWrite(compressor, HIGH);
      digitalWrite(ledcomp, HIGH);
      delay(2000);
      
      Serial.print(F("Caso 4---------------"));
      lcd.setCursor(0,2);  lcd.print("       APAGANDO      ");
      lcd.setCursor(0,3);  lcd.print("     DIFUSOR     1   ");
      digitalWrite(dif1, HIGH); 
      digitalWrite(ledDif1, HIGH);
      delay(2000);

      
      Serial.print(F("Caso 5---------------"));
      lcd.setCursor(0,2);  lcd.print("                     ");
      lcd.setCursor(0,3);  lcd.print("                     ");
      
      lcd.setCursor(0,2);  lcd.print("       ENCENIDO      ");
      lcd.setCursor(0,3);  lcd.print("     DIFUSOR     2   ");
      digitalWrite(dif2, LOW); 
      digitalWrite(ledDif2, LOW); 
      delay(2000);
    
}
wasOn = false;
resetVar++; //ads one to the rest variable each time the program reach here. 
}   
}

Thanks !

-Alex.

You have a lot of printing going on. You may have an issue with using up too much RAM. Look at the F macro to get those constant strings out of RAM and see if that helps.

Like this:

lcd.print(F("this string doesn't waste RAM"));

Ok, I willl do so so... thanks!

Anything on the idea of aother arduino to reset the main?

AlexLPD:
Anything on the idea of aother arduino to reset the main?

Why kludge it when you can fix it?

I2C can cause a freeze if anything holds SDA low. The Arduino will wait forever for it to go high to complete the I2C transaction. So long as you only have well- behaved devices this won't be a problem.

MorganS:
I2C can cause a freeze if anything holds SDA low. The Arduino will wait forever for it to go high to complete the I2C transaction. So long as you only have well- behaved devices this won't be a problem.

Well thaths something I didnt know... At first insteas of freezing programa we have an LCD screen with random symbols at random time... I was recomended to put a 47uf cap betwwen 1 and 2 LCD pins, as well a post of Nick gammon strongly advice to put 2 resistors of 2k2 between the VCC the sda and scl pins on the screen... I did this also, ans the screen dont longger erase itself ...

Is there anythink el se i can do to make sure this is no the real problem?

A funny thing I Remember the temperatura reading works even wen the program is stuck on the rwfrigeration status....

Meaning the loop isnt the problem if the loop was the problem... It will dont read rhe correct tenperature....

How this is posible??? Do i need to add a transistor gate to the relays as well to added safety feature?

Any idea of the components?
Why they mention transistor and a capacitor instead of resistor...???

Thanks un advance!
-Alex.

Ok, so I make the modifcation to save in flash a lot of text, and the program size goes from 15% without the Flash, to 7% saving the text on the flash memory...

In a couple of hours I will know if the optical isolation was the problem with this program, still upload the new one.

Thanks.
-Alex.

well I just came from the refrigeration room.

2 Odd things… the temperature in did goes below 0C… in this time it went to -10.5C.

And the program at our arrive it was operating normally… Whath I mean is in other times, the program stops at refrigeration, and leave the compressor, the both evaporators on… and today It wasnt the case…

For some reason the program operates normally… but in some point (2 points actually) the program keep the compressor running … I have this theory…

During the night… the temperature drops not at a normal rate (0.25C) but a much more faster rate … a datalogger shows even 2.0C on temperature drops… So… if the temperature drops at much faster rate… It may be possible to “skip” the thermostat functions;

if(tempC <= 3.50 && tempC <= 4.50)

I mean… if the temperature goes below 3.5 lets call it 3.25C … so the parameter don´t accomplish the parameters…

So… I add a sub-funtions;

if(tempC <= 3.5 && tempC <=1.0 ) turnOffEvap();

void turnOffEvap()
/*
This soubroutine is intended to stop the refrigeration cycle in to steps
avoiding the high voltage peaks on the line 

the compressor has its own off time to pump down the liquid line and avoid 
liquid on the compressor carter. 

*/
{

if(wasOn == true){
{
      Serial.print(F("Caso 1---------------"));
      lcd.clear(); 
      lcd.setCursor(0,0);  lcd.print(F("                    "));
      lcd.setCursor(0,1);  lcd.print(F("      TERMINANDO    "));
      lcd.setCursor(0,2);  lcd.print(F("    REFRIGERACION   "));
      lcd.setCursor(0,3);  lcd.print(F("                    "));
      delay(2000);
      
      Serial.print(F("Caso 2---------------"));
      lcd.setCursor(0,0);  lcd.print(F("      TERMINANDO     "));
      lcd.setCursor(0,1);  lcd.print(F("    REFRIGERACION    "));
      lcd.setCursor(0,2);  lcd.print(F("                     "));
      lcd.setCursor(0,3);  lcd.print(F("                     "));
      delay(2000);
 
      Serial.print(F("Caso 3---------------"));
      lcd.setCursor(0,2);  lcd.print(F("       APAGANDO      "));
      lcd.setCursor(0,3);  lcd.print(F("      SOLENOIDE      "));
      digitalWrite(solenoid, HIGH);
      digitalWrite(ledSol, HIGH);
      delay(2000);
      
      lcd.setCursor(0,2);  lcd.print(F("       APAGANDO      "));
      lcd.setCursor(0,3);  lcd.print(F("      COMPRESOR      "));
      digitalWrite(compressor, HIGH);
      digitalWrite(ledcomp, HIGH);
      delay(2000);
      
      Serial.print(F("Caso 4---------------"));
      lcd.setCursor(0,2);  lcd.print(F("       APAGANDO      "));
      lcd.setCursor(0,3);  lcd.print(F("     DIFUSOR     1   "));
      digitalWrite(dif1, HIGH); 
      digitalWrite(ledDif1, HIGH);
      delay(2000);

      Serial.print(F("Caso 5---------------"));
      lcd.setCursor(0,2);  lcd.print(F("                     "));
      lcd.setCursor(0,3);  lcd.print(F("                     "));
      
      lcd.setCursor(0,2);  lcd.print(F("       APAGANDO      "));
      lcd.setCursor(0,3);  lcd.print(F("     DIFUSOR     2   "));
      digitalWrite(dif2, HIGH); 
      digitalWrite(ledDif2, HIGH); 
      delay(2000);
    
}
wasOn = false;
resetVar++; //ads one to the rest variable each time the program reach here. 
}   
}

The idea is even for some reason, the temperature goes more than 1.0 … the compressor will stop as well both evaporators, to avoid the refrigerant or the over circulated air, will produce lower temperatures…

The customer is a laboratory and they want a very stable temperature to save vaccines.

So, any toughs on this?

-Alex.

So, I usually dont get so desperate... but this is very URGENT!!!!

I have again 3 or 4 point in with the program simply stops and keep freezen... I dont know whath else to modiy...

here is the results of the datalogger;

As you can see, the firs 30 or so start and stop are quite well...but after that everything goes bad...

I need help! i dont have any idea whath migth be happening !!!!

Thanks in advance.

-Alex.

Trace the execution of the program by adding Serial.print statements that show the value of the variables and what code is being executed.

Breadboards are unreliable, why are you using one?

You have high current cables running close to a completely unshielded Arduino and signal cables. Is this the finished product or a prototype?

How is the the temperature sensor protected from moisture?

Provide a complete circuit diagram.

What electronic components do you have inside the freezer. Just the sensor, or any relays, and/or other components?

What temp. sensor are you using, and how do you have it connected to the arduino?

What voltage readings do you see, when it is over cooling? on the input, and on the output pins of the arduino?

If you have the "blink led" program running, you can tell if the arduino freezes or not.

  if(tempC <= 3.50 && tempC <= 4.50)

I don’t know if it has anything to do with your problem but something is definitely wrong with the logic.

If the temp is below 3.5, how can it not be below 4.5? So what’s the point of the second comparison?

if(wasOn == true){
{
      Serial.print(F("Caso 1---------------"));
      lcd.clear();

That is an unusual structure. I am not sure if it is an error, or just STRANGE code.

mikb55:
Trace the execution of the program by adding Serial.print statements that show the value of the variables and what code is being executed.

Breadboards are unreliable, why are you using one?
-No is not a bread board is a welded bard to the vcc filter for the electronics.

You have high current cables running close to a completely unshielded Arduino and signal cables. Is this the finished product or a prototype?

This is the first of a line, we will modify many thinks of course, but for know it must works... the power cables are only for contactors coils, so the high voltage are far from the control board, each relay has a snubber and yes they work.

How is the the temperature sensor protected from moisture?
Im using a DS1820 waterproof sensor.

Provide a complete circuit diagram.

In deed, this take me a litte bit

Im using serial statements, but the thing works properly for over a month and just when the validation team show ups... start to doing very weird things..

Thanks in advance... I will add more information at the bottom.
-Alex

Hi!
im using a DS1820 temperature probe... is waterproof and is about 3m from gorund in the interior of the coldroom.

At first, the problem was... the program freezes... I can see the compressor and evaporator ligths on... all the time... (each is controled by a relay) this happens due the start of all the components at the same time, we didnt have the snubbers, so we add them and re-write the code, in steps to the components be able to start a different rate... and works very well in this way for over a month.

I dont have a Osciloscope know, so I can determinate the voltage of the pins, but this make me think quite a while... I read a recomendation in witch the unused pins must be put at a HIGH state to avoid noise in the program. is ths correct?

I dont think the program itself stops, the reason is because the temperature reading is show properly on the screen... I mean -7C -7.5 etc... if the loop was corrupted there will be no changue in the temperature.

if the loop was corrupted, the program will show something like 5.5C (the high threshold value) and since is stop... the refrigeration will be on... But this dont happen. !!!

Kind regards.
-Alex

Delta_G:

  if(tempC <= 3.50 && tempC <= 4.50)

I don’t know if it has anything to do with your problem but something is definitely wrong with the logic.

If the temp is below 3.5, how can it not be below 4.5? So what’s the point of the second comparison?

Yes this seems odd and redundant but the thing is very rare…
At the begging of the assembly I just set something like;

If(tempC < 3.5) doSomethingh();

But the think is sometimes dont operate properly… I search on the forums and a while response appears;

I dont have the link, but the main idea is the way the float numbers are used on the arduino, arent so accurate as an int… so they recomend this type of if statment…

The first time This happens, I think there it was a problem with the statement…

know Im thinking… it will be like…

  if(tempC <= 4.50 && tempC >= 3.50  )

If the temperature is minor than… and greater than??

i will upload this tomorrow, but even so… why this is operating normally for over 12Hrs today??
Estrange things !!!

-Alex.

:slight_smile: :slight_smile:
Just extrange code...

The idea is the LCD only clears and changue once the previous screen has ended...
With out this.. the loop constantly clears and blink the text on the lcd..

-Thanks.
-Alex.

Well gentlemen, today has been a odd day, We make some modification to the control board...

In order to avoid the freezing, we add a self reset pin, thath enables the reset pin of the arduino mega each 5 complete refrigeration cylces...

A couple of comments at this...
1.- The ds1820 has a +85C temp at begining Page 4
2.- the self reset may be wasn't enough to clear all the program
3.- And most important... today while I have the primary arduino hook up to the usb port to read temperatures, I turn off the circuit... (at turn off the AC main is disconect and there is onlye vdd for one or two seconds on the capacitor filter... well I dont know exactly how.. but even with the relay on opto-isolator mode the relays keep the old state!!!!!!! they keep on, using some vcc that was returning from the usb to the barril of the arduino, to the capacitor bank, to the relay board! (I know they are on because they have the litte red leds on!)
it will be advisible to put a diode on each vcc output?

The transformer and the lm areacctually a Buck converter, then enters to the capacitor bank, and from there is divided in to 3 screw terminals. One powers the arduinos, another the temperature probe and the other the relay board.

4.- So it migth be possible in some point that the relays keep the old state and the loop keep running...
5.- The ds1820 probe is happier with a 0.1uf capacitor decoupling between VCC and ground.

Is there a way to reference to VCC the digital pins of the relay boards? ... If I make an adaptor a common VCC rail a small capacitor and the in from the digital input, and the output to the realy board? to guarantee in case of the digital pin signal from the arduino the relay will be off and dont be allowed to have a ghost state?

Well.. here are my observations, thanks
-Alex.