2

I've been struggling with my LCD for hours, and after solving more different issues than I can remember, I'm out of ideas for this one.

My LCD is showing random characters, see the picture below (the last character blinks, some characters change and over time there are slowly more and more characters). I'm starting to wonder if the LCD I chose has a driver compatible with the LiquidCrystal library, what do you think? If so what can I do to avoid buying another one?

enter image description here

Here is the code:

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

// initialize the library with the numbers of the interface pins
//RS EN D4 D5 D6 D7
LiquidCrystal lcd(2, 3, 4, 5, A2, A3);
//RW to GND, VSS to GND, VCC to 5V, V0 to wiper of 5V-to-GND 10k potentiometer

void setup() {
  Serial.begin(9600);
  Serial.println("Starting");
  lcd.begin(16, 2);
}

void loop() {
  lcd.setCursor(0, 1);
  lcd.print(millis() / 1000);
  Serial.println("Printing");
  delay(1000);
}

I'm using this Arduino and this LCD. Note that I'm using pins 10,11,12,13 for a SD (which works) and 6 7 8 for a MAX232 (which is disabled).

Any ideas?

migrated from electronics.stackexchange.com Sep 18 '15 at 4:11

This question came from our site for electronics and electrical engineering professionals, students, and enthusiasts.

  • 1
    Did you set the library to 4 pin mode? And have you tried sending some regular text, like "hello" instead of the output of a function – Passerby Sep 17 '15 at 23:10
  • I'm not sure whether the LiquidCrystal library supports using the "analog pins" A2 A3 that way. Can you test your LCD using the standard pin configuration (obviously not using the SD or any other interfering devices). The LCD itself looks like a common HD44780 type, so pin configuration is more likely the cause than some exotic device driver. – MarkU Sep 17 '15 at 23:14
  • 1
    The LiquidCrystal library includes known-good example code, that's part of what Arduino is for. Go ahead and use that as a diagnostic to check the LCD works, before attempting the non-standard connection. – MarkU Sep 17 '15 at 23:16
  • Thanks. The above code is an example on the official website, I've just added the delay() so it should work... I've checked and A2 and A3 are sending digital signals just like the other pins so it looks fine. Passerby, isn't it sufficient to call the constructor with 6 arguments to select 4 pin mode? – user42875 Sep 17 '15 at 23:25
  • A lot of people having this issue had EMC issues - The 5V is supplied by a boost converter from a battery but I've observed the supply rail and it's a solid 5V... – user42875 Sep 18 '15 at 0:01
2

It could be because "millis()/1000" generates a "number", and not the "string" (or "char"). Try to add ",DEC" in your lcd.print(), something like "millis()/1000,DEC" to convert it to "decimal". Generally, it depends on the library, how they implement this function.

Good luck,

Mike

  • You and Passerby were right about this, I ruled it out because it was an official example but it is obvious that their example was wrong. I changed that to "ABC...Z" and then "123...90" and both worked flawlessly. Thanks! – user42875 Sep 18 '15 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.