RS232 touchpanel controller

Components:

MP3car’s modified Lilliput 696 LCD touchscreen (RS232 version)
Arduino Nano
RS232-TTL converter

The touchscreen is an eGalaxy, with an EETI control board.

While doing some searching, I managed to find a document which contained a bunch of info about RS232 communication with the controller.
EETI controller documentation

Pretty straight-forward, 9600 8N1. Thought I was home-free.

Hooked up the TTL to Serial converter to the Arduino on my breadboard, and connected it to a computer I use for testing. I verified that the TTL converter worked, and could send/receive data using NewSoftSerial and the default NSS demo sketch.

Then I connected the touchscreen to the same PC, ran serial-port monitoring software and verified that the touchscreen control board output was sane. I got a few different chars depending on where I touched the screen. Everything looked good.

I couldn’t connect the TTL adapter to the Serial plug on the LCD directly as they were both female. I bought a male-to-male passthrough, connected them, and turned everything on…

No output at all.

Tried commenting “if (nss.available())” and just dumping any output, the only thing i get is “ÿ”, with no change based on input. Tried using inverted signaling, same thing.

I’m starting to wonder if maybe my male-to-male passthrough might be the problem, but to be honest i have no idea. Here’s the connector I used:
Gigaware® DB9 Male to DB9 Male Serial Coupler

And the demo code:

#include <NewSoftSerial.h>
NewSoftSerial mySerial(3,2);
void setup() {
  Serial.begin(57600);
  Serial.println("online!");
  mySerial.begin(9600);

}
void loop() {
  if (mySerial.available()) {
      Serial.print((char)mySerial.read());
  }
  if (Serial.available()) {
      mySerial.print((char)Serial.read());
  }
}

Anyone have any suggestions? This looks like it should work, but it doesn’t even try.

Connecting TX and GND from the serial connector on the LCD directly to the RX and GND pins on the Arduino won’t work, right?

Connecting TX and GND from the serial connector on the LCD directly to the RX and GND pins on the Arduino won't work, right?

You have a voltmeter, right? Measure the input/output voltages level when it is working with the PC.

Turns out, it was the db9 adapter. I mapped and tested the pins and found the adapter pinout was incorrect. Bought some Radioshack parts and built my own adapter and it works like a charm. Checking the voltages got me started down the right path, thanks Paul.

It didn’t take long once I had the hardware figured out to get the code working. Here’s some ugly code that will print x/y coordinates to Serial. (0/0 is bottom-left)

If you ever decide to buy one of these LCDs, make sure you tell MP3car to send you the RS232 version. It’s special order, and has a longer lead-time. If you don’t specify, they’ll send you the USB version.

#include <NewSoftSerial.h>
int i = 0;
int j = 0;
int k = 0;
int raw[12];
NewSoftSerial ns(3,2);
void setup() {
  Serial.begin(57600);
  Serial.println("online!");
  ns.begin(9600);
}
void loop() {
  if (ns.available()) {
    raw[i] = ns.read();
    i++;
    if (i == 10) {
      for (j=0; j< 10; j++) {
        if (k == 5) {
          Serial.print(".");
          Serial.println(raw[j]);
          k = 0;
        }
        if (k == 4) {
          Serial.print("x:");
          Serial.print(raw[j]);
          k++;
        }          
        if (k == 3) {
          Serial.print(".");
          Serial.println(raw[j]);
          k++;
        }
        if (k == 2) {
          Serial.print("y:");
          Serial.print(raw[j]);
          k++;
        }          
        if (raw[j] == 129 || raw[j] == 128) {
          k++;
        }
      }
      i=0;
    }
  }
}

For others reading this, who are having similar problems...

Whenever you work with serial interfaces, you need to have your wits about you...

The "transmit" line FROM the Arduino, TO your connected device is, at the connected device, the "receive" line, isn't it?!

There are rules which are supposed to sort all this out... but I've never been able to keep them straight. Just remember: If it is called "transmit", that doesn't tell you enough. "Transmit" from the point of view of which device in the system???

Voltmeter: Disconnect the devices. If you see a voltage on a pin: It is probably the output from that device. But check the pin that you think is the input to that device. If you don't see 0 volts there (when the devices are not connected to one another), think again. You're missing something. Which I do often.