Serial LCD problems

I'm new to the Arduino world. I just purchased and received a Nano and was trying to get it to interface with a serial LCD on pin 1. This is the code I used:

// Code to test serial LCD connected to pin 1

void setup (){ Serial.begin(9600); Serial.print ("Test"); } void loop (){ }

The LCD displays gibberish. I believe that I have the baud rate set correctly and I've tested a different LCD (just to see if the LCD was bad) with the same result. I've tested the LCD with a Basic Stamp and it works fine. I tried going down to 2400 on the LCD with the corresponding code with the same issue.

The serial monitor indicates that the string is output correctly but it doesn't seem to get thru to the LCD. I'm using 0011 Alpha.

Can anyone help?

Maybe your nano's clock is not what you think it is? Can you try just sending serial data to hyperterm or something to see if that works ok?

  • Ben

I tried what you suggested - hyperterm set to the same speed doesn't receive good info either. So is this a Nano related serial issue then?

If the nano's clock is not the speed you think it is, its baud won't be at the rate you think you're setting it to, which in turn means that it won't agree with the baud you're setting for your target device (be it hyperterm or your LCD).

Do you have access to an oscilloscope that you could use to measure the baud rate? Another simple test you can do is just try to blink an LED. Make a sketch that turns on the LED, delays for a second using delay(1000), turns off the LED, delays for another second, and then repeats. Run the program and time the LED blinks with your watch or some other external timer to see if the blink rate corresponds to what you expect.

You also might want to consider contacting the company from which you purchased your Arduino Nano. Maybe there are some problems with it related to its being a brand new product? Or maybe you haven't configured your Arduino environment properly for the Nano?

  • Ben

I tried the 1 s delay and it seemed to be operating as expected, but the resolution/accuracy of my starting/reading the stopwatch is not very high. The timing seemed accurate over a period of 3 or 4 minutes.

What should the setup of the environment be for the nano? I set it up for the Diecimila.

I'll go see if I can find a digital scope or logic analyzer in the office tomorrow.

btw, thanks for the help.

What should the setup of the environment be for the nano? I set it up for the Diecimila.

I'm not sure, I assume the place you bought it from would have information on this...

Just wondering, I get this message when I switch (via the tools menu) to different boards. What’s the cause of this?

In file included from /Applications/arduino-0008/lib/targets/arduino/WProgram.h:5,
from Stepper.cpp:48:
/Applications/arduino-0008/tools/avr/bin/…/lib/gcc/avr/4.0.2/…/…/…/…/avr/include/avr/signal.h:36:2: warning: #warning “This header file is obsolete. Use <avr/interrupt.h>.”
In file included from /Applications/arduino-0008/lib/targets/arduino/WProgram.h:7,
from Stepper.cpp:48:
/Applications/arduino-0008/lib/targets/arduino/wiring.h:60:1: warning: “abs” redefined
In file included from /Applications/arduino-0008/lib/targets/arduino/WProgram.h:1,
from Stepper.cpp:48:
/Applications/arduino-0008/tools/avr/bin/…/lib/gcc/avr/4.0.2/…/…/…/…/avr/include/stdlib.h:116:1: warning: this is the location of the previous definition
In file included from utility/twi.c:25:
/Applications/arduino-0008/tools/avr/bin/…/lib/gcc/avr/4.0.2/…/…/…/…/avr/include/avr/signal.h:36:2: warning: #warning “This header file is obsolete. Use <avr/interrupt.h>.”

Do you have access to the oscilloscope? If you do please put the oscilloscope on pin 1 of the Nano and the ground. Set the oscilloscope to 500uS and 2V setting. Hit the reset button you should see something similar the picture I attached below. This is running your code below. As you can see on the second picture, the baud rate is extreamly close to 9600 baud and this should work okay.

We are running this code on the serial LCD we are selling and it is working fine. If you do the above experiment and didn't see anything on the oscilloscope then you got the bad Nano. We can exchange you a new one.

I finally managed to get a 'scope. I ran the test at 2400 baud and the output (with no LCD connected) is as expected. I haven't figured out how to insert an image in this post, but the timing is as you'd expect for 2400 baud.

However, things go bad when I hook up the serial LCD. The signal line (pin 1) just drops to 0 and stays there after the reset! Something is getting to the LCD - there are characters displayed, just not the ones I want. The LCD appears to work fine. There is a self test mode that displays all the characters and it works with a Basic Stamp. The LCD is a Seetron SGX-120L from Scott Edwards.

I tried the same thing with a different LCD display with similar results - the LCD didn't receive the data correctly. I didn't have the scope with me at that point so I don't know exactly what was transmitted.

OK, I found the problem. According to the manual for G12032 (or SGX-120L) under “Connecting Serial Input”, it is taking inverted level of UART. http://www.seetron.com/sgxmnl.htm

“If you are using this display with a single-board computer, see the manufacturer's documentation for information on connecting serial devices. If the serial output is logic-level (5V), make sure that it is inverted. In terms of serial communication, this means that the stop-bit condition should be low (0V or negative) and the start-bit condition should be high (3.5V or higher).”

All of the Arduino boards are true level UART (start-bit = logic low and stop-bit = logic high). Therefore, the Nano will not work directly with this LCD. Hardware wise you can throw a transistor and couple of resistors to fix the problem. There might be some software fix. All you have to do is invert all of the bits, but this might cause some conflict with the program download. Anyone has done this before?

I missed that in the LCD documentation. I wired up a simple inverter and all is well now.

Many thanks for the help!

I'm having the same problem and a question.

Is there any way of writing a new softwareserial library with inverted logic so I won't have to use any additional hardware to make this happen?

You should be able to do that in the original library code:

[your Arduino directory]/hardware/libraries/SoftwareSerial/SoftwareSerial.cpp

I don't recall if it will automatically recompile if you just 'touch' the source files or if you have to delete the .o file to force the recompile. Better to be sure and just delete the .o file after editing the .cpp file.

Doug

Thanks for the tip, it worked!

good to hear it worked out. One more thing you might consider is renaming the modified SoftwareSerial library to something like InvSoftwareSerial so that your Arduino env still has standard libs for when you don't need to invert it. For instance, the Sparkfun serial LCDs didn't require the inversion.

Doug

Yes, i made a copy of it, I will use it on my ILM-216 from www.seetron.com so i named it SerialLCD.

I'm on the same boat.....how do I change the library file to invert??

As far as I can remember I just copied the library, opened it and performed a search and replace and just made all "HIGH" "LOW" and all "LOW" "HIGH" and it worked.

Just a quick note to thank you for this thread (and to Google!)

I took delivery of a Netduino (Arduino cousin :) ) last night and I wanted to wire up an old SGX-120L LCD display that I had previously used in a project about seven years ago.

Anyway I set it up for 9600,N,8,11 and had the same garbage characters on the LCD that you had. I even read the same release note about data being inverted... so my wee little brain thought to change the write routine to XOR 0xFF all the data bytes before sending... well that didn't work.

It never occurred to me that the EVERYTHING (data/start/parity/stop bits) was inverted, not just the data! :o

I rifled through my misc IC cabinet and found a 7404 lying around. I, wired up +5V, ground and using one of the six inverters I finally had pressed F5 to run...

"Hello World!" flashed on the screen! Voila!

Thanks so much - on to bigger and better things!

-David

There's further guidance on connecting serial LCD units at...

http://sheepdogguides.com/arduino/art8lcd117.htm