SparkFun Forums 

Where electronics enthusiasts find answers.

Your source for all things Atmel.
By capinredbeard
Has anyone tried interfacing an Arduino NG board with a DX-160 Serial LCD from SF? The screen comes on and shows the startup screen, but I can't seem to get any command to work except the clear screen command (186).
I've done programming on a PC before, but I'm a complete newbie when it comes to microcontrollers, etc. I have done some simple stuff with the Arduino and LED's and serial communication to the PC, but this was going to be the next "step" in learning about this kind of thing.
I'm sure there is something extremely simple that I'm missing. I've spent some time on Google looking up information on this particular combination, but as far as I can tell I'm the first. And I've looked at other code for other serial screens, but I still can't tell what I'm doing wrong.

Here's some sample code (I've got the board powered by USB, an LED connected to pin 13, and the tx pin on the board connected to TTL on the screen. By the way, I can see the commands in the IDE with the serial monitor on. I had thought that the board was sending commands over USB and not out tx, so I powered it using a wall wart, but this did not fix anything.):

Code: Select all
int ledPin = 13;   // select the pin for the LED

void setup() {
  pinMode(ledPin,OUTPUT);   // declare the LED's pin as output
  Serial.begin(57600);      // connect to the serial port

void loop () {

  Serial.print("Hello, world!");
  Serial.print("Hello, world!");
  digitalWrite(ledPin, LOW);
  digitalWrite(ledPin, HIGH);
By rfryar
If you do not wait between commands the dx160 will just ignore the command. The wait times vary from my experience and they are not documented in the least.

On the safe side I wait one millisecond after every byte sent and then after a large operation like clearing the screen or a graphics operation I wait 5-10ms more.

Hope that helps,

Hey Guys,
I am trying to figure out the DX160 + Arduino. and stock at the same place where I can only get the clean screen ASCII[186] to work... Anyone has any further information on this?

By axmanjr
rfryar is correct, the wait time inbetween sending commands is different. You'll have to mess around with different values. I am using the DX160 with a PIC and, after messing around a bit, was successfully able to get it to work. I'm still trying to figure out a few "quirky" bugs, but for the most part it works fine now. I don't know anything about Arduino however.

If anything, try calling the manufacturer (one guy). His name is Rene Teo and was extremely helpful with me. His email is . I can't seem to find his phone number anywhere, but email him with your number and he'll contact you via phone.
By atmh
I'm having precisely the same problem. Does anyone have any examples of code that works? I've e-mailed the guy mentioned in the previous post...

I'm using an Arduino Diecimila.
By atmh
I've since talked to Rene, he's a nice guy, very willing th help.

Basically what I've done:

I've run the "test" program and controlled the display. I've done this by hooking the display up to my Arduino's RX pin and sending data to Arduino... so the board will see that data.

That works very well and properly. I realized it may not be the correct way to do it, but it works.

Using the Arduino:

I've managed to change the baud rate to 9600, that fixed nothing for me. I've since reset it back to 57600.

I can occasionally get commands to go through. Clear Screen is the only one that's ever gone through 100% correct. It occasionally outputs garbage on the screen with other data sent.

I've tried both the TTL and RS232 pins. No real significant difference at this point with either. TTL is said to be the one to use, so I'm currently sticking with that.

I guess the question at this point is: Is it inverted or non-inverted signal? How does one change/fix/alter that?

When I finally figure this out and get it to work, I will post example code on how it works with Arduino. I know it can, and will work, I just have no idea how to get it to work.

If you have any info/suggestions on how to solve this, I'd really like to hear them, otherwise I'll just keep plugging away at it.
By atmh
I found out what my problem was...

I failed to put in the end-of-string command, I also wasn't outputting my commands to the screen as BYTE, and also the delay is very important. I see the example code above has just about everything, except the delay. I had the delay and failed to realize that I was missing the other stuff. Here's some example code, that works with an Arduino Diecimila:

Code: Select all
 * Hello World!
 * This is the Hello World! for Arduino. 
 * outputs to DX160.

void setup()                    // run once, when the sketch starts
  Serial.begin(57600);           // set up Serial library at 57600 bps
  Serial.print(186,BYTE);        // Clears the screen (DX160)
  delay(1000);                   // waits a second
  Serial.print("Hello world!");  // prints Hello world! 
  delay(10);                     // waits...
  Serial.print(255,BYTE);        // sends the end-of-string command - gives the "OK" for the DX160 to print.

void loop() {
By dimitris
I cannot seem to get lines and shapes to draw. Also, I cannot get the "hello world" application to work properly. Its very odd, I have to put the Serial.print("hello world!") function in the loop function. Then, i have to unplug the device, and repower it when the loop function is working. Here is the code i have for drawing a line. Does anyone have any ideas?

void drawLine(int x1,int y1,int x2,int y2)

void setup() // run once, when the sketch starts
Serial.begin(57600); // set up Serial library at 57600 bps
Serial.print(186,BYTE); // Clears the screen (DX160)
delay(1000); // waits a second
Serial.print("Hello world!"); // prints Hello world!
delay(10); // waits...
Serial.print(255,BYTE); // sends the end-of-string command - gives the "OK" for the DX160 to print.

void loop()

By jasonharper
dimitris, you aren't sending the required "color" parameter for the line-drawing command.
By kngpengwin
has anybody gotten bitmaps to work via arduino? I've been trying for a while with no luck. sometimes my code corrupts the arduino bootloader, other times nothing happens, other times I get garbage on the screen...but never a bitmap.

one odd thing I've found is that if I put the bitmap code into a function, it can crash the arduino or cause other problems even if I don't call the function.

here is my current code: ... Bitmap.txt

text, graphics, etc are working fine for me.
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]