Pages: [1]   Go Down
Author Topic: 1602A ks0066 issues with breadboard arduino  (Read 2804 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 1
Posts: 19
Arduino Science
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi to all.

I would really like to ask for some help on this, because after 3 days, I am at my wits end.

I recently bought some LCDs, 2 line, 16digit 1602A compatible ones like this.

I am able, with my Arduino duemilanove board, to get a perfectly satisfactory "hello world" sketch going.

I have built a functioning "bare bones" atmega328 board with the same code, and I cant get the lcd to work - all I get is 1 line of white blocks. When I put my oscilloscope on the pins, on the bare board, they all produce square waves, and the D13 led flashes fine - so the bare board is functioning.

All my pins are wired up properly, but even so I have swapped them in various combinations to try and change things -nothing.

My questions are:
1) how fussy about timing are 1602A LCDs - are there any issues?
2) Are there any known voltage issues: arduino is 5v regulated (7805), breadboard is either 6v battery, 6 volt battery with 0.7v drop across silicon diode, or 6v battery with 1.4v drop across 2 diodes?

The code I am using is just variations on the example sketch:

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 10,11, 7,6, 5, 4);
//LiquidCrystal lcd(12, 11, 6, 5, 4, 3);
//LiquidCrystal lcd(3, 4, 11, 10, 9, smiley-cool;
//LiquidCrystal lcd(12, 11, 10, 4, 3, 2, 1);


// for now, just feed the backlight lcd and contrast




void setup() {
  // set up the LCD's number of columns and rows:


pinMode(13,OUTPUT);
  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:
  digitalWrite(13,1);
  lcd.print(millis()/1000);
  digitalWrite(13,0);
//  delay(500);
 
}


* arduino-name-badge front.JPG (643.72 KB, 1936x2592 - viewed 52 times.)

* arduino-name-badge back.JPG (591.89 KB, 2592x1936 - viewed 53 times.)
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 32
Posts: 4256
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The whole idea of the LiquidCrystal lcd(RS, RW, E, D4, D5, D6, D7); statement is to allow you to connect any LCD pin to any Arduino pin.  In designing your perfboard layout you should have taken advantage of this capability and used the IC pins, in order, for your display.  You could have eliminated many of your jumpers and made the troubleshooting a lot easier.

Your uncommented version is: LiquidCrystal lcd(12, 10, 11, 7, 6, 5, 4);.  Why are you implementing the RW line?  It isn't used by the library.  According to this statement RW should be connected to Arduino pin 10 which is PB2 or IC pin 16.  I don't see any connection to pin 16 on your perfboard.  As a matter of fact I don't see any connection to pin 5 of the LCD which could be the cause of your problem right there.


Don
« Last Edit: July 17, 2011, 09:51:27 am by floresta » Logged

0
Offline Offline
Newbie
*
Karma: 1
Posts: 19
Arduino Science
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the quick reply.

pin 5 is connected to 16 - I fixed that problem just after taking that photo, (basically I sent the earlier photo by mistake).

rw is connected to 5 because it didn't work when I held it to ground, and another example in the exhibition posts had used it this way.

The physical layout of the board is necessary because the veroboard has to sit just behind the lcd - it is to become a nametag. I also would have liked to run it off the other side (use d9-12 as bus, d13 as RS, d8 and one jumper as enable, and r/w to ground), but it wasn't possible due to other layout considerations.

Any other suggestions?
TIA
Logged

0
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2857
ruggedcircuits.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't see how you have addressed the contrast adjustment. That is generally done with a potentiometer connected to pin 3.

And the voltage supply scheme you have chosen is fairly dodgy. 6V directly is bad as you could conceivably destroy the LCD and other components. 6V through a diode is better, but it is not a very good form of regulation. I'd suggest adding a low-dropout 5V regulator to your setup like an LM1117 or similar, along with decoupling capacitors.

--
Beat707: MIDI drum machine / sequencer / groove-box for Arduino
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 32
Posts: 4256
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Before I forget again - I don't see bypass capacitors on either of the power connections to the IC.

I guess we have to get our pin numbers sorted out here to find out which "5" you are talking about.  The Arduino has 20 I/O pins numbered 0-19.  The IC has 28 pins numbered 1-28. And the LCD has 16 pins numbered 1-16.  

Quote
pin 5 is connected to 16 - I fixed that problem just after taking that photo, (basically I sent the earlier photo by mistake).
LCD pin 5 is the RW pin which must be grounded.  LCD pin 16 is frequently used for the backlight GND connection.  So if "pin 5 is connected to 16" refers to the LCD pin numbers then you are probably OK.

Quote
rw is connected to 5 because it didn't work when I held it to ground,
Here it looks like you may be talking about Arduino numbers.
(1) If the circuit doesn't work with RW grounded than it won't work with any other connection either - there is something else wrong.  
(2) According to LiquidCrystal lcd(12, 10, 11, 7, 6, 5, 4); RW is connected to Arduino 10 and LCD D6 is connected to Arduino 5.


Quote
and another example in the exhibition posts had used it this way.
Do you have a link?

Don
Logged

0
Offline Offline
Newbie
*
Karma: 1
Posts: 19
Arduino Science
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the replies, I have annotated the picture to make this clearer (and drawn in the missing wire!).

I will put decoupling capacitors across the supply lines on the LCD - thanks for the tip.

The link to using an arduino pin for r/w is here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1272869652

Quote
(2) According to LiquidCrystal lcd(12, 10, 11, 7, 6, 5, 4); RW is connected to Arduino 10 and LCD D6 is connected to Arduino 5.

I have misunderstood something here: LCD 6 should be connected to arduino pin D11 (aka atmega328 chip pin 17).

Maybe the diagram below makes things clearer:


* arduino-name-badge front-annotated.JPG (662.35 KB, 1936x2592 - viewed 56 times.)
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 32
Posts: 4256
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I have misunderstood something here: LCD 6 should be connected to arduino pin D11 (aka atmega328 chip pin 17).
That looks OK.


I did this quickly, I hope I got it right!

LCD Module              RS  RW  EN DB4 DB5 DB6 DB7
                         4   5   6  11  12  13  14

LiquidCrystal lcd       RS  RW  EN DB4 DB5 DB6 DB7
                        12  10  11   7   6   5   4    <-- your arbitrary choices

ATmega328              PB4 PB2 PB3 PD7 PD6 PD5 PD4  
                        18  16  17  13  12  11   6



It seems to me that a better choice of pins would have been something like this:

Line up LCD pins with ATmega pins as closely as possible, avoiding Tx and Rx (PD0 and PD1):
LCD Module              RS  EN DB4 DB5 DB6 DB7
                         4   6  11  12  13  14

ATmega328              PB0 PD7 PD6 PD5 PD4 PD3  
                        14  13  12  11   6   5


Convert ATmega nomenclature to Arduinoese:
Arduinoese               9   7   6   5   4   3   

LiquidCrystal lcd       RS  EN DB4 DB5 DB6 DB7
                         9   6   5   4   3   2    <-- new values to use


                        Note:  RW (LCD pin5) connected to GND


Don
« Last Edit: July 18, 2011, 10:04:48 am by floresta » Logged

0
Offline Offline
Newbie
*
Karma: 1
Posts: 19
Arduino Science
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Don.

You are probably going to kill me. It seems to be a very dodgy header. I get high resistance between the connections between the LCD and the arduino on a number of pins. I will get a new header and see if that fixes it .

Thanks for your help on this.

Cheers,
Leon
Logged

Poland
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ks0066 and s6a0069 those conrolers are diffrent initializotin code. Those controlers LCD have the some place pins but inicialization code diffrent than HD44780. Don't use function "LiquidCrystal.cpp and "LiquidCrystal.h"
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 32
Posts: 4256
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The initialization sequence is slightly different for these controllers but I can see no reason why the standard LiquidCrystal library will not work.

Don
Logged

Poland
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I collect data for controller HD44780U which use standard LiquidCrystal library.
I talking about interface 4-bit (time and instruction code) because I use only display LCD for KS0066U
I attached File.
 

* CompareLCDDrivers.docx (221.52 KB - downloaded 34 times.)
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 32
Posts: 4256
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The initialization sequence is slightly different for these controllers but I can see no reason why the standard LiquidCrystal library will not work.

HD44780                         LiquidCrystal                   KS0066U

Function Set  (reset)           Function Set  (reset)

Function Set  (reset)           Function Set  (reset)

Function Set  (reset)           Function Set  (reset)

Function Set  (change mode)     Function Set  (change mode)

Function Set                    Function Set                    Function Set
   
Display OFF                     Display ON/OFF                  Display ON/OFF

Display Clear                   Display Clear                   Display Clear

Entry Mode Set                  Entry Mode Set                  Entry Mode Set

Display ON/OFF


Don


Logged

Pages: [1]   Go Up
Jump to: