rs232 questions

Got DFRobot rs232 shield v0.1. Using with Arduino uno. Running this program:

#include <SoftwareSerial.h>
SoftwareSerial mySerial(10,11); //232_TX,232_RX

void setup()
{
    // Open serial communications and wait for port to open:
    Serial.begin(9600);
    while (!Serial) {
        ; // wait for serial port to connect. Needed for Leonardo only
    }
    Serial.println("Goodnight moon!");
    
    // set the data rate for the SoftwareSerial port
    mySerial.begin(9600);
    mySerial.println("Hello, world?");
}
 
void loop() // run over and over
{
    if (mySerial.available())
    Serial.write(mySerial.read());
    if (Serial.available())
    mySerial.write(Serial.read());
}

I have a terminal program running with a USB RS232 cable plugged into the shield.

Questions:
The text “Goodnight moon!” shows up on my terminal and on the Arduino serial monitor. Being a regular print function, it should show up on the serial monitor, but why does it show up on the terminal which should only be rs232?

Why doesn’t “Hello world “ show up anywhere? That is the actual RS232 data, isn’t it?

Thanks

By default that shield used pins 1/2 for TXD/RXD which are the same as for communication with Arduino serial monitor. TO work it with pins 10/11 you need to set up shield properly.

So the good news is that it is working, sending data along the RS232 cable, but I cant separate the messages to the serial terminal from RS232 data.

What do I need to do to get it set up properly for pins 10,11?

How do I get "hello world?" to show up?

thanks

jgolden:
What do I need to do to get it set up properly for pins 10,11?

A good question.

This "shield" design seems to be a bit of a disaster and the documentation is pretty useless.

According to the schematic, there is a "programming" switch that isolates the MAX3232 from pins 1 and 2 on the Arduino. Unfortunately according to the schematic, it is wired the wrong way around to facilitate connecting an alternate software serial function. The shield does not make use of the second driver pair of the MAX chip. It is overall, a particularly clumsy and poor design.

alesam:
To work it with pins 10/11 you need to set up shield properly.

"set up shield properly" Riiight! :astonished:

If you are careful, you could identify the pins on the MAX chip to connect to pins 10 and 11 by soldering insulated jumper wire and make sure the switch was always in the "programming" position to disconnect pins 0 and 1. But with the limited information given in those references, I cannot readily explain the exact details.

So much for plug and play....

Am I the only one that has this shield? Someone must have gotten this shield to work.

It sounds like you are suggesting to find the rx and tx pins on the chip and solder a jumper to 10/11? I can do that if that's what it takes.

What rs232 shield do you recommend that's not rubbish? I'd like to also do data logging at the same time.

thanks

jgolden:
Am I the only one that has this shield? Someone must have gotten this shield to work.

It works just fine as long as you use the first hardware serial. :roll_eyes: And don't want handshake.

jgolden:
It sounds like you are suggesting to find the rx and tx pins on the chip and solder a jumper to 10/11? I can do that if that's what it takes.

Yep.

jgolden:
What rs232 shield do you recommend that's not rubbish? I'd like to also do data logging at the same time.

Don't know. I have no particular use for RS-232 just now. :astonished:

It seems this board has the rx and tx pins connected to some jumpers. When I connect rx to digital 10 and tx to 11, the serial monitor prints ok, but the terminal is jibberish along with the correct goodnight moon characters. Then when I connect rx to digital 11 and tx to 10, the rx & tx LEDs light up, and the serial monitor keeps moving (probably because of the loop) and the terminal prints a different jibberish along with correct characters. Any thoughts?

jgolden:
It seems this board has the rx and tx pins connected to some jumpers. When I connect rx to digital 10 and tx to 11, the serial monitor prints ok, but the terminal is jibberish along with the correct goodnight moon characters. Then when I connect rx to digital 11 and tx to 10, the rx & tx LEDs light up, and the serial monitor keeps moving (probably because of the loop) and the terminal prints a different jibberish along with correct characters. Any thoughts?

Why are you guessing? ? ?

The link to the schematic is on the DFRobot webpage for this shield!

.

Buy a Leonardo. That will give you separate USB Serial and hardware Serial on pins 0 and 1.

Or hack the shield. That may be the better option.

jgolden:
It seems this board has the rx and tx pins connected to some jumpers. When I connect rx to digital 10 and tx to 11, the serial monitor prints ok, but the terminal is jibberish along with the correct goodnight moon characters. Then when I connect rx to digital 11 and tx to 10, the rx & tx LEDs light up, and the serial monitor keeps moving (probably because of the loop) and the terminal prints a different jibberish along with correct characters. Any thoughts?

I hope you are not referring to the pins labeled 232TXD and 232RXD (as well as a VCC and GND) located between the LEDs and the MAX3232 chip. Those are RS232 level signals, DO NOT connect those to any pins on an arduino.

What you can do is remove the shield from your Uno and then bend the male pins on the bottom of the shield that connect to pins 0 and 1 on the Uno out a little so that when you put the shield back on the Uno, those pins don't go into the Uno's headers. Then use jumper wires to connect those pins on the shield to the pins you want to use for software serial.

pert:
What you can do is remove the shield from your Uno and then bend the male pins on the bottom of the shield that connect to pins 0 and 1 on the UNO out a little so that when you put the shield back on the Uno, those pins don't go into the UNO's headers.

Now that is definitely hacking! :sunglasses:

ieee488:
Why are you guessing? ? ?
The link to the schematic is on the DFRobot webpage for this shield!

I gave the link to the schematic before. Inconveniently, it is a pdf rather than a direct graphic (otherwise I would have embedded it).

I’m confused now.

  1. I was told to connect rx and tx from the chip to pins 10 & 11. The breakout pins labeled 232TXD and 232RXD are connected to the chip. But David2018 says never do that. Who is right?

  2. If I bend the pins 1 & 2 out, will I still have data on the RS232 connector? Or is there more hacking to do to get the data through the cable?

  3. In my original post, why didn’t I get “Hello world” showing up on my terminal?

Thanks,

RS232 uses relatively high voltage. Plus and minus 12V. That can damage the Arduino.

I just looked at the SHIELD SCHEMATIC...
That has to be the silliest design I've ever seen to underutilise the parts, introduce limitations, and confuse beginners!

lastchancename:
I just looked at the SHIELD SCHEMATIC...
That has to be the silliest design I've ever seen to underutilise the parts, introduce limitations, and confuse beginners!

It is a rather odd design. As was pointed out earlier, the switch could have been wired the other way around, to allow for selecting different input lines, instead of just disconnecting the RX/TX lines from the MAX3232. The header with the RS232 level signals that already go to the DB9 connector seems kind of pointless, although it does make for an easy loopback test by using a shorting jumper.

Seems like an overly complicated version of the MAX3232 board with DB9 connector that you can get fairly cheaply from any of a number of online sellers.

lastchancename:
That has to be the silliest design I've ever seen to underutilise the parts, introduce limitations, and confuse beginners!

My thoughts entirely in #3. :grinning:

jgolden:
2) If I bend the pins 1 & 2 out, will I still have data on the RS232 connector? Or is there more hacking to do to get the data through the cable?

It's not clear to me what you're asking. First of all, note that the pins are 0 and 1, NOT 1 and 2. Looking at a picture of the shield, I see they're actually marked RXD and TXD. The only thing that bending those pins will do is break the connection between the shield and pins 0 and 1 on your Uno.

Here are some more detailed instructions, assuming you want to use pins 10 and 11 as your sketch was written:

  • Remove the shield from the Uno.
  • Bend pins RXD and TXD on the shield.
  • Put the shield back on the Uno, making sure that pins RXD and TXD do not go into the holes on the Uno. Make sure the shield is plugged into the Uno enough so that you are definitely getting a good connection.
  • Using a male to male jumper wire, connect the header pin marked RXD (not the one marked 232RXD) on the shield to the header pin marked 10 on the shield.
  • Using a male to male jumper wire, connect the header pin marked TXD (not the one marked 232TXD) on the shield to the header pin marked 11 on the shield.
  • Set the switch on the shield to the "ON" position.

jgolden:
3) In my original post, why didn’t I get “Hello world” showing up on my terminal?

Because the sketch only prints "Hello world?" to the software serial port on pins 10 and 11, but the shield doesn't connect those pins to the MAX3232 chip on the shield.