Description
Adding serial communication on existing micro USB power connector on a TP-link WR703N running OpenWRT.
WR703N: Low cost, looks good and runs Linux (you should get one : )
Development
A friend recently bought me a TP-Link WR703N in China for just 98RMB (that is 15$ or 12 €)!!! It is really an incredible piece of hardware including a 400MHz ARM (Atheros AR7240), Ethernet connector, 802.11 b/g/n wlan, USB port, 4MB flash and 32MB RAM. You even get a power adaptor and the device consumes just 0.5W. When it runs Linux (OpenWRT) I personally think that it is as or even more attractive than the 25$ raspberry PI. The only thing missing is access to the on board serial interface which I wanted to solve. Instead of adding a new connector to the case I simply used two of the available lines in the micro USB connector (used as the power connector for the router). This means that I can access Tx and Rx, GND and 5V thru the included USB cable. On the router there are two small copper colored test pads next to the ram (on the opposite side of the Ethernet connector). They are labeled TP_IN and TP_OUT. I connected the wires to the decoupling caps C55 and C57 next to the pads, since they were already tinned.
Thin enameled wires were soldered to connect the USB with the tx/rx pads.
I have already started to build a small PCB with a microprocessor, a mini USB connector for power (using the routers power adaptor with a standard USB mini cable) and a USB typeA female that provides power and serial connection to the router. The board has a lot of available I/O, an IR receiver and debug led’s. This board can be used to connect almost anything to the web. I think I will start with a 433MHz radio interface to control the lights at home.
BTW, the router is quite difficult to open. If you trim away a small part of the snaps, taking it apart is a lot easier next time.
Very nice, except you somehow forget to tell exactly where the serial lines are available on the router PCB. I have looked at a photo showing the whole board, but I fail to find any obvious location for it. Would you mind telling where you found it?
Hi Nick
Good point, I agree that it is a bit difficult to see on the first photo…
You will find two small copper colored test pads next to the ram (on the opposite side of the Ethernet connector). They are labeled TP_IN and TP_OUT. I connected the wires to the decoupling caps C55 and C57 instead, since they were already tinned.
God luck and thanks for the comment!
Hi Johan,
thank you for the nice hint with the micro usb connector. I connected TP Out to pin 2 and TP In to pin 3. I’m not sure if this is correct because I cannot find a serial device on my laptop.
It would be nice if you can provide some more details. If it’s working it might be the best solution to get serial access to this tiny box.
Best Regards
Chris
Hi Chris
Adding the serial connection to the available USB pins in the power connector, doesn’t make it an USB device. It is still a serial connection. The advantage is that you get access to the serial connection without adding an extra connector (and cut hole in the router). To communicate to a pc, you need a serial to USB adapter; you can buy one or build one using a FTDI chip or reuse an old SEMC dock like this.
Please note that the serial connection on the router uses TTL-levels (5V signals), it is not RS-232 (12V signals) and you can’t use an USB to RS-232 adapter without limiting the signals.
Hi there just wanted to give you a quick heads up. The words in your post seem to be running off the screen in Ie. I’m not sure if this is a format issue or something to do with internet browser compatibility but I thought I’d post to let you know. The design and style look great though! Hope you get the problem fixed soon. Many thanks
Thanks for the tip. However I have not been able to recreate the problem you are mentioning in any of the web browsers I have tried. If you tell me which version of IE are you using and on what platform, I will see if I can fix it!
Johan von Konow, could you perhaps add some additional pictures of how you wired this up? It took me a bit to realize how awesome it is that you run the micro USB port as the serial out by wiring it in. I bricked my TL-WR703N and I’m working in getting console access and this is just what I need! I’m going to link this to Reddit’s in a couple of places because of the sheer genius of your idea.
Hi
I have added two pictures to show how tx/rx is connected to the USB port. It is still a bit difficult to see – tp_in is connected to pin 3 (from the left) on the usb port and tp_out to pin 4.
/j
Can I use your method to unbrick my wr703n?
Yes (hopefully). I bricked my router once during the process. I was able to restore the file system using a terminal connected to the serial lines.
/j
Hi, how do you plan to program PIC16F628 ? Isn’t it much easier to use some of small atmel (arduino) chips? Why did you opt for PIC16F628? Atmega chips are also really cheap… any other reason beside the price?
Well, it’s a matter of taste, price, specification and what I have at home at the given time. Today I use both atmel and pic. The pic generally offers better value for money (especially if you write assembler). Atmega – with an Arduino boot loader is great for simple programs in C (however debugging is lacking). In this project pic16f628 was selected, mostly since I had working code handling serial, IR and RF communication. The pic can be programmed in several ways, the pickit icd programmer is a good start (also working as a simple serial and logic analyzer), but if you are a pro, the ICD is a lot faster.
If you do this, beware! The power adapter shorts the D+ and D- pins of the USB cable (as it should, to indicate that it is a charger capable of delivering at least 1A), these are the pins we just soldered the serial connections to. So if we use the original adapter now, everything the router says on its serial port (also boot and kernel messages) will loop back into its input, possibly doing awful things to the router (mine messed up the kernel and nothing but a firstboot could make it work again). I configured my WR703N over its serial port, then plugged it in the outlet, and waited for eternities because it wouldn’t finish booting. On further investigation I found out that it dies with a kernel panic, even when I used the serial port cable again. Flash a different OpenWRT image, rinse, repeat. I spent a whole day doing this before figuring this out.
Thank you for the warning!
Yes it is important that you connect the cables right. Use a different connector (pinheader, D-sub or 3,5mm plug) if you don’t want to temper with the board. If you shorten the serial signals you risk damaging the drivers used in the serial interface (I guess you were lucky that it still works). I power the router thru the PIC board using a mini usb cable (then there is no risk in mixing up the different cables)
/j
Its a nice approach. I want to know if I would be able to connect to the serial port of this router using visual basic’c winsock?
I want to make a project in which I want to communicate a microcontroller to a computer through this router using visual basic.
And what will be port address of the new added serial port???? like port address of Ethernet port is 8080
That really depends on how you configure Linux. I did not make a bridge like you described; instead I used the web server to access cgi-scripts, sending commands to the serial port. See more details here:
http://vonkonow.com/wordpress/2011/12/serial-communication-on-a-router/#comments
I’m not a Linux wizard, but I guess that it is quite easy to pipe one port to another, for instance 8080 to ttyATH0…
/j