Serial assistance needed!

Hello,

I am having some difficulty interfacing to a digital balance through its RS232, I am able to read the output of the scale on my laptop using hyperterminal so I assume it is not the serial output on the balance.

I am using an RS232 to TTL convertor that I got on ebay here is the link http://www.ebay.com/itm/150813151216?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649
I got two of the convertors.

I am using a Mega my UNO's are tied up in more permanent projects. In addition to connecting the ground on the convertor to the ground on the board and have plugged the TX and RX from the converter into TX0 and RX0 on the Mega. I have tried switching the TX and RX lines in case I the labels on the converter incorrectly to no avail. I tried setting the baud rate on the scale at 9600 and 1200, using the same rate when I began the serial connection in the sketch and this did no magic. To check for a faulty convertor I swapped out the converter and went through the same tests.

I checked the output of the scale's serial port using HyperTerminal at both 9600 and 1200 and all was good on that end. I have used this Mega to read the serial output of various ZigBees so I know that the Mega works when given good serial input and proper instructions from me.

The code I started with was more involved than the code below. I wrote the code below just to notify me if and when there was any activity observed on the serial line.

/*
If there is activity cycles the onboard LED
 */


void setup() {
  pinMode(13, OUTPUT);
  // initialize serial:
  Serial.begin(1200); // Serial Monitor
}

void loop() {
  // print the string when a newline arrives:
  if(Serial.available()) {
    // if there is activity flicker the onboard LED
    for(int ij = 0;ij < 10;ij++)
    {
      digitalWrite(13, HIGH);
      delay(100);
      digitalWrite(13, LOW);
      delay(100);
    }
  }
}

Does anyone have any hints as to what I am doing wrong or further troubleshooting I should do?

Thanks

wade

That serial board has LEDs. Do they ever light up?

I just checked and they don't.

I had to check as the convertor is mounted upside down as I have it connected to a gender bender and directly to the balance. Given the orientation of the balance's DB9 connector the converter board is upside down.

wade

I put the signals on the oscilloscope to see what was happening and I found out nothing is what was happening. I put both lines on the scope and there was a 5 V DC signal on both lines when measured against units ground.

The balance was in a mode that it was continuously sending the weight reading out the serial line so there should have been some signal. I checked both the TX and RX line in case there was a mislabling or interpretation problem, both lines showed the same 5 V DC signal.

I contacted the seller that there was a problem with the units.

Thanks
wade

wwBrown,

I had similar problems a few days but with RS-485.

From my personal experience, first, check you already have enough 5VDC. I found it was better to supply the MAX (in my case) from Arduino 5VDC.

In your case you do not have to deal with Caps and Resistors since I suspect they are all already installed in the card. Saves a lot of time.

Do you have an schematic how are you connecting from Arduino to your transceiver?

Also, in my case, my program started:

#include <SoftwareSerial.h>

#define rxPin 2
#define txPin 3
#define rxEnable 13
#define txEnable 4

SoftwareSerial ceSerial(rxPin, txPin); // RX, TX

That new library gives you the chance to define any digital to transmit or receive. Mega has plenty.

In my case, I wrote in the setup() stage next lines to tell my Arduino how the pins will behave. Remember some are outputs (TX)
and other should act like input (RX)

pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
pinMode(rxEnable, OUTPUT);
pinMode(txEnable, OUTPUT);

I think it is evident why this configuration.

I found the next pinout but I am not sure if it is correct or not

http://sodoityourself.com/max232-serial-level-converter/

Please double check.

If it is correct -the pinout-, you have to connect TTL pin11 and pin12 respectively to the Digital pins in your Mega Board.

After all these, remember serial speed must match exactly both sides, ie your Mega and the Hyperterminal. From my experience, the
above code produces 9600,N,8,1 but you can select from wide ranges up to 115,200.

Regards,

Carlos