Trying to read data from serial monitor (Device sending UART 115200-8n1 to Arduino)

Hi there,

I am a little stuck, I am using a device that sends me UART115200 data and I cant seem to get my Uno to function properly while it is connected to the device.

My end goal is to store the numbers I am getting into an array so I can do maths on them. I have been through all of the serial tutorials to try and work with this but I can't seem to get them to work with my setup. For instance, I have had to use SoftwareSerial due to the fact my board connects to pin 1 of the arduino and I have to change it from the TX pin to the RX pin.

Other issues:

I am getting stuck in serial.print. I run this in the main function, not looping, and I get constant input on the serial monitor.

I can not do anything else on the serial monitor, no hello world or bug check.

I can not read any of the serial data using any of the serial read commands.

Here is my code:

'// include the SoftwareSerial library so you can use its functions:
#include <SoftwareSerial.h>
//int L=3;
//char C;
//char data[2];
#define rxPin 1
#define txPin 0
// set up a new serial port
SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);

void setup() {
// define pin modes for tx, rx:
// pinMode(rxPin, INPUT);
pinMode(rxPin, INPUT);
// set the data rate for the SoftwareSerial port



void loop() {
//if(mySerial.available() > 0){


The hardware Serial port is on pins 0 and 1. Why would you use SoftwareSerial on those pins? You also can NOT run SoftwareSerial at 115200. What you need to do is get a Mega which has multiple hardware serial ports.

When you say you have to switch rx and tx... I think what you are talking about is that ALWAYS when connecting two serial devices, you must connect one RX to the other TX. When one talks (transmits on TX) the other listens (receives on RX). On a standard UNO board, Receive (RX) is 0 and Transmit (TX) is 1. You are defining them the other way around so I think you have some misunderstanding here.

You also say "serial.print. I run this in the main function, not looping". The code you posted does no such thing in the "main function" which is not only called loop, but truly is in a loop because the Arduino firmware restarts loop() every time it ends.

As blh64 already said, the Arduino hardware serial is on pins 0 and 1 (reversed from your usage) so by creating a software serial on the same pins you have radically complicated everything and have your Arduino fighting with itself.

Please be more explicit in what your problem is and provide the true code that you are using. As all old programmers like me always say: If it isn't reproducible, it is not solvable.

You can certainly connect an external serial device to the hardware serial pins of an Arduino Uno.

You will need to disconnect the device when you download code to the Arduino, and you will not be able to use the serial monitor to send data to the Arduino Rx when the sketch is running. Serial input will come from the external device.

The monitor, and the external device, will both be able to display what is sent by the program outgoing over Tx.

As said previously, you need to cross connect Tx to Rx and Rx to Tx of the Arduino and the other device.

Sorry, to clarify, the firmware on the board sends serial data over Pin 1 (TX) on the uart device, However, the pin layout was copied from arduino, so TX plugs into TX and RX plugs into RX. By chaning pinmode of pin 1 to input, it seems to allow the TX pin to receive data, My TX led flashes to show it is seeing data transfer over it and I see the correct data in the monitor.

What I meant about the serial.println is that I would expect serial.println in the main function to run only once. I realize now serial.println is not doing anything. My confusion was I am getting a constant stream of data without telling it to print.

Also this is the true code XD I am going to post an edit here in a second thats even less code :stuck_out_tongue:

I agree that using my TX pin to recieve data is a poor choice but at the moment the firmware is stuck the way it is and I do not know what the other pins are doing. I tried to free wire it instead of fully connecting over the headers but I wasnt able to get any data. Not sure if they are using other pins such as reset, scl, etc....


Ok, so I got my hands on a DUE board with a MEGA 2560 chip.

Here is the code I am running. The result of this is a constant stream of the correct data on serial monitor 115200.

void setup() {

void loop() {


My 2 short-term goals are to be able to store this data into an array and to be able to troubleshoot this data. I have tried doing things such as trying to send a string like "Hello" to the monitor in my loop but this does not do anything.

I should also mention. My uart device can be plugged directly into the computer and I can display the data on the Arduino serial monitor without having any Arduino connected to it.

Also, I apologize for my vagueness on the sensor, It is a one-off board I am testing that has no datasheet/user manual yet. :frowning:

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