We spent some time in the last weeks to test how the RikoMagic MK802 is working under Linux in small embedded applications. We present here a short summary of its advantages and disadvantages for this kind of applications, as well as some pieces of advice and tricks if you want to try using it yourself.
Summary of the MK802 tests
Our expertise is based mainly on three specific projects using one or more MK802:
1. A home automation application to control a blind from an iPhone, through a WiFi network in infrastructure mode. The whole project is based on a Yocto-MaxiRelay.
Home automation application using an iPhone, a MK802, and a relay
2. A firework launching application controlled with an iPod, through a WiFi network in ad-hoc mode. This application is also based on a Yocto-MaxiRelay.
Launching a firework rocket using an iPod, a MK802, and a relay
3. An Internet and SMS monitoring/notification application, with two MK802 connected through a WiFi network in infrastructure mode. This application uses a Yocto-PowerRelay and a Yocto-Knob.
Internet and SMS notification application with two MK802, a contact input, and a relay output
For the three applications, we have used a Linux ARM image, more precisely the "Lubuntu" distribution for ARM. We opted for a Linux image rather to use the provided Android image because our libraries do not (yet) work under Android.
Using a Linux image for the MK802 is very easy. You only need to put the image as is on a 8GB Micro-SD card, and the small PC starts under Linux.
The first unavoidable step is to connect the WiFi network to an access point with Internet, to be able to add the complementary modules and options which you need. Configuration is easily performed with the help of graphically intuitive tools. The only problem: The MK802 WiFi module is, to say the least, capricious, and the WiFi connection is rather unstable. To maximize your chances, perform this operation as close as possible to your WiFi access point.
Installing additional packages is very easy with the usual Linux tools. More and more retailers (including Yoctopuce) provide their software in an ARM version which is then usable as is on this machine.
The USB Host mode functions perfectly with the Yoctopuce modules, even when they are behind a USB hub.
For the first two applications, we simply configured the machine, installed a VirtualHub which is launched automatically at startup. The VirtualHub provides access to the Yoctopuce modules connected to the MK802 from any point on the network. It enables you to control them from an iPhone, an iPod, or an iPad, for example.
For the third application, we ran, on top of the rest, a PHP program performing an autonomous monitoring, and posting updates on an Internet server through HTTP requests. It is even possible to send SMS notifications through an HTTP service such as bugdgetsms.net.
The standard PHP interpreter of the Lubuntu distribution for ARM functions without any problem.
The MK802 processor is sufficient for this kind of use with a PHP scripted monitoring.
When the WiFi reception is not perfect, it is possible for the MK802 to lose its connection and not be able to find it again. You can solve this issue by putting a crontab (with "sudo crontab -e") which checks the WiFi connection, restarts the machine, and runs a "shutdown -r now" when the connection is lost. It's not very elegant, but it is enough to recover the lost connection automatically. To limit the use of this drastic method, use the "sudo iwconfig" command to locate the precise position of the MK802 which provides the best reception.
The WiFi reception is rather low. Don't plan on passing through reinforced concrete, or several simple walls. Do not put the MK802 near metallic objects.
The is no possibility planned by the vendor to add an external antenna.
When the MK802 is used for an embedded application, it is very likely that it does not have a screen. Remote management can be performed easily by SSH if you take care to assign it a fixed IP address. The only problem: all the parameters of the network interface are linked to the device (for example, /dev/wlan2). If you transfer the SD card into another MK802, all the network interfaces will be detected again because of the hardware change and you will lose all the settings. This is true for the IP address, but also for the access keys to the wireless network. And if you lose your network parameters, or if you want to modify them, you are condemned to connect an HDMI screen and a USB keyboard.
It is not possible to configure the machine with a laptop and a simple USB cable.
Summary
Strong points:
+ Easy to launch a Linux image and to add packages
+ USB Host mode is well supported
+ CPU is sufficient for small embedded applications
+ Not expensive
Weak points:
- WiFi configuration is sometimes capricious
- WiFi doesn't have a very good reception and cannot be bettered with an external antenna
- On-site configuration (without HDMI screen) is limited to the operations available by SSH
- On-site configuration is impossible when the network is down