LCD Display with coorect pins not turning on/ will when it's inserted incorrect

Hi I'm just confused on a outcome in the project I'm currently doing. So I'm currently trying to connect my LCD Display to my arduino and I'm using a display tech 162B. So I've inserted all the pins correctly from my arduino to the LCD but it's not turning on at all even though I've been looking at data sheets and don't see a problem. What is really confusing me is If I was to change the ground pins (16 and 1) and the power pins (2 and 15) around the LCD turns on but I'm getting blocks in the display with no text that I've done with the arduino. Sorry I'm very new to this so not sure why that is or how?

To start with could you post a nice clear photograph of your wiring?

Double-check your wiring with the wiring in this Arduino - LCD tutorial . I fit still does not work, please post your wiring diagram and code. Do not forget to use the code tag

dannable:
To start with could you post a nice clear photograph of your wiring?

I have the pics on my desktop here but don't know how to increment them onto this, can someone show me please?

See
How to post images.

And post your test code. Read the how get the most out of this forum sticky to see how to properly post code. Remove useless white space and format the code with the IDE autoformat tool (crtl-t or Tools, Auto Format) before posting code.

#include<LiquidCrystal.h>  //Header file for LCD Module
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); //lcd connected pins
const int sensor = A0;    //Assigning analog A0 to variable sensor
float tempc;              //variable to store temp in °C
float tempf;              //variable to store temp in °F
float vout;               //variable to store values from sensor

void setup()
{
  pinMode(sensor,INPUT); // Configuring A0 as input
  lcd.begin(2,16);
  pinMode(A0,INPUT);     
  Serial.begin(9600);
}
void loop() 
{
  vout=analogRead(sensor);  
  vout=(vout*500)/1023;
  tempc=vout;             // Storing value in °C
  tempf=(vout*1.8)+32;    //conversion of °C to °F 
  lcd.setCursor(0,0);
  Serial.println(tempc);
}
 lcd.begin(2, 16);

Should be 16,2

If you want the LCD to show something, you need to print to the LCD. Do not use println(). The println() function is not supported by the LiquidCrystal library.

#include<LiquidCrystal.h>  //Header file for LCD Module
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); //lcd connected pins
const int sensor = A0;    //Assigning analog A0 to variable sensor
float tempc;              //variable to store temp in °C
float tempf;              //variable to store temp in °F
float vout;               //variable to store values from sensor

void setup()
{
   pinMode(sensor, INPUT); // Configuring A0 as input
   lcd.begin(16, 2);
   pinMode(A0, INPUT);
   Serial.begin(9600);
}
void loop()
{
   vout = analogRead(sensor);
   vout = (vout * 500) / 1023;
   tempc = vout;           // Storing value in °C
   tempf = (vout * 1.8) + 32; //conversion of °C to °F
   Serial.println(tempc);
   lcd.setCursor(0, 0);
   lcd.print("Temperature = ");
   lcd.setCursor(0, 1);
   Serial.println(tempc);
   lcd.print("          "); // overwrite old data with spaces
   lcd.setCursor(0, 1);
   lcd.print(tempc);
}

The above reads and displays the temperature much much faster than the temperature can change. Consider reading and displaying less often using a millis() timer (for non blocking code).
Non-blocking timing tutorials:
Several things at a time.
Beginner's guide to millis().
Blink without delay().

#include<LiquidCrystal.h>  //Header file for LCD Module
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); //lcd connected pins
const int sensor = A0;    //Assigning analog A0 to variable sensor
float tempc;              //variable to store temp in °C
float tempf;              //variable to store temp in °F
float vout;               //variable to store values from sensor

void setup()
{
   pinMode(sensor, INPUT); // Configuring A0 as input
   lcd.begin(16, 2);
   pinMode(A0, INPUT);
   Serial.begin(9600);
}
void loop()
{
   // read and display once per second
   static unsigned long timer = 0;
   unsigned long interval = 1000;
   if (millis() - timer >= interval)
   {
      timer = millis();
      vout = analogRead(sensor);
      vout = (vout * 500) / 1023;
      tempc = vout;           // Storing value in °C
      tempf = (vout * 1.8) + 32; //conversion of °C to °F
      Serial.println(tempc);
      lcd.setCursor(0, 0);
      lcd.print("Temperature = ");
      lcd.setCursor(0, 1);
      Serial.println(tempc);
      lcd.print("          "); // overwrite old data with spaces
      lcd.setCursor(0, 1);
      lcd.print(tempc);
   }
}

Hi guys, made some changes with the code and that and still don't have the LCD turned on, any suggestions that my wiring is wrong?

The code that I posted was tested, and worked as expected, with my Uno and 1602 display. Did you try the code that I posted without any changes? It should work.

Is pin 5 of the LCD (RW pin) grounded?

Your photos are too small for me to see any detail on your wiring. Can you post better photos?

Have you tried to adjust the contrast pot? What happens when you do?

If I was to change the ground pins (16 and 1) and the power pins (2 and 15) around the LCD turns on but I'm getting blocks in the display with no text

The blocks in the display say that it is powered right but not initialized.

Sorry I will try to upload bigger pictures now

Are you going to answer my questions? If not I will go away and stop wasting your time.

I will suggest that you disconnect everything except the display and get it to work before adding any more complexity.

What's going on with your power?
It looks like you have both a USB connection and an external power power input.
It also look likes Vin is connected to your power rail on the breadboard rather than 5v

--- bill

The other thing we can't see is the soldering on the LCD module.
Can you post a photo of the other side of the LCD module so we can see the soldering?

--- bill

bperrybap:
What's going on with your power?
It looks like you have both a USB connection and an external power power input.
It also look likes Vin is connected to your power rail on the breadboard rather than 5v

--- bill

bperrybap:
The other thing we can't see is the soldering on the LCD module.
Can you post a photo of the other side of the LCD module so we can see the soldering?

--- bill

I have taken it totally apart now, I have looked at loads of LCD datasheets and I feel I have the right connections except I have connections from pin 10 instead of pin 11 on some but I'm not sure they make a difference?

As you can, I have sent the photos now of it completely taking apart, I can't get it turned on and functioning at all :frowning:

open around me

BlueMoon20:
I have taken it totally apart now, I have looked at loads of LCD datasheets and I feel I have the right connections except I have connections from pin 10 instead of pin 11 on some but I'm not sure they make a difference?

I'd say your feelings are incorrect as this appears to be a wiring issue.

I asked about the power connections, but you have not answered yet.

What you do you mean by "except I have connections from pin 10 instead of pin 11 on some" ?
"on some"? how many devices are we talking about? I can only comment on what I see in the photos.
Here is some critical information that you need to understand about wiring up the LCD to the Arduino.
The constructor specifies the Arduino pin #s that are connected to various LCD pin functions.

LiquidCrystal lcd(12, 11, 5, 4, 3, 2); //lcd connected pins

My preference is to declare it like this so it is more obvious which Arduino pin# goes to which LCD pin.

// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

The hd44780 datasheet uses the terms DB0,DB1,DB2,DB3,DB4,DB5,DB6,DB7 whereas the code above uses d4,d5,d6,d7 to indicated DB4 to DB7
They are the same thing.

If you look at an LCD module data sheet or pinout diagram (not the hd44780 datasheet) you can see the LCD pin # for each of those LCD functions.
Besides the pins specified in the constructor, you must wire the LCD module R/W pin to gnd (LCD pin #5) and wire up a potentiometer.

In your photos, it looks like you have a wire going to LCD pin 10 which is LCD DB3
DB0, DB1, DB2, and DB3 are not used when using 4 bit mode.
In order to work you MUST control RS, EN, DB4, DB5, DB6, DB7 and ground R/W
Your constructor says that LCD DB4 (LCD pin 11) is wired up to Arduino pin #5 but it appears that you have wired Arduino pin #5 to LCD pin 10 which is DB3 which should not be connected to anything.
If DB4 (LCD pin 11) is not connected it will not work.

Also in the photos, it appears that Arduino pin #0 and pin #1 are wired to something out of photo.
What is that?

As you can, I have sent the photos now of it completely taking apart, I can't get it turned on and functioning at all :frowning:

Is it a joke? Obviously it won't work with no wires attached.


Here is my suggestion. Since you are using the same pin connections as the Arduino LiquidCrystal examples, just wire things up as specified in the HelloWorld example. Don't hook up anything else.
If your wiring is correct, it will work.
Then add your other circuitry and switch to your own sketch.

Also, just use the USB connector.
Connect your breadboard power rail to 5v not Vin (do not use Vin)
Don't use an external power supply with the barrel connector.

Using Vin instead of 5v when using an external power supply could damage the LCD.

Here is a pinout of your LCD

//  1 - LCD gnd
//  2 - VCC (5v)
//  3 - Vo Contrast Voltage
//  4 - RS Register Select (rs)
//  5 - Read/Write
//  6 - Enable (en)
//  7 - Data 0 (db0) ----
//  8 - Data 1 (db1)     |-------- Not used in 4 bit mode
//  9 - Data 2 (db2)     |
// 10 - Data 3 (db3) ----
// 11 - Data 4 (db4)
// 12 - Data 5 (db5)
// 13 - Data 6 (db6)
// 14 - Data 7 (db7)
// 15 - Backlight Anode (+5v)
// 16 - Backlight Cathode (Gnd)

--- bill

Your picture of the display from the back/pin side, shows no connection to pin 11, which is one of the data- and
thereby one of the control bits too. So make the connections as Bill sugests and drop connections to pin 7, 8, 9, 10.
Run the 'Hello world' example from the LiquidCrystal examples.
/ffur

First off. Learn how to make good soldered joints.

Then connect the correct pins to match the constructor.

There is still the issue of power and dual power supplies.
It looked like an external power supply was being used as well as a USB connection. Why?
It looked like Vin was connected to the bread board instead of 5v

I believe that Vin will be the external power supply voltage when both USB and external power are hooked up
which could be very bad for the LCD depending on the voltage.

--- bill