Rs232 connection to arduino uno

Hi guys

Im wondering if someone can please help me. Can i connect directly to an serial device on tx and rx pins of arduino? I want to read the weight from an scale. Do i have to put an resistor on the rx and ground line? Im not experienced on electronic.

1 Like

Is the serial output from the scale TTL serial or is it "real" RS232 with ± 15V levels? If TTL you can connect directly. If "real" RS232, you will need a level shifter like a MAX232 or MAX233.

Hi thanx for the reply. Ive measured it its 5v. I seem to read data but its not correct values. But running from terminal it reads fine.

Baud rates, number of data bits, etc. match?

Hi guys.

Ive got an problem where im trying to read data on rs232. Data i receive is not actual values from scale. I receive ascii values like 191 241 154 and so on which is not coreect. But reading scale weight from terminal displays it correctly. What could be the problem? maybe serial port faulty?
Im running power from isb asn use rx pin to receive data. Thanx in advance.

Yes al match i get values like 191 154 241 ect

(deleted)

RS232 devices use high voltages that are not compatible with an Arduino's TTL voltage levels and may damage an Arduino. You can use a device such as a MAX232 to convert between RS232 and TTL voltage levels.

...R

Thread started here.

1 Like

What do you mean "running from terminal"? Are you plugging the scale into a PC to test it?

If so, the previous posters are correct - you cannot read RS-232 data on an Arduino without a TTL converter. The problem is not just that the voltage is wrong, but that RS-232 is upside-down.

I was just playing around with this over the weekend, so I've got a pretty clear idea of what's going on: When you send TTL serial data, the wire has a HIGH voltage when sending a 1 bit and a LOW voltage when sending a 0. These are called a mark and space; mark=1 and space=0.

RS-232 is different in two ways.

First, the voltage is different. It uses negative and positive voltage, rather than 0 and and 5 (or 3.3) volts. Ideally, RS-232 uses +12 volts and -12 volts for signalling, but that can be as low as 3 volts and as high as 25 volts.

Second, RS-232 represents a mark with a negative voltage and a space with a positive voltage. So when your scale is sending a mark, the Arduino is sensing a space. This means that the values returned will be bit-inverted, but your frame will be wrong, because the start bit will be thrown away, since the UART will think it's a space and not a mark.

Short version: like other people said, you need to use a MAX232 module, because the Arduino's serial data is not RS-232; it is TTL.

@Ian47, do not cross-post. Threads merged.

1 Like

Hi guys. I have an problem. When i read data from rs232 it gives me wrong values lik 154 191 241 ect. But reading the values in terminal it displays the correct values. Baudrate pariyy and bits all the same. Plesse help

Can you please post the instructions that you have used to read data bytes from the serial port when you have these outputs: 154 191 241

Also please, post the values that you are seeing on the terminal (PC Monitor?) corresponding to 154 191 241?

Thanks,

I have an problem.

So have we, you have not provided much information.

When i read data from rs232

What is the source of this data? How are you connecting this to the Arduino?
An RS232 signal is +/- 12V, and Arduino reads TTL signals 0 to +5V. Direct connection of an RS232 signal to an Arduino will damage it. Also an RS232 signal is inverted when compared to a TTL signal.

it gives me wrong values lik 154 191 241

OK if those are the wrong values what are the right ones? Wrong values make little sense in the absence of what they are supposed to be.

OK if those are the wrong values what are the right ones? Wrong values make little sense in the absence of what they are supposed to be.

I second it with +.

Yes! In Engineering, we need to have good estimation on the 'quantitative amount' of the expected output (the result). For example: When we declare the data type of a variable, we do care, in advance, about the possible size of the result to ensure that there is no overflow situation.

STOP CROSS-POSTING. LAST WARNING.

Hi guys sorry for the cross threading. i will try with an max232 chip but previously i only used direct connection with an resistor and diode. i could get the weight from the scale but now i connect straight to the rx on the arduino uno pin. Or can it also be that im using the usb for power and receiving on the rx pin?

thanx for all the help guys.

im sorry for the cross threading as i stated earlier i couldnt find my post so created a new one. Didn't know it will merge it its an honest mistake.

Thanx for all the help guys. I manage to revert the inverted signal using an transistor and a resistor. Now i get the correct data