Giving Kyosho iReceiver unlimited range*
A while ago I bought a version of Kyosho Blizzard, which features the new iReceiver which lets you control standard servos and ESC’s with your tablet or mobile phone. There’s also a camera fixed to Blizzard’s fuselage for streaming video. I didn’t have high expectations about the video performance but for the video the range is really poor. For controlling, the range is what you would expect for wi-fi device, about 50 m. The application however stops streaming the video as soon as it detects even a slight packet loss, which generally happens after 20 m. The thought arose, that since mobile networks are nearly ubiquitous, how about tunneling the traffic via 3g connection?
Some device is needed, which acts as a VPN server and forwards the traffic to iReceiver. I used Beagleboard-XM for this, since it has multiple
USB ports. In this case two are needed, one for wi-fi adapter and one for 3g modem. Basically any Linux-running device would work, the performance does not play a role here. These instructions are for Ubuntu distro, but others would work too with some modifications. Trying this out also does not need you to modify your Blizzard in any way, except you need to strap the parts to it somehow (There’s nice flat space at the rear end of the model body).
Setting up 3g connection
Once you have your board booting and you have ssh access to it, the first task is to make the board to connect to Internet. For this 3g modem is needed. I used Huawei E230 for this since it seems to work with Ubuntu out of the box. Install wvdial, which does the “calling” to initiate connection
apt-get install wvdial
Edit /etc/wvdial.conf and put the following lines in it. You might need to change these, depending on your carrier. Google for proper settings. Note that you also need a connection, where you get real publicly accessible IP-address. In Finland only operator to offer this is currently DNA. There also might be some limitations which ports can be accessed. I use default ports in this post to keep it simple (NB. DNA also blocks most ports, so pay attention when setting up VPN). Also the SIM PIN is disabled for the sake of simplicity.
[Dialer dna] Modem = /dev/ttyUSB0 Init = AT+CGDCONT=1,"IP","internet" Phone = *99# Stupid Mode = 1 Username = " " Password = " "
Test that the connection works by starting the connection with “wvdial dna”
Setting up dynamic host name
Since your operator issues dynamic IP address, which may change on each connection, we need to set up a dynamic host name to connect to your device. First, go and create account to one of the dynamic host services. I used DynDns. Install ddclient, which takes care of updating your IP address
apt-get install ddclient
The install process asks you about your selected service and user name, so you are all set after that.
Connecting to iReceiver
First we need to find out your iReceiver name. They should all be unique, so multiple iReceivers can be in use at the same time. Install wireless tools
apt-get install wireless-tools
Power on your iReceiver to find out it’s name
You should see something like this
Cell 05 - Address: 6C:71:D9:79:09:F8 Channel:8 Frequency:2.447 GHz (Channel 8) Quality=56/100 Signal level=56/100 Encryption key:on ESSID:"iReceiver7909F8"
Copy the ESSID and insert following lines to your /etc/network/interfaces file
auto wlan0 iface wlan0 inet dhcp wpa-ssid "iReceiver7909F8" wpa-psk "12345678"
Replace ssid with your essid. The password is always 12345678. Start the interface and check that it gets IP address from range 192.168.15.*
Setting up OpenVPN server
The VPN server is the essential part here. The Kyosho iReceiver application on your phone expects to be connected to the received via wi-fi and the receiver to be reachable at static ip-address. With VPN, we can create a tunnel to transport the data via Internet and at the same time make you phone to believe that iReceivers address is a local address, to which data can be sent directly. Generating various keys is the most laborious task and has been explained much better elsewhere, so go to this link https://help.ubuntu.com/community/OpenVPN and do the certificate and key generation for both server and client. Write following to /etc/openvpn/server.conf
# Change this if ISP blocks the default port port 1194 proto udp topology subnet # Client address range server 192.168.14.0 255.255.255.0 # Tell the client that 192.168.15.* network can be reached through VPN push "route 192.168.15.0 255.255.255.0" dev tun0 # Use correct key and certificate file names here ca ca.crt cert myservername.crt key myservername.key dh dh2048.pem ifconfig-pool-persist ipp.txt keepalive 10 600 comp-lzo persist-key persist-tun verb 3 mute 20 status openvpn-status.log client-config-dir ccd
Start the server with
service openvpn start
Setting up IP masquerading
Even though the client can now send packets to the iReceiver, not all things work. The iReceiver address is 192.168.15.2 and it issues client addresses from .3 forward. The iReceiver accepts streering packets happily from any address and you could drive around with the Blizzard, but the video would not work. The reason is that iReceiver ignores the video start packet, unless it comes from subnet 192.168.15.*. Now our VPN client gets address from 192.168.14.* subnet. To make this work, we use iptables to setup IP masquerading so that every packet going to wlan0 device appears to be originated from 192.168.15.* subnet.
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
Setting up VPN Client
On your Android device, install OpenVPN client. On client application, there’s no way to enter settings manually, so we need to create settings file. Create client.ovpn file with following text. Copy and paste your keys and certificates you generated previously. Also replace the hostname with the one you created previously.
client dev tun proto udp remote yourdyndnshostnamehere 1194 tun-mtu 1454 nobind persist-tun comp-lzo verb 3 mute 20 auth-nocache <ca> contents of .ca file here </ca> <cert> contents of .crt file here </cert> <key> client key here </key>
Trying it out
After all the steps, trying it out is just starting VPN connection and launching iReceiver app. Drop a comment if there’s a bug in instructions, or some step needs clarifying! The same idea should work with any other wlan controller also, regardless of the brand.