Pages: [1]   Go Down
Author Topic: 1602 LiquidCrystal mystery  (Read 705 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi guys,

I connected my Uno to a 1602 16x2 LCD. I seem to be able to control it fine using the LiquidCrystal library. However, I decided that I wanted to leave the PWM digital pins free and switched to using a different signal pin assignment instead. I used the wiring in here with some modifications:
http://arduino.cc/en/Tutorial/LiquidCrystal

Modifications:
No pot -- Pin 3 is connected to ground instead of a pot
Pin 15 to +5V and Pin 16 to ground
Pins 2, 4, 7, 8, 12, 13 instead of Pins 2, 3, 4, 5, 11, 12, respectively

I also connect (Digital Pin 3, Ground) to an LED. With the LED connected, the following code produces garbled output on the LCD. If I disconnect the LED, comment out the lines outputting to Digital Pin 3, or output 0 or 255 instead of 127, the output is fine. I would like to understand why this is happening. It seems that outputting to Pin 3 is somehow affecting the other pins that control the LCD. In this case, 'garbled' means the screen is filled with 'S' and '5' characters and constantly flickers on both the top and bottom lines as if being updated.


Code:
#include <LiquidCrystal.h>

LiquidCrystal lcd(13, 12, 8, 7, 4, 2);

#define LED 3

void setup() {
  pinMode(LED, OUTPUT);
  lcd.begin(16, 2);
  lcd.print("Hello, world!");
}

void loop() {
  analogWrite(LED, 127);
  lcd.setCursor(0, 1);
  lcd.print(555);
}
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 64
Posts: 6889
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

1) Why not using a pot? It's not an option. Did you have a pot when your LCD was working?
2) Did you have a current-limiting resistor with the LED on pin 3?
Logged


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

Quote
1) Why not using a pot? It's not an option.

It is an option if you have an LCD module that works well with 0v on pin 3 (like many of mine).

Quote
Did you have a current-limiting resistor with the LED on pin 3?

This is more likely to be the problem.

Don
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 64
Posts: 6889
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
1) Why not using a pot? It's not an option.

It is an option if you have an LCD module that works well with 0v on pin 3 (like many of mine).

Quote
Did you have a current-limiting resistor with the LED on pin 3?

This is more likely to be the problem.

Don
1) I see lots of 1 or 2page spec sheets for lcds and every one I saw has the pot 10-20Kohm. This long spec sheet I have for a particular LCD module (1602) sold at dipmicro.com requires that VDD-V0 be 4.7 typical, 4.5 min and 4.9max. You are stretching the spec of your displays if you just do 0V and let VDD-V0=5.0V instead of 4.9V max. Again, I don't have your displays or long spec sheets. They may be unhappy but they can't speak for themselves, there spec sheet can, though.

2)That is my guess too.
Logged


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

Thanks for all the answers. The problem went away after I connected a series resistor to the LED. However, I'm curious to know an explanation of what actually happened, electrically speaking. Does having a high current on one digital pin affect the logical output of another digital pin? Perhaps this is due to too much current going through that pin so that there is not enough left for the other pins for accurate signalling?

Today is my second day experimenting with an Arduino, and I've learned that you actually need to limit the current to an LED as the pins don't have built-in resistors, not only to avoid damaging the components, but also to avoid weird behavior.
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 64
Posts: 6889
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for all the answers. The problem went away after I connected a series resistor to the LED. However, I'm curious to know an explanation of what actually happened, electrically speaking. Does having a high current on one digital pin affect the logical output of another digital pin? Perhaps this is due to too much current going through that pin so that there is not enough left for the other pins for accurate signalling?

Today is my second day experimenting with an Arduino, and I've learned that you actually need to limit the current to an LED as the pins don't have built-in resistors, not only to avoid damaging the components, but also to avoid weird behavior.

Everything electronics-wise has to have specifications to state under what conditions they will work. By not having the resistor you drew too much current from that pin 3 and it's beyond its operational specification which means anything can happen and permanent damage is just a matter of time if it has not already occurred.

You stay within the current limit and other spec requirement (AKA don't screw up) and you will be able to control any I/O pin independently from any other I/O pin.
Logged


Pages: [1]   Go Up
Jump to: