Go Down

Topic: LCD 16x2 showing weird characters, but working (Read 178 times) previous topic - next topic

thetravhi

Hi, Everyone.  First of all, thank you for any help you can offer.  I am stuck and unable to help my students with this problem.  I am new to Arduino and the programming.  I am trying to get the basic display sign showing and it only shows weird characters, they seem to be in the correct place for "hello, world!" but that is not what is it showing.

Here is my code and a picture:

#include <LiquidCrystal.h>

/*
  LiquidCrystal Library - Hello World

 Demonstrates the use a 16x2 LCD display.  The LiquidCrystal
 library works with all LCD displays that are compatible with the
 Hitachi HD44780 driver. There are many of them out there, and you
 can usually tell them by the 16-pin interface.

 This sketch prints "Hello World!" to the LCD
 and shows the time.

  The circuit:
 * LCD RS pin to digital pin 12
 * LCD Enable pin to digital pin 11
 * LCD D4 pin to digital pin 5
 * LCD D5 pin to digital pin 4
 * LCD D6 pin to digital pin 3
 * LCD D7 pin to digital pin 2
 * LCD R/W pin to ground
 * LCD VSS pin to ground
 * LCD VCC pin to 5V
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)

 Library originally added 18 Apr 2008
 by David A. Mellis
 library modified 5 Jul 2009
 by Limor Fried (http://www.ladyada.net)
 example added 9 Jul 2009
 by Tom Igoe
 modified 22 Nov 2010
 by Tom Igoe

 This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/LiquidCrystal
 */

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis() / 1000);
}


Thank you for any help you can offer.  The contrast adjustment is working fine and the counter seems to be working even though it isn't giving the correct numbers.

-Mike :-)

david_prentice

You have shorted D6, D7 pins on the LCD.    Just look at your photo.

It is a miracle that the LCD initialised in the first place.

David.

JoeySC

I've never really tried to use the lcd 16x4 that way. You should try using it with I2C. It's cake work and only uses 4 wires. Tx,Rx,positive,negative. The programming is so easy with the i2c library commands.
Most of the displays come with the i2c module but you can get one for 99 cents and it solders to the back of the display.
Sorry, I know that's probably not what you were looking for but from experience with lcd16x2 or 20x4 it's the way to go.......especially if remote mounting the display

Best of luck

bperrybap

You should try using it with I2C.
Switching to using an I2c backpack is not going to fix the soldering issue on the lcd module.

--- bill

floresta

Quote
The programming is so easy with the i2c library commands.
Can you point out which I2C library commands differ from the commands in the regular LCD library (other than the constructor)?  I suppose you might be thinking about the backlight but that really has nothing to do with the LCD.

Don

INTP

In case it wasn't clearly mentioned yet since people decided to go off topic right quick, I made an infographic for you.


JoeySC

Yep, INTP is correct.....Bad soldering will cause untold types of issues, u can't short the data pins.
Sorry for going off topic. Just wanted to let em know there is a much simpler way to work with the 16x2 LCD.....and it's far less prone to wiring troubles. Though you would still need to solder the I2C module correctly on those same exact pins.
   Rookie forum mistake, point taken.

bperrybap

Yep, INTP is correct.....Bad soldering will cause untold types of issues, u can't short the data pins.
Sorry for going off topic. Just wanted to let em know there is a much simpler way to work with the 16x2 LCD.....and it's far less prone to wiring troubles.
While using an i2c backpack is less prone to wiring issues, it is not really less prone to issues.
Most of the libraries are hard coded for a particular mapping and if the mapping doesn't match the backpack h/w then it won't work.
Add to this issue is that there are several libraries out there with the same name.
Also, there is the issue getting the i2c address correct. Many users stumble on this.
Then there is the issue of pullup resistors. Some backpacks have them some don't.
The mega 2560 boards have i2c pullups on the Arduino board but the other Arduino boards do not.
While the devices often work with the internal AVR pullups, it is WAY out of spec so they can be problematic and cause strange issues when there are no additional pullups.
The ARM arduino processors do not have internal pullups on the signals and require external pullups so if the device doesn't include them, it won't work.
Then lastly there can be the issue of 5v vs 3v on boards like DUE that made the awful decision to not be 5v tolerant. This means that you either have to use a voltage level converter or try to cheat by running the LCD at 5v but the i2c bus at 3v (which usually should work).

But all in all, I see about the same number of issues with LCDs being used with direct pin control as i2c backpacks.

--- bill


Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy