Having to upload many times 16x2 LCD

I started using an 16x2 LCD today.
But the problem is i sometimes i have to upload the code many times.
Why i have to do this is because i get wierd symbols in the display on some uploads.

For example, one time i might try to display "Hello"
and would get "QD4" or something like that.
So i upload a few more times and after some attempts it works.

Anyone know what it could be?

Im pretty sure i wired it correctly, and it is working "most of the time"

If i upload this code to my arduino:

#Include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void Setup() {
   delay(1000); // Added delay to make sure lcd is powered
   lcd.begin(16, 2);
   lcd.print("Hello World");
}
void Loop() {
}

Sometimes i will get "Hello World" on the screen.
Other times ill get strange signs.

And i dont even have to reupload for this to happen.
If i just press the "reset button" on the arduino.
It will flip between "Hello World" and "Strange Signs" (always the same strange signs)

Sometimes it might be "Hello World" a few times in a row when resetting.
And sometimes the signs.

Im stumped :confused:

This is the same types of signs i get at 3.10

Ok, now you have this connected to a relay, don't you? :astonished:

That was the critical detail. Common problem.

Connect a 47 or 100 µF capacitor between pins 1 and 2 of the LCD.

Not sure what a relay is :stuck_out_tongue:

Really i need a capacitor?
How come its not used here:

How come its not used here:

Because there is no inductive load such as a relay or a motor or a pump in that circuit.

The code in your original post most likely works all the time since there is no pump involved.

I didn't see any evidence of the words "Hello World" in your video which obviously uses different code as well as additional hardware -- something you neglected to mention.

Don

Oh i dont use a pump or anything like that.
I just used the video to show what symbols i got.

Was not my video, so its abit misleading.
Sorry.

Im just doing the Hello World text.

Let's start again. We need to see:

  • A photograph of your actual setup.
  • A copy/paste version of the code that you are actually using.
  • A photograph of the characters that are actually being displayed by the above mentioned hardware and software.

Don

A photograph of your actual setup.
A copy/paste version of the code that you are actually using.
A photograph of the characters that are actually being displayed by the above mentioned hardware and software.

Ok here we go, this is the schema im using:

This is the setup:


These two pictures are using the exact same code!
The only diffrence is i pressed reset.
So the reset or reupload will toggle between these states.

Oh and here is the code:

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  lcd.begin(16, 2);
  lcd.print("Hello World!");
}

Hmmm.

This is the classic "nibble shift" fault.

Suggest you re-solder the "E" connection on the LCD - and check the continuity of that wire to the Arduino.

The 'nibble shift' problem is likely due to a somewhat out of spec LCD controller and will probably not be fixed by tinkering with the wiring (other than by adding four more wires and using an 8-bit interface).

Your display will probably work if you use a library that is designed to deal with these low quality displays. One such library was actually written for 40x4 displays but will work with your 16x2.

To get a copy start here:--> Google Code Archive - Long-term storage for Google Code Project Hosting. and follow the Downloads link to get to the latest version.

Don

I have tried using liquidcrystal440 but i cant fix the code.
First it gave me error of a return type not being the same as the overriden version.
I managed to fix that error.
But then i got errors that WProgram.h could not be found.

BTW, clear the LCD screen after lcd.begin

.

LarryD:
BTW, clear the LCD screen after lcd.begin

.

I tried that..

LarryD:
BTW, clear the LCD screen after lcd.begin

.

Why?

Don

Gobaz:
I have tried using liquidcrystal440 but i cant fix the code.
First it gave me error of a return type not being the same as the overriden version.
I managed to fix that error.
But then i got errors that WProgram.h could not be found.

I don't think that you followed the downloads link to get to the latest version since the updated program is NOT called 'liquidcrystal440'.

Don

floresta:
I don't think that you followed the downloads link to get to the latest version since the updated program is NOT called 'liquidcrystal440'.

Don

Ahh ok thanks.
I downloaded the latest version now.
And i tested it, there was no change, same behavior.

Have you tried the 8-bit mode? Note: You will have to use the original library to do this since the liquidcrystal440 library and it's successor do not support the 8-bit mode.

Don