Pages: [1]   Go Down
Author Topic: LCD Display communication  (Read 566 times)
0 Members and 1 Guest are viewing this topic.
USA, OH
Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am working with 16x2 LCD with SparkFun SerLCD backpack.
I found that I have to disconnect backpack rx input from Arduino Tx
while uploading new sketch into Ard, as well while just applying power to Arduino board (that is, just connecting it to USB or battery). Otherwise there is a lot of garbage transmitted by board to backpack at boot time, which takes LCD into unknown state.
So, my question is:
what is the best way programmatically connect/disconnect backpack serial input from Ard?
I think it's not 'doable' without adding, say, transistor or something like that.
Please share your opinion!
Logged

U of A, Tucson, AZ
Offline Offline
Full Member
***
Karma: 0
Posts: 164
Hello World
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Instead of using the hardware serial port on pins 0 and 1, use the software serial library and connect the LCD to some different pins.

http://arduino.cc/en/Reference/SoftwareSerial
Logged

USA, OH
Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you, this is basically correct, but I had in mind rather some hardware solution... like, connect/disconnect backpack Rx using some transistor or mosfet... just trying to save myself some time of googling on long forgotten electronics details...
Logged

London
Offline Offline
Sr. Member
****
Karma: 1
Posts: 330
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


On my breadboard with a serial lcd display ive just got a toggle switch on flying leads on the 5v feed to the serial interface.
When I upload a sketch to the Arduino I just flip it off and when it finishes I flip it back on.
You may want to then reset the board to refresh anything you display on the lcd if your sketch doesnt update the lcd very much like my sketch.

You could replace the switch with a relay. if you realy need to.
There are plenty of examples on using relays with the arduino if you search on google.

Gordon
Logged

USA, OH
Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, Gordon, I was thinking the same way, some small relay with normally opened contacts.
The thing is, if LCD is in unknown state, resetting Arduino will not help, you need to reset backpack, and the only way to do is by switching of it's power.
What's interesting - it's like _there is_ some way of resetting backpack by some command, because when in "garbaged state" a couple of times I managed to reset it (initiate splash-screen) sending out some x7E combinations, but it never worked next time smiley
So I think there are some undocumented backpack commands that may invoke reboot.
Logged

USA, OH
Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK, just in case if anybody is interested, seems like I solved the issue without extra hardware components.
The idea is to re-initialize backpack after bootloader is loaded.
Vss of backpack is connected to Ard.+5v, backpack ground is connected to pin2, backpack Rx connected to pin 1.
initialization code:  
void Setup(){  
  pinMode(1,OUTPUT);
  pinMode(2,INPUT);
  digitalWrite(1,LOW); //my idea was to ground backpack input
  digitalWrite(2,HIGH); //and turn off it's power
  delay(500);
  pinMode(2,OUTPUT);  
  digitalWrite(2,LOW);  //now pull down backpack ground=power it
  delay(3000);             //wait until splash screen disappears
  Serial.begin(9600);    //start communication
  Serial.print(<something>);
}
I do understand this is quite rough and probably not safe, but it works. No more garbage upon power up or program upload.
And, yes, backlight is set to value 140, that is, total backpack power current is about 12ma. I played with pins modes and LOW/HIGH states because initially backpack current was jumping for half a second up to 60 ma which is not safe at all. Seems like with this setup commands there is no such power jump; I found it rather intuitively  :-[
I can also see that backpack "ground" is not actually "0",it is rectangular shape pulse around 0.4 v and freq~100Hz, seems like it originates from backpack.
« Last Edit: March 09, 2009, 01:16:43 am by Stan09 » Logged

Pages: [1]   Go Up
Jump to: