Read and display incoming Serial Data

Hello. I'm a complete beginner in Arduino programming. I'd like to ask your help on how do i construct a program that can read Serial data. I've connected the Tx pin of the device to the Rx pin of my Atmega328. The device manufacturer stated that its Output Format is Serial Data at 9600 baud rate(8 bits data, No parity, 1 stop bits), Outputs three parameters in ASCII. and i'd like to display it on my serial monitor. So how do i do it? thanks.. :slight_smile:

I've connected the Tx pin of the device to the Rx pin of my Atmega328. The device manufacturer stated that its Output Format is Serial Data at 9600 baud rate(8 bits data, No parity, 1 stop bits),

What is this device. It is possible that it could output RS232 voltages or TTL voltages. It is only TTL that you can directly connect to the Arduino.

how do i construct a program that can read Serial data.

Open up the Arduino IDE. From the file menu choose Examples -> 04 Communications then you will see a collection of examples to read serial data.

To display anything you need a display module like an LCD or OLED, make sure their is example code of how to use what you eventually buy.

The examples in Serial Input Basics should do what you require. The 2nd example will probably be the most suitable.

...R

Tan_koloy:
Hello. I'm a complete beginner in Arduino programming. I'd like to ask your help on how do i construct a program that can read Serial data. I've connected the Tx pin of the device to the Rx pin of my Atmega328. The device manufacturer stated that its Output Format is Serial Data at 9600 baud rate(8 bits data, No parity, 1 stop bits), Outputs three parameters in ASCII. and i'd like to display it on my serial monitor. So how do i do it? thanks.. :slight_smile:

Grumpy_Mike:
What is this device. It is possible that it could output RS232 voltages or TTL voltages. It is only TTL that you can directly connect to the Arduino.

As Grumpy_Mike said, VERIFY VOLTAGE LEVELS. RS232 defines the signal voltage levels for valid signals as (MARK)Less than -3V and (SPACE)greater than +3V. The Arduino (TTL levels) are (MARK) between 0V and 1.66V, (SPACE) 3V and 5V.

Do you see the INCOMPATIBILITY? Make sure your device is TTL level Serial, NOT RS232.

Chuck.

chucktodd:
As Grumpy_Mike said, VERIFY VOLTAGE LEVELS. RS232 defines the signal voltage levels for valid signals as (MARK)Less than -3V and (SPACE)greater than +3V. The Arduino (TTL levels) are (MARK) between 0V and 1.66V, (SPACE) 3V and 5V.

Do you see the INCOMPATIBILITY? Make sure your device is TTL level Serial, NOT RS232.

Chuck.

I checked the device board and 3V/5V UART Interface is indicated there.

I tried using robin's 2nd example but the problem is that the board can't seem to receive the data

I got the device from here Blood Pressure Sensor - Serial output [1437] : Sunrom Electronics

Its MCU interfacing is also shown on that page so i just directly connected it to my board. but it can't seem to receive the data after the davice took its measurements. I appreciate all of your reply guys. thank you

Hello i just checked again and it the output is actually RS232..I've decided to order an RS232 to TTL converter module...thank you all for your replies.

Tan_koloy:
Hello i just checked again and it the output is actually RS232..I've decided to order an RS232 to TTL converter module...thank you all for your replies.

If communication is only from the device to the arduino, you can make a converter from a transistor and two resistors.

Robin is the second example capable of receiving data from an external device connected to the Rx pin of my board? I just can't seem to display the data even with an RS232 to TTl connected. Coupled with my beginner level in arduino programming it seems too hard for me :frowning:

Tan_koloy:
Robin is the second example capable of receiving data from an external device connected to the Rx pin of my board?

Yes.

But you must be aware that Pins 0 and 1 on an Uno are used for communication with the PC over the USB connection and that will cause a conflict.

Perhaps you need to use SoftwareSerial to create a second serial port on your Arduino using two different pins for Rx and Tx and connect your external device to them. My code can easily be adapted to work with a SoftwareSerial port.

Post the latest version of your code so that we can all see the same thing.

...R