LCD does not work unless Arduino is reset.

So I have an lcd display hooked up to my arduino (Pins 7-12) When I first boot up the arduino, the LCD displays the first line as blocks at about 50% contrast. Once I hit reset on the arduino, it works as expected. I have no idea what is wrong, any ideas?

I am replying partially because I eant this to appear on my updated posts list for easy track of this thread. I have seen several occasions of this problem lately and know no solutions yet.

could you post your code and pic of connection?

I seem to recall that many LCD display/controllers take a pretty long time to perform their powerup/reset function. Maybe try a simple easy experiment and use a delay(5000); as the very first statement in the void setup() function to make sure the lcd is really ready to accept commands.


at the beginning of void setup() worked like a charm. While it still displays the block for the first couple of seconds, once my text initializes, it works fine.

Alright. I'll let the other guy know too.

The LCD clock will be around 7Mhz, perhaps less, and needs half a dozen clocks to initialise. Asside from the power rail stabilizing at 5v (the arduino will probably run or spin up the oscillator from 3.3v already if you have a -V chip). Basically means waiting about 50ms will get you into the clear unless you have access to the actual shipset datasheet in which case you can bring the delay down. Alternative #2 is to use a R-C network of 100nf and a 10Kohm resistor to hold the LCD in reset for long enough. Option #3 is to tie your reset pin to the LCD, although not a bad plan, it will interfere with the downloader, hope these comments help.

A little more information. When this happened, I had a button wired up to the reset pin. To have this work, you have to have the reset pin tied to a HIGH rail

I am curious whether the LiquidCrystal routines I worked on (which have longer delays at startup than the one that is packaged with the standard Arduino package) will work for you without the 5 second delay.

If it does not work, it would be helpful to me to purchase an LCD exactly like the one you have to fix the code. Currently the most finnicky LCD I have is one I bought from the local Axman surplus store.

Anyway if you could try my code and see if it solves your problem without the 5 second delay I would appreciate it.

I bet I have the same display (20X4 no back light) from Axeman store. I ended up not using it at all. It requires delay after every lcd command. I don't think the display is up to spec. There are still a box full of these displays in their main store.

The axman display I have does work with the versions of LiquidCrystal I have. I actually have 2 of those LCDs and they both seemed to have identical timing characteristics. One thing I have puzzled over without success is if there is a way to explore exactly what is going on with them by comparing the time it takes to write characters when I wait for the busy flag vs what it takes as a timed delay between characters. There is a big difference in throughput with the two methods. Using the busy flag comes considerably closer to what my other displays do, but is still slower. It seems to me that there may be some specific situation that is slow on these displays and it would be interesting to figure out what it is. Anyway if laptopman has a display that is worse than the axman display I would like use one to make my code even more bulletproof.

One thing I did not mention in my previous post is that if you switch to my code and use the rw line, it will test the display's busy flag and that will likely be more reliable. You certainly won't need extra delays after each character. The busy flag cannot be used for the initialization sequence called either by LiquidCrystal lcd(rs,rw,en,...) or begin(), however. The initialization sequence requires timed delays.

If I remember correctly even the axman display works faster testing the busy flag than the standard LIquidCrystal routine (which never tests the busy flag) will work with a 'good' display. I might be misremembering that. If Don has any insight into how to understand just how I could structure test or what to look for to understand what situation in a sequence of characters sent to the LCD is the slowest thing I would be interested. Maybe there is something that could be done to the non busy flag testing version of my code.

still got the problem with mine, delay does not seem to help, I’ve even tried up too 10 seconds

Where can I buy one just like it? model number etc.

jrraines: Where can I buy one just like it? model number etc.

I know that's not aimed for me, and I'm sorry to hijack but Id be happy to send you one of the screens that I'm having the same problem with if you cover say half the postage with me?

well two of my screens are now on their way to mr Raines for testing.

I have also purchased 2 other screens and they act exactly the same :frowning:

they are…

Looking at the LiquidCrystal library source in Arduino-0022, I see that the LiquidCrystal constructor makes a call to begin(), which delays for 50ms and then sends commands to the LCD. So it is quite possible that the LCD is receiving commands before it is ready, if the supply voltage rises slowly at power up.

I suggest removing the begin() call from the LCD constructor. A call to begin() should be made in setup() anyway. If the LCD still doesn't work until the reset button is pressed, then Lefty's suggestion of inserting at delay in setup() before the begin() call should fix it.

strange. I start to suspect your code or other hardware but I know you checked thoroughly. I buy from chinaecomponents on ebay. Never a problem.

I still thihk the problem is that the device is not ready when the begin() command send commands to the device. I suggest trying the following, one at a time:

  1. Make sure you have a call to lcd.begin(...) in setup - assuming your LiquidCrystal variable is called "lcd".

  2. Add a delay in setup() before the begin(...) call as per retrolefty's suggestion.

  3. If that doesn't fix it, the problem may be that the lcd.begin() call in the LiquidCrystal constructor is happening too soon. Preferably, recompile the LiquidCrystal library with the begin() call at LiquidCrystal.cpp line 82 commented out. Alternatively, the following may work (it compiles but is otherwise untested):

  • Replace the declaration "LiquidCrystal lcd(...);" by the following:
void* operator new(unsigned int sz)
  return malloc(sz);

LiquidCrystal *pLcd;
  • Put the following in setup, before the lcd.begin(...) call:
  delay(1000);    // delay as per retrolefty's suggestion
  pLcd = new LiquidCrystal(...);   // insert correct pin numbers here
  • Replace every instance of "lcd." by "pLcd->"

hey there. I do have a call to begin in the set-up.

I have tried al sorts of delay times before the begin but does not seem to help

I not sure how I recompile the library?

I just tried the last suggestion, replacing some of the bits but could not get that too complie :frowning:

dtokez: I just tried the last suggestion, replacing some of the bits but could not get that too complie :(

What compile errors are you getting, and on what lines? If you post your sketch, I can try making the changes and see what problems there are compiling it.

Hi there, here is what I have currently

#include <LiquidCrystal.h>
void* operator new(unsigned int sz)
  return malloc(sz);

LiquidCrystal *pLcd;

//LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

int analoginput = 0;
int analoginput1 = 1;
int analoginput2 = 2;
float vin = 0.0;
float vin1 = 0.0;
float vin2 = 0.0;

void setup(){
  delay(1000);    // delay as per retrolefty's suggestion
  pLcd = new LiquidCrystal(7, 8, 9, 10, 11, 12);   // insert correct pin numbers here
 pLcd.begin(16, 2);

    pLcd.setCursor(0, 0);
   pLcd.print("REAPsystems V1.1");
       lcd.setCursor(0, 1);
   pLcd.print("iSensor tester");


void loop(){

 // read the value on analog input
pLcd.print ("Vin:");
vin = analogRead(analoginput)*5.00/1024*2;
pLcd.print(vin, 3);
pLcd.print ("v");
pLcd.print ("R:");
vin1 = analogRead(analoginput1)*5.00/1024;
pLcd.print(vin1, 2);
pLcd.print ("v");

pLcd.print ("O:");
vin2 = analogRead(analoginput2)*5.00/1024;
pLcd.print(vin2, 2);
pLcd.print ("v");