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?
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.
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!
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.
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!
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!
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 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?
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?
In my original post, why didn’t I get “Hello world” showing up on my terminal?
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.
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.