Hi All
I am just trying to confirm the wiring to use the additional serial ports on the Mega 2560. I would like to wire a DB9 plug onto my arduino Mega Serial1 Port
Some searching on-line has lead me to think that this is what I need:
DB9Pin 2Pin 3Pin 5
ArduinoPin 19Pin 18GND
UseRX1TX1Ground
Can anyone confirm that that is correct? I am heading out to go find a cable/plug today.
Cheers
stephen
The connection to DB-9 pins 2 and 3 depends on the device plugged into the other end of the cable, that is if it's wired as a DTE or DCE device. Also DB-9 are often plugged into true RS-232 devices and the voltage levels used +/- 3-15vdc can destroy the mega pins from either over voltage or negative voltage. So a definitive answers needs further information.
You have the right three pins, and pin 5 is right.
Billy's Law of Serial Comms says, no matter how much you try to work it out in advance, you have a 50% chance of getting RxD and TxD the right way round.
Normally, TxD from the PC is pin 3, and must be connected, via an inverting level shifter, to RxD on the target board. So it looks to me like you've got pins 2&3 reversed. But by Billy's Law, I only have a 50% chance of being right!
I take it you have a suitable inverting transceiver, like a MAX232 chip between Arduino and PC, yes? The Arduino signals are all 0V-5V logic signals. RS232 from a PC is ±9V (or something in that region). Without a transceiver, it won't work at all.
If you're sure you have a good ±9V transceiver installed, then:
EITHER:
hook it up like that, if it doesn't work swap 2&3;
OR
With the DB9 not plugged into the PC, use a DVM to check that whichever of pin 2 or 3 is -ve (between -3V and -15V) on the PC, THE OTHER PIN is -ve on the DB9 cable end. If both -ve pins are the same pin number, swap 2&3.
Thanks for all the feedback. This is for an assignment, and the RS232 comm is between two units. if the comms aren't to a PC, will i still require a inverting transceiver?
Would something like (Pololu 23201as Australia | Little Bird Australia) be suitable?
Yes, that looks suitable.
The pin connections you listed are for the connector on the back of the PC, which has male pins. The Pololu board has a female connector and appears suitable for connecting to such a PC serial port, either directly or with a 1-to-1 wired serial extension cable with a male at one end and female at the other. In that case, this adapter will have pins 2&3 swapped from your pinout in the OP, (Billy's Law notwithstanding).
slpefanis:
Thanks for all the feedback. This is for an assignment, and the RS232 comm is between two units. if the comms aren't to a PC, will i still require a inverting transceiver?
Would something like (http://littlebirdelectronics.com.au/products/pololu-23201a-serial-adapter-fully-assembled) be suitable?
Your first post shows wiring to arduino pins, so how can this be comms between two RS-232 units? Again if you want a accurate answer you need to provide more details about the specific type of 'units' to be wired together.
The module you linked is a good RS-232 to TTL serial converter and may be part of your needed solution.
how can this be comms between two RS-232 units?
Presumably he's trying to make the Arduino one of the RS232 units. 