Smart home automation webserver on OpenWRT router WR703N interfaced to Arduino, compared to Raspberry Pi and Ubuntu

Picture of Smart home automation webserver on OpenWRT router WR703N interfaced to Arduino, compared to Raspberry Pi and Ubuntu
usb HDD.png
05 mjpg-streamer webserver.jpg
WR703N GPIO.png
03 serial port connection wires.JPG
03 serial connecting CP2102 module.jpg
10 temperature webserver.png
52 mouse as motion detector.JPG
60  Arduino read temperature.png
svg gauges.png
Download the WR703N Digest (340MB zip file):


Dear Reader,

there are many Linux boards on the market: Bifferboard, NanosG20, Foxboard, Beagleboard,  AlixPC, Android phones and tablets, routers, netbooks, and most recently the Raspberry Pi. How to decide what to choose?


So far the nicest solution I have found is one of the world’s smallest pocket routers TP Link WR703N.
Cheapest in price 25 USD, nice looking 5x5x2 cm plastic box, internal Wifi. Can be ordered on Ebay, shipping is free and it arrives from HongKong in a month.  This router has a 400 MHz CPU, 4 MB flash (quite small),  32 MB RAM, 1 Ethernet, Wifi, 1 USB, 0.5 W power consumption. Powered via USB cable. Included power supply can be plugged in 110V or 220V.

It must be reflashed with OpenWRT Linux, where most necessary program modules exist, however not everything is compatible with Debian Linux. Can add USB hub, USB stick, USB HDD, USB sound card, bluetooth, webcam, 3G modem, 1-wire USB or serial module, connect to Arduino, set up Wifi client, place home webserver with php and rrdtool database on router. Live examples are here:

Home webserver:
Wifi HD webcam
Electricity meter readout:

Limitations are that internal flash 8 MB is quite small, but can be extended using external USB flash stick or HDD. Compiling C code is not possible directly on router. Need to cross compile and then is a chance that executable might not work. All small-scale hardware has some bugs. Not all things work as supposed, for example, Wifi client configuration does not work using Luci configuration interface, need to manually edit config files. Usually need to spend one day to work around some particular bug.  Experience also that router's flash gets a fatal error in 3 months, if saving is done once in 5 min. If  need to save frequently should save into RAM or USB HDD and only once and while backup on flash. OpenWRT trunk changes every day and often new bugs appear. So I have made a backup of somewhat older, but stable version
Actually now the version Attitude Adjustment Beta 12.09 on openwrt site is OK and looks like it is permanent.

Digest zip file (340 MB) holds information about setting up different functions on WR703N:

00 Introduction links
01 Flashing OpenWRT, vi, nano
02  Open WR703N cover & solder serial RX TX CP2102
02 Network
02 USB Hub
03 USB flash, HDD, system overlay
04 curl, lftp, samba, bittorrent transmission, NAS, Dropbox, Twitter
04 uhttpd and lighttpd webserer with  php5
05 webcam, video
06 Bluetooth
06 mouse, keyboard, PIR, photodiode
06 sound card
07 GPIO, hardware schematics, 1wire,  i2c, SPI
08 Digitemp 1wire temperature with CP2102
09 DS9490R 1wire bus adapter
10  Arduino
11 Graphing dataplots Pachube, rrdtool, Google charts, Sarmalink
12 Gmail control of USB relay board
13 sending email
14 compile your own OpenWRT distribution
15 compile C program module
16 Python install on USB HDD
17 Lua programming language for Luci
18 uci
20 Robotics WiFi remote controlled car
70 nice Webpage designs
80 example WR703N setups
90 smart home, alarms, baby monitor
91 Long term reliability
92 LinkDuino customization by Squonk
93 mr3020 similar to wr703n


Raspbery Pi
Much advertisized in press as the cheapest, but it is a circuit board only, needs power supply, HDMI and network cables, SD card, enclosure, WiFi, keyboard, mouse.  So together it is ca 80 EUR.


Experience is that Arduino is best in reliability. It never hangs. With Ethernet shield can make IP-controlled power outlet for your home server remote reboot.  I have written also Instructable about Arduino AVR webserver. Arduno can be interfaced to WR703N router via USB. Can process analog inputs, 1-wire temperature sensors, control switches, servo motors, and a small display. However serial communication between Arduino and router hangs after some unregular time. Hanging happens only if Arduino reset is disabled. Solution might be to enable reset and write some values that should not be lost into EEPROM. Please have a look at my summarised Instructable about Arduino:


