Receive unreadable character from Arduino Software Serial

Hello, this is my first project with Arduino. I try to read data from weight indicator using Arduino.
I have confirmed that the indicator send the data correctly by connecting to PC. I get this data on PC "=25.14000" means 41.25 kg.
After that, I try to read it using Arduino and print the data into Serial Monitor, but i get unreadable character like below image. If I get on the scale, this values also changed. So i'm sure this should be the correct data. But i get '?' if I try to convert it to readable character.

image

#include <SoftwareSerial.h>

SoftwareSerial MySerial(10,-1); // RX, TX

void setup() {    
  Serial.begin(9600);     
  MySerial.begin(9600); 
  Serial.println("<Arduino is Ready>");       
}

void loop() {  
  int val;  

  if (MySerial.available() > 0) // if serial port data is available
  {
    val = MySerial.read();
    Serial.print(val);
    Serial.println(" ");
  }
}

Anyone can help me? Thanks.

What does 'hexval' do?
Oh. Please don't edit your previous posts. It creates meaningless replies.

Welcome to the forum

If you can read the output using a PC then it sounds like the output from the weight indicator is using RS232 signal levels. The Arduino, however, uses TTL signal levels and is not compatible with RS232 unless you use a converter between the two

Hi , i'm sorry i've edited my questions.

Hi, i have a max232 converter. But i don't know the wiring between them, i've tried to connect them like this but i receive nothing on serial port.

max232-----Arduino
TX-------------RX
GND---------GND
VCC---------- VCC

is this wiring correct ?

I've also tried to do a loopback test on max232 but it doesn't work. I receive nothing on Serial Monitor.

Loopback won't work without TX-RX and RX-TX, if I understand what you've done.
C

If you use SoftwareSerial on pin 10, you should connect the MAX232 to that pin and not to the RX pin.

yeah I've connected the TX (pin 11) and RX (pin 10) for loopback test. I write "hello" in serial monitor, but it doesn't come back.

Yes i've done that. I leave pin 0 and 1 empty (for debugging purpose only)

But you have disabled the TX functionality of the SoftwareSerial in your code (the -1 in the constructor).

that is the code to read data from indicator. I use different code when do a loopback test.
All i want to know is that correct to wire Max232 TX to Arduino RX (pin 10 in my case) ?

Post a link to the converter, and study the data sheet or instruction manual carefully.

I try to read data from weight indicator

Post a link to the "weight indicator", and read its data sheet or instruction manual carefully.

Is this the correct wiring (in general) if i want to read weight indicator data (RS232) from Arduino (TTL)?

indicator-----Max232
TX--------------RX
GND-----------GND

Max232-----Arduino
TX------------RX
GND---------GND
VCC----------VCC

We need to see the data sheets in order to answer that question. Nothing can be assumed to be "in general".

Please, please, please make a drawing, take a photo and post it here. Your description is ambiguous.

i use max232 like this Amazon.com

still can't find the datasheet yet.

Why buy parts that don't have operating instructions?

What good do the other four converters do for you? This RS232 converter is made by a reputable company, is guaranteed to work, and comes with detailed operating instructions.

Post a link to the "weight indicator".

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.