Random Scrolling Characters Batron 40x2 & Mega 2560

My troubleshooting led to a completely different problem (and configuration) so I thought I’d better do a separate thread. :wink:

My Batron 24003V-07 scrolls a series of random characters. The scrolling starts when I touch the ribbon cable attaching the display to the breakout board, and stops scrolling when I remove my finger (not when I twist or flex the cable, only when I touch it–almost seems capacitive somehow).

Wiring:

Pin 1 - GND
Pin 2 - 5V
Pin 3 - 2K Potentiometer Wiper
Pin 4 - PWM 12
Pin 5 - PWM 11
Pin 6 - PWM 10 (or left unconnected–I’ve tried both ways, changing the configuration line in the Sketch to suit)
Pin 7
Pin 8
Pin 9
Pin 10
Pin 11 - PWM 5
Pin 12 - PWM 4
Pin 13 - PWM 3
Pin 14 - PWM 2
Pin 15 - 5V
Pin 16 - 680 Ohm Resistor - GND

Pot Pin 1 - GND
Pot Wiper - Batron Pin 3 as above
Pot Pin 3 - 5V

// 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(40, 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);
}

I verified the Batron pinout follows the standard 1x16 pin LCD convention (and yes I checked I didn’t have it reversed).

I have an Arduino Mega 2560 r3, using the stock Liquidcrystal library that I just downloaded to my linux laptop, so I assume I have the latest library.

Any thoughts?

The numbers in your constructor

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

must match the Arduino pin numbers that you are using

. . .
Pin 4 - PWM 12
Pin 5 - PWM 11
Pin 6 - PWM 10 (or left unconnected--I've tried both ways, changing the configuration line in the Sketch to suit)
. . . 
Pin 11 - PWM 5
Pin 12 - PWM 4
Pin 13 - PWM 3
Pin 14 - PWM 2

Yours obviously don't match since you are using 7 Arduino pins and your constructor has only 6 entries.

Most people connect LCD pin 5 to GND since they don't read from the LCD. In your case the constructor should read

LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);

You cannot leave LCD pin 6 unconnected. In some ways it is the most important pin since it's action triggers the transfer of data to the LCD.

The term 'PWM' that you have included in your list is incorrect for some of the pins and irrelevant for the others.

Don

Thanks so much for the reply...I guess I really need to learn the terminology better!

When I mentioned adjusting the line in the sketch to suit, I guess I was talking about the constructor...so when I did have LCD Pin 6 connected to Arduino Pin 10, the constructor did include that number.