Ubuntu Netbook
For example eeePC with Ubuntu, 13W consumption.  HDD is faster than flash, runs for 1 year on heavy load. Best compatibility, reliability, speed. Also monitor and keyboard. WiFi client works out of the box. But wifi sometimes hangs. And eeePC does not power up without manually pressing a button. So someone has to be present at home and can not do remote reset via GSM box.
eeePC has no boot rom function to restart power, need to press a button. So actually best solution if electricity use if not concerned  would be a desktop PC.
Another recommendation running reliably  is Beagleboard or Beaglebone with USB HDD.


Android phone
High quality Webcam, mic, speaker, Wifi, GSM, battery, keyboard, display, temprature sensor, large flash, fast CPU.
Can get for ca 60 EUR for Example Samsun i5500.
Disadvantage  - Android SDK programming complicated. Option is to install Ubnuntu in a loop drive on sd,
but Ubuntu cannot access camera or sensors.


Use Linux boards only for applications where low power consumption or space is needed. Every Linux board has some compatibility issues and bugs as it is not mass produced and be prepared to spend days for customization.

janisalnis (author) 7 months ago
I have not managed to merge video and sound.
So I used just sound. There was a problem
You can find notes about sound in folder:

Digest WR703Nsetup / 06 USB sound / ffmpeg ffserver microphone and streaming

I also had used another programm called listener.
in the folder
_listener detects sound and saves
It records sound when it becomes loud in the room.
janisalnis (author) 2 years ago
Baby monitor problem solved!!!
Learned how to stream audio from USB sound card or webcam microphone using ffserver. Also can record sound when something happens using package called listener.

Hi! Really great stuff all ovet there, thanks for that.

Can you be more specific about the ffserver? How to config it? I'm really interested in it, thank you!

janisalnis (author)  Kyck-Off1 year ago
Please find notes about seting up ffserver inside the 340 MB zip file directory
/06 USB sound/ffmpeg ffserver microphone sound streaming/ffmpeg ffstreamer.txt

Hello and thanks for your hard work.

Have you managed to make a workaround regarding the ffmpeg video + audio?

In other words whats the best setup for a baby monitor?

I had success using mjpeg_streamer but it doesn't support audio, and combine ffmpeg video and mjpeg_streamer isn't the best approach...

Thanks in advanced!

Thank you! I tried DarkIce+Icecast and the best result I got was about 5-10 seconds delay which is terrible for me... I read that ffserver is the same...

What is the best way? Can I somehow stream raw pcm and play it on the other side?

cgrrty9 months ago

Thank you ! it is very useful.

janisalnis (author) 1 year ago
my experinc was that ffserver has zero delay in the beginning, but delay increases with time. So I reloaded the webpage after few minutes.
Shanu1372 years ago
Hey man lot of eforrts... like so o much... Seems you are expert in this field...
How would you compare the avr board that you used and in the link below.
this guy also seems working for long time
janisalnis (author)  Shanu1372 years ago
I start to have a feeling that budget priced Android phones like Samsung i5500 (60 EUR on Ebay) are the best as they already include camera, mic, speaker, keyboard screen, wifi, battery, large memory, fast processor. sensors. But programming is quite tricky, so easiest is to wait untill someone writes an app that suits you.
With regard to Android - have scripting API sl4a + Lua. Oche rich API gives access to all equipment on the familiar and beloved Lua.
miralp2 years ago
Hello, it's a very nice project.
I have also bought a TPLink 703 and would like to use it as a gateway to arduino.
I've already flashed OpenWRT, it's working Okay.
Now I need to forward TCP/IP sockets to serial (USB CDC) stream.

Unfortunately the dropbox link doesn't work now, too much trafic.
Could somebody reupload the files to the net ?
janisalnis (author) 2 years ago
webradio inside Wr703N. Amazing! Lots of work. Might be easier to use a smartphone.
janisalnis (author) 2 years ago
Successfuly tested aircrack-ng on wr703n.

WR703n main chip datasheet is now available
kcho2 years ago
You can play mp3 files from a directory on a USB flash drive connected to wr703n with madplay? .I could make a page similar to the OWWRS and choose which mp3 to play ?

DE8MSH2 years ago
If anyone is interested: this is what I did with madplay.

A simple script that kills madplay process and than starts a new one.
DE8MSH2 years ago
Hi Janis,

thank you very much for this nice instructable. With your brilliant draft I did this:

I did a local net web service, too:

kcho DE8MSH2 years ago
I have tried to install your OWWRS in my wr703n without success.
I copied the project folder www to www directory of the router and the initial page run,the weather page run, the web radio server page does not work.
With the help of Janis I have running. madplay .I test wget -O - | madplay - & and work from command line ,but not from OWWRS.
Could you give me some help on what I wrong?
janisalnis (author)  kcho2 years ago
Webradio is actually made as simple web links to files in cgi-bin that start madplay with one particular internet radio station using shell script.
You need to check if files in /www/cgi-bin/ can be executed. For example /www/cgi-bin/80sonly from command line. May be need to chmod 777 them.
Do you see result of echo "wait..." line when running it through webbrowser? cgi-bin directory should be already there when you install uhttpd (or luci, but luci uses much more space).
kcho janisalnis2 years ago
Many Thanks, work OK !!!!!
kcho2 years ago
Work ok !
I must install madplay every time I lose the energy of wr703n?
Is there any script that can perform this task automatically?
Thanks for your help
janisalnis (author)  kcho2 years ago
Thanks for feedback. It gives motivation to improve Instructable.
choose "-dest ram" only if you have not enough flash space.
Need to install every time router starts. Can put the installation lines in file /etc/rc.local before exit 0.

kcho2 years ago
Hi Janis,
Great job!
I tried to install the usb sound card in my WR703n following your instructions but I get an error with madplay . I get the error " madplay: can't load library '' when I try to play an mp3 or a webradio.Looks like a missing or lost library
Any help ? Thanks
janisalnis (author)  kcho2 years ago
opkg install zlib
rajusaleem2 years ago
Would this router be used for this purpose instead of router WR703N ? any suggestion or link
janisalnis (author)  rajusaleem2 years ago
here list of supported
rajusaleem2 years ago
Dear can you plz tell how to connect arduino UNO to wireless router directly wothout ethernet shield?.i can not find any USB compatable port or any other in the router. I have already Any link or suggestion? Sorry i am new to wifi field. thanks
janisalnis (author)  rajusaleem2 years ago
To connect Arduino Uno to router via USB you need
opkg install kmod-usb-serial coreutils-stty kmod-usb-acm
ls /dev/ttyACM0

More in the Dropbox Arduino folder:
rajusaleem2 years ago
can we use just flash drive insted of HDD ? what would be the consequences ?
janisalnis (author)  rajusaleem2 years ago
No experience yet with SDD.
cyjbox2 years ago
can not install the "python" package in "" ,MD5 check error
janisalnis (author) 2 years ago
on Aug 19 Hoolahoous wrote:
"You have awesome instructables ! I recently created a wifi controlled switch for my garage door using Fonera routers (as here ).
Now all of my friends want one ! However it is difficult to find fonera nowadays. So when I saw your post about wr703n, I really got excited.

If you can make an easy instructable to just access the GPIO pins (on which resistors to take off and where to solder the wires) on wr703n, that will be awesome. This is info that will be helpful..

1) how many gpio pins are accessible on this router
I use 2 GPIOs soldered to R15 and R17. Using other GPIOs like reset button, blue LED and RX TX lines interfere with system.

2) physical locations of those pins
See Word file in Dropbox folder about GPIOs.

3) if any mod (removing resisters) is required
I think resistors can stay for most applications. Resistors need to be removed for i2c and 1-wire bus applications.

4) packages needed to be loaded to get gpio working
See txt file in Dropbox GPIO folder.

janisalnis (author) 3 years ago
Something went wrong with IP, no more connection?
You could try failsafe approach? Cycle power, press reset as soon as the blue led starts to flash. It should start to flash double-quick, and you should be able to telnet into and run "firstboot", reboot, powercycle, telnet in again, set password and configure.
My god - I thought I had bricked it and was in full on panic mode. I just registered a user just so I could come on here and thank you for this. its 20 to 3 AM and I can finally go to bed.

Thanks for the page, and especially thanks for helping me resurrect it!
you could also run mount_root and undo your latest (wrong) change :)
robthebrew2 years ago
This is a great collection! A few add on notes: using attitude adjustment build (as of today), w1 complains, but if you force install GPIOs 0,7, 14, (most likely 15, but I broke it) and 29 work as w1 pins. 9 and 10 (the serial port) would most likely work too if you unload serial support (not going to do that until I have a stable system).
ddoss2 years ago
This is pretty neat, I will try it out I have seen a few places with cheap WR703A's locally .