problem with LCD 2X16 (strange characters appears )

Hi everyone, I have a problem in my project,it's about the LCD which displays a strange characters after a few minuets from starting the program. here is an image for the problem http://img827.imageshack.us/img827/5024/92jd.jpg

the normal behavior is like this http://img69.imageshack.us/img69/7200/jxty.jpg

can you help me with this ?

can you help me with this ?

That will be pretty hard to do without seeing your code.

Since you initially get a legible display we can assume that the LCD is connected properly. This points to some kind of software problem which is hard to diagnose sight unseen.

Don

I've had such issues when the contacts between the Arduino and the LCD were not good. Check your wiring to make sure all of the contacts are good and not loose. Knowing your code and your schematic would also help diagnose the issue, as it can be caused by interference as well.

Hi floresta, this is a part of the code that is related to the the LCD.The program is running perfectly for a few minuets and after the relays (controlling heater and lamp) on/off several times it beging to be as in the picture and never back to the normal state until I reset the Arduino.Is that enough or you need the whole code ?

void loop()
{
  int check,humidity,temperature; 
  if(sel==1) setpoint();        //selecting temperature and humidity setpoints (refrences)

  check=sensor.read(sensor_pin);
  switch(check)
       {
        case   0:
                 {
                  lcd.clear();
                  temperature=sensor.temperature;
                  humidity   =sensor.humidity;
                  lcd.setCursor(0,0);
                  lcd.print("temp");
                  lcd.setCursor(0,1);
                  lcd.print(temperature);
                  lcd.print("c");
                  lcd.setCursor(8,0);
                  lcd.print("humidity");
                  lcd.setCursor(8,1);
                  lcd.print(humidity);
                  lcd.print("%");
                  
                  control(temperature,humidity);    //this function is to control temperature and humidity.
                 }
                 break;
        case  -1:{lcd.clear();  lcd.print("Checksum Error");break;}
        case  -2:{lcd.clear();  lcd.print("Time out Error");break;}
        default :{lcd.clear();  lcd.print("Unknown Error");break; }
       }
       delay(1000);
}

TheCoolest,I've checked the connection between the LCD and the Arduino several times and every thing is good.The code is in the previous comment and I'll draw the schematic and show it to you but till that can you tell me if there is any other reasons that may be causing this problem.

The moment you mentioned 'relays' your problem is obvious, it's interference. Do a search on the forum for these keywords together: lcd relay interference. Go over the threads, I'm sure you will find some solutions to your problem.

I found some solution from the search.I tried some of them and didn't work and going to try the others after buying the appropriate components. If it is solved I'll tell you.thanks TheCoolest :)

Hi TheCoolest, I've tried these schematics and the both of them works perfectly and solved my problem . http://img43.imageshack.us/img43/2933/tja.gif

http://img62.imageshack.us/img62/6946/6ou.gif

If any one have any problem like this please lead him to these schematics.

Again,thanks for your help.

Just as a matter of interest, were you using a "snubber" or "catch diode" across the relay coil.

I had the same problem, and just disconnected my MOSFET and the problem gone. Now I am going to try the schematics above.
Thanks :wink:

More to the point, what was your MOSFET doing?

If you are in fact using a relay, is the "snubber" diode fitted across the coil?