LCD Display communication

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!

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.

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…

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.


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 :slight_smile:
So I think there are some undocumented backpack commands that may invoke reboot.

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(){
digitalWrite(1,LOW); //my idea was to ground backpack input
digitalWrite(2,HIGH); //and turn off it’s power
digitalWrite(2,LOW); //now pull down backpack ground=power it
delay(3000); //wait until splash screen disappears
Serial.begin(9600); //start communication
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.