This page assumes you have identified a serial connector on the router that you want to connect to from the PC. Modern PCs will usually have only a USB port to use for serial connectivity, and the first part of the page discusses how to use this. Some PCs have a traditional, 'proper' 9-pin (or maybe even 25-pin) serial connector and the use of this is discussed later in the page.
See also port.serial for information on making use of the connection, background information on serial port characteristics, etc.
WARNING!: Some people reported they fried their router connecting the voltage pins spite it isn't neccesary. NEVER connect voltage pins when using USB adapters unless you know what are you doing. Unless you need to power the device, you don't have to connect the voltage pins. And you usually don't need to power it this way - use the router power supply.
In other words you usually only need to connect GROUND, TX and RX at a suitable level. 3.3V and 5V ports will often be happy at either of those voltages, BUT 12V may well fry things. Think before assuming a physical connection is all you need!
This section is aimed at what hardware is needed to communicate from the USB port on a PC to a device (router or similar) that has a serial connector of some kind.
TTL 5V, for example:
TTL 3.3V, for example:
You may need to rewire the terminals of the TTL cables to match your device pinout.
https://www.adafruit.com/products/70 is a great serial cable. It's used for ttl level serial. If you have to solder to the board, it's probably ttl. If there is an actual serial port, then it's 12V serial. Different device!
Its a component of many cheap USB-TTL cables available on ebay. Prolific produces the PL-2303HX/PL-2303HX.D chip in different variants at least since 2002 ( PL2303HX datasheet , PL2303HXD datasheet ). There are different designt with unattached cables, 3 pin (no 3.3V / 5V ), 4 pin (likely 3.3V ) or more pins available. Connecting 3.3V/5V is not needed and can damage the board.
These things make it simple to connect a computer (USB port) to the serial pins on the router.
Simply connect the jumper cables to the pins like this:
Please note that some USB serial adapters (The CP2102-based one in the Amazon link above, for example) have the RX and TX connectors labelled according to what you should connect them to, not what they actually do. If connecting TX → RX and RX → TX doesn't work for you, try switching to TX → TX and RX → RX.
|Caution: Do this at your own risk, since the Arduino runs at 5v and the serial sometimes is at a different voltage. Therefore, using the following technique may cause the router, Arduino, or other things, to malfunction or break. That said, this technique worked well for me during for lots of use (hours), with a Linksys E1000 v1 at 3.3v, and an Arduino Uno REV3.|
This method uses the Development board's built in USB to RS232 converter and results in 5V signals. This technique works since the Arduino Uno REV3 has a chip called the atmega16U2, which is a serial to USB converter, to talk to the computer; we use it here to talk to the router. So, other Arduinos may work.
A PC typically communicates with an Arduino such as the Uno via a USB cable that enters the board via a chip that does USB - serial conversion to allow use of the microcontroller's serial interface. The outputs from this chip connect to the RX and TX pins on the microcontroller, and are generally suitable for use with other chips that operate at similar voltages.
Note: compatible development boards include: Demulotev
By the way this method does not require any hardware modifications to the arduino.
Upload the Arduino Bare Minimum sample sketch (consisting of empty setup() and loop() functions) to the Arduino.
Remember, many devices will not need the Vcc to be connected, and connecting it when not needed may damage the router.
Then connect one end of the wires to the serial port / header and the other to the Arduino board:
The Arduino development environment is not needed; just use a regular serial terminal program using the USB Serial device that the Arduino drivers create.
If nothing is seen try switching TX and RX - it shouldn't break if reversed.
If you want to solder:
A USB based data cable for a mobile cell phone is another possibility.
Ebay clone cables:
This kind of cable is really cheap. Only some €uros on ebay, because the phones are not built any more.
The cable should be compatible to one of these Siemens cell phones:
A35 / A36 / A50 / C25 / C25 Power / C28 / C35i / C45 / M35i / M50 / ME45 / MT50 / S25 / S35i / S45 / S45i / SL42 / SL45 / SL45i
It's the well supported prolific pl2303 USB to serial converter. There are 4 lines coming from the usb part to the phone jack. You don't need the Vcc line.
This section is aimed at what hardware is needed to communicate with a router or similar OpenWrt device that has a serial connector of some kind from the serial port on a PC.
Standard RS232 levels, for example:
Legacy / proper serial ports that have the trapezium 9-pin (DB9) or 25-pin (DB25) format operate at 12V. That's lot higher than the 3.3V or 5V that a router is likely to need, and will easily cook the device!
TTL-RS-232 level conversion is a fairly common problem, so there are a number of ICs on the market that convert between these voltage levels. Maxim IC has made a few handy little ICs for us to use. The best (IMHO) is the MAX3232, which can operate at different voltages depending on the capacitors in the circuit. This guide will tell you how to solder everything together to get a pc-compatible serial port on your OpenWrt router.
First, you need an "RS232-TTL level converter chip." RS232 refers to the standard defining what plugs into your computer, and TTL is a family of chips that use 0V and 0.8V as low and 2.2V and 5V as high. They can be purchased new (the Maxim IC MAX233x line is popular). Most vendors have large minimums, but some (e.g. Mouser Electronics) sell components in small quantities.
The wiring is fairly simple, but it depends on the chip. Generally, it involves connecting Vcc from the router to the chip's Vcc pin, both router and rs-232 grounds to the ground pin, and the TX and RX wires to the chip. Remember that the router's TX will "connect" to the same level conversion bank as the computer's RX. Additionally, some of these level converters require external capacitors, while some have them built in. Much of this varies, so consult the chip's spec.
I found an easy way to get a cable working, it just require 7 components:
The image shows how to make the cable
This cost less than 2 Dolars in Chile, i hope it be the same for you! I tested it on a Zyxel 600 Series, it works!
Ensure that the DTR signal at the PC end is asserted, otherwise nothing is received from the router. For example, in the Bray terminal program click on the DTR icon to turn it green.
Another great source for RS232-TTL converters is in cell phone serial cables. Most cell phones need this same circuit to level-up for connection to a PC's serial port. Many people already have such a cable laying around, or can buy one fairly cheap. Using an existing cable is much easier than building one. If you open up the cell phone cable's serial port casing and see a MAX### chip, it's probably the cable you need. One known chip is a MAX323 (yes, 323, the original MAX232 is a 5V device and we need 3.3V here).
If you've found a good cell phone cable to use, you merely need to determine which wires are the VCC, GND, TX, and RX connections. Usually the VCC is red and the GND is black, but the other colors may vary (though blue and orange are common). There should be no need to modify the PCB embedded in the cable.
One type of the "Made in China" ones, not mentioned at http://www.nslu2-linux.org/wiki/HowTo/AddASerialPort ist the "S30880-S5601-A802-1"; its WHITE wire is data out (TX) of the DTE (PC) and conntcts to the RX of the DCE (Router); the ORANGE one is data in (RX) of the DTE (PC) and conntcts to the TX of the DCE (Router), VCC and GND are red and black. Its a 3.3V converter built with the MAX3386E chip.
You can also search for MAX232 Kits. There are some kits available.
These may be useful for connecting to a device: