RS232 Output to display on OLED 2828 Display


I have the follwoing hardware

arduino nano
rs232-tll converter
oled 2828 display

the display and nano work with my sketches where my output is hard coded in the sketch
but now I want to use dynamically generated ascii output from an external device that outputs in rs232 format

so I introduce the rs232/tll board and attaching the tx/rx to the pins indicated in the sketch below.

to test the output ( below incorporating it into the code for 2828 display) I connect the nano to the arduino Ide via and ran the serial monitor however the only output I get id -1 or else if I disconnect the rs232 feed the output is 0

Can anyone shed some light on why I am not getting the ascii data being sent to appear in the serial monitor instead it outputs -1.

Is there an issue with my code, do I need to use a different lib ???
one of your support staff commented I should be using spi.h and hardware serial ??

I welcome all advise that can be provided.

Thanks in advance

// include the SoftwareSerial library so you can use its functions:
#include <SoftwareSerial.h>

#define rxPin 9
#define txPin 8

// set up a new serial port
SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);

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

void loop()
 Serial.println("this is a test"); // making code is working

Hi Claude,

RS232 is usually UART, but RS232 doesn’t actually specify an encoding protocol - it could be you’re unlucky and have something that’s not using UART. Have a bit of a read on the wiki article:

I would suggest wrapping your read() statement in an if as per the SoftwareSerialExample: returns -1 if there’s no data available, so it could be you’re just flooding your serial monitor with -1 and missing the data.

You should also check the baud rate of your transmitting device is indeed 9600.

Your display has an SPI interface, which is why I suggested you look into SPI.h to output data to your screen.

Let us know how you get on!

Support | Core Electronics


The device sending the data ASCII data to the arduino that I want use UART compliant I have to even set uart to be active in the firmware of the device so that the device knows to send the data the tx output uart enabled

Here are 2 screen shots from the firmware manager of the device that’s sending the data

Activating uart in firmware of device sending data

Sending the data in this example 55 out via serial port

Claude Raiola
0414 228 948

Why not check to see if data is available before trying to read it with serial.available?

Refer to this link:

Full reference to the software serial library here:

1 Like

Note this from the reference: the use of delay() in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations, or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt.
So quite likely softwareserial() gets locked out by delay().
You need
if (mySerial.available())
Also I note you’ve set odd parity on the sending device. The softwareserial probably needs 8 data bits no parity.
Reading further, softwareserial relies on an interrupt on every bit in a character, any other interrupts while processing a character may corrupt the character.
void loop()
if (mySerial.available())
[I know heaps about RS232 but not much about Arduino C]