Wersja polska
Putting everything together:

I previous "parts" [connect41, connect 42 - for now a bit outdated and in Polish only (I have written new firmware (source, defines) for the board - 50reports/sec, 9600bps connection, external X-tal 11.059MHz!)], we have seen how to connect USB relay card to a router (with USB).

[if we want to connect it to a PC with Linux, we "just" have to plug it into a free/hub port, and it works.]
It appears as (next) /dev/ttyUSB* port.

Simple connection

Simple installation schematic

Now it is time, to control it somehow friendly way, as "normal user" will NOT want to enter "cryptic" "telnet xx.yy.x.t 3000 a b E D" etc...

But there is (on PC's and routers - OpenWRT) program anyRemote [http://anyremote.sourceforge.net] written by Mikhail Fedotov (anyremote@gmail.ru).

It is composed of two parts: "server" runs on PC (or router), and "client" on TELEPHONE with Java / Android (much better option...).

Security question is still important: TELNET / (raw) protocol used to share control over card over network is NOT secure, there is NO authorization of any kind. (with anyRemote 6.2 there is a
bit of security - allowing to control program only from restricted IP addresses).
But in *properly configured* (routers, switches - if L3 / VLAN) LAN(!) network, we could assume, that it is only "US" who can access router sharing the card.

 If we want to have SECURE (but slow, ca 1-1.5sec / op vs 0.1sec), then INSTEAD of running ser2net we will use possibility to run remote scripts over ssh.
Scripts TRY to run "direct", and falls back to ssh, if unsuccessful.


- anyRemote (4.7.1 for OpenWRT), (4.7.1, 6.0 / 6.1 (git)) for PC,
- BlueZ (-libs, -utils), and it's dependencies - if we want control over Bluetooth ,
- scripts (lights*.sh),
- bash (if relay card is connected remotely),

For a fast (LAN, should be -+0.1sec) connection of relay card with the rest of installation, we need to change it's firmware (or buy already reprogrammed card). It is not hard, but requires ISP programmer for AVR processors, possibly AVR910 ("kit" sold in Poland - 18USD+shipment, in Nord Electronic). Link to firmware (and source) at the top of page.


on a PC with Linux, we simply install package anyRemote, using tools provided by "THE" distribution.

Now we look for anyRemote.cfg file (~/.anyRemote/anyRemote.cfg - PC, /etc/anyremote.cfg - OpenWRT), and we edit this to our needs.
 I(!) will describe, how to configure anyRemote in a quite advanced/complex scenario (but this works for me):

- anyRemote on "server" TP-LINK MR-3220 (router, xDSL, USB), card connected to another router (Edimax, BR-6104KP, xDSL, 2x USB 1.1), connected over WiFi(WDS) using AP Edimax 7106APg and Asus WL-500Gp).
- control from an Android phone (SE Xperia X8, Android 2.1).

Advanced installation schematic

Advanced installation schematic

AnyRemote program on PC we should start as "ordinary" (non root) user. On router, as there is no users other than root - as root.


- for routers with OpenWRT for which flash size (8MB+) ALLOWS installing anyRemote as PACKAGE, (ex Asus WL-500GP), and eventually BASH (remote USB port), we should install it this way.
- for the MR-3220 I have prepared a firmware, packages, config, "hand crafted", OpentWRT trunk 33310. It took all the flash (4MB!), with an internet radio (madplay + wget + usbaudio). [LINK!] We have to configure ssh connection router "server" to router "USB card" using keys. (not passwords). If we want to remotely shut down PC (or awake it - needed LAN card with WoL and WoL on router - sorry, no space for int in "my" firmware). root(router) -> PC "user who can issue shutdown" (it is nut in my case + sudoers, as I use nut software for managing UPS).

INSTALLATION (PC/router, scripts):
- download and install in /usr/bin/ scripts lights_*.sh. We should customize scripts to our(!) system (adresses, port names!). If USB relay board is connected DIRECTLY, the on "server" we should install "Edimax" scripts. If it is connected remotely, then we should install "TP-LINK" scripts, (and on Edimax / other router with USB "Edimax" scripts).

ATTACH SCRIPTS lights*.sh from Edimax and TP-LINK!
"Edimax" scripts - control over LOCALLY connected USB relay card:

"TP-LINK" scripts - control over REMOTELY (using ser2net on remote device) connected relay card:

INSTALLATION (anyRemote.cfg):

- download and install anyRemote.cfg file (or edimax-usb.cfg, on PC). Adjust to your(!) configuration (remote / local relay board).


as there is (was?) problem with loading icons on Android, there is a workaround:
- copy files lights_bulb_*.png to /sdcard/Android/data/anyremote.client.android/files/ on Android phone. [should be corrected in 6.1 version of AnyRemote, but it is not a priority task].

Now, we should modify (if needed) startup scripts (/etc/init.d/anyremote on OpenWRT, /etc/rc.d/init.d/anyremote on Fedora, etc), to start anyremote program with correct version of *.cfg file, and to listen on LAN (or Bluetooth). Especially we change "service_stop" to "killall anyremote".

ATTENTION: on MR-3220 DO NOT use -log option : in 4.7 and 6.0 it logs ALWAYS to ~/.anyremote/anyRemote.log, which is located on almost full FLASH.
ATTENTION: as (for me) on TP-LINK Bluetooth does NOT work (with USB sound card, more important to me), the instruction below are for Wi-Fi connection. "Suspect" is cheap USB hub, to be checked.


Start anyRemote on telephone, use menu key, then tap "Enter IP address", input (our) 'server" address and port 5000, if our server is already running, there should appear "telephone" keyboard with bulbs icons, in states they were when connected. Tapping on bulb icon will change state of it (and relay output) to opposite. Icon with 2 arrows - radio restart (on my device it is "hard" configured to my favorite station - RMF'80s). Down arrow icon: shutdown of PC (if correct address in script, and ssh + sudoers configured (above) on PC. "Stop" icon - disconnect from "server".

Links / files summary
Card firmware
9600bps, OLD card, using ATTiny2313,
"a-h" to switch on, "A-H" for off
Card firmware source
makefile an others from "demo" of AVR-libc
TP-LINK firmware

TP-LINK firmware .config file
DON'T use "make menuconfig" on this files on this file,
it will add *_tables again
TP-LINK changed files tarball
security information stripped!
Edimax firmware
to be flashed over serial!
Edimax firmware .config

Edimax changes files tarball
security information stripped!
Android software
anyRemote client
some 6.x GIT version, that work for me (Android v.2.1)


- anyRemote software (client+server) - anyremote@gmail.ru (Mikhail Fedotov),
- other questions - laurentp@wp.pl (Wawrzyniec Piotrzkowski).