Tuesday, October 7, 2014

Turn your old wireless router into an LTE router with OpenWRT

Today's article has nothing to do with the NUC. Instead, I'm going to show you how you can turn your old wireless router into an LTE router if you just have an QMI-compatible LTE dongle. I recently got an LTE 4G mobile broadband connection that came with a Huawei E392 USB dongle. I found that the dongle was quite tedious to use on a laptop as it did not allow me to use the connection with multiple devices easily. A proper LTE router would have cost around €200 where as this project turned my old wireless router and the dongle that came with my subscription into an LTE router for no additional cost!

So I had a Western Digital N750 router and a Huawei E392 dongle.

OpenWRT is an open operating system that is meant to replace the OS that is running on many off-the-shelf wireless routers. It provides additional features compared to the manufacturers original firmware.

Is my router supported?

To make this happen, you will need a router that has a USB 2.0 port and that is supported by OpenWRT. The guys over at OpenWRT maintain a list of devices that are supported. Western Digital has discontinued their line of routers, so they're being sold currently for a fraction of the money I paid for mine! There are many others as well and this article will pretty much apply for any supported router.

My 3G/LTE Dongle - is it supported?

This is a more tricky question. Basically if your dongle runs Qualcomm's QMI protocol and it is supported by the qmi_wwan Linux module it should be fine. Huawei E392, E398, Vodafone K5005 and many others belong to this category. Do note that there are other drivers for other types of dongles, but this article only covers QMI dongles!

Installing the OpenWRT on the Router

It's good idea to go to the OpenWRT website where they maintain a page for each supported device. For example for WD MyNet N750 the page is here and for N600 here.

Basically the process is following:

  • Locate the OpenWRT image for your router (there's one you need for flashing over a factory image and another one you use for upgrades - choose the factory image if your flashing OpenWRT for the first time)
  • Download the image
  • Load the image into your router via the management web interface that your router has. Typically available at http://192.168.0.1 or http://192.168.1.1 Check the manual of your router or the OpenWRT installation page. If you've changed the settings on your router, there's usually a reset button to clear the settings, but if you can access the web interface it's not typically necessary to clear them.
  • Configure your router

These steps depend on the model of the router and are typically well-described on the OpenWRT page. After the software is flashed, the router will reboot and it will be running OpenWRT. Time to start the actual configuration!

Change the root password

Now that you have your router up, connect your computer to it with a cable and let it retrieve the IP address automatically using DHCP (this is usually what you do if you don't have a static IP address configured for the computer). Then open a browser and point it to http://192.168.1.1 address. You will see page saying that there is no root password configured and that you should change it. Do that.

When you've changed the root password you should be able to see the status of the router in the web interface.

Installing QMI Drivers

The QMI drivers are not installed in OpenWRT by default. So you will need to install them manually. There are 2 ways to handle this installation. Either you have wired Internet connectivity to your router, which makes things very easy for you. However, I did not have, so I had to download the packages beforehand and then transfer them to my router and install them. This article describes what I had to do. If you have connectivity to your router, skip here.

Prerequisite Software

Download and install the following software on your laptop. If you use other OS than Windows, you can use other similar software.

OpenWRT Packages

Download the following packages. You can find all the packages here: downloads.openwrt.org/barrier_breaker/14.07/. At the time of writing 14.07 is the latest stable release. In case you're installing a later release, download the packages for the corresponding release. Under that link you will find a folders for each type of architecture. You will need to determine the type of architecture that applies to your router (the factory image download link contains the architecture, so if unsure look at that link). For WD N600 and N750 it's ar71xx. Under the architecture folder you will need to go into generic/packages/base folder and download the following packages:

  • libpthread
  • kmod-mii
  • kmod-usb-net
  • kmod-usb-wdm
  • kmod-usb-net-qmi-wwan
  • librt
  • libusb-1.0
  • usb-modeswitch
  • uqmi

Installing the Packages

Now open up WinSCP and create a new connection to your router. Select SCP as the protocol, enter 192.168.1.1 as the IP, root as the username and the password you set earlier.

Drag and drop the download packages to the right side which represent the files in your router.

Good, now you can close WinSCP and open the other software you downloaded, PuTTY. Define 192.168.1.1 as the IP address and hit connect.

After a confirmation you will see a terminal screen and a command line prompt.

Now enter the command to install all the packages that you had downloaded.

opkg install *.ipk

If you are missing some package, it will complain about missing dependencies. If that happens, go back, download the missing packages, transfer them to your router and try again. Successful output should look like this:

root@OpenWrt:~# opkg install *.ipk
Installing kmod-mii (3.10.49-1) to root...
Installing kmod-usb-net-qmi-wwan (3.10.49-1) to root...
Installing kmod-usb-net (3.10.49-1) to root...
Installing kmod-usb-wdm (3.10.49-1) to root...
Package kmod-usb-net (3.10.49-1) installed in root is up to date.
Package kmod-usb-wdm (3.10.49-1) installed in root is up to date.
Installing libpthread (0.9.33.2-1) to root...
Installing librt (0.9.33.2-1) to root...
Installing libusb-1.0 (1.0.9-1) to root...
Installing uqmi (2014-05-27-d7a56cad6d6ef3c2a5602fc604ee78fa) to root...
Installing usb-modeswitch (2014-07-18-01ecc3b97648f9adb0cd33) to root...
Configuring libpthread.
Configuring kmod-mii.
Configuring kmod-usb-net.
Configuring kmod-usb-wdm.
Configuring kmod-usb-net-qmi-wwan.
Configuring librt.
Configuring libusb-1.0.
Configuring usb-modeswitch.
Configuring uqmi.

That's it, the packages are there. Now reboot the system by issuing a command reboot and proceed from chapter Configuring QMI just a little bit below. Note that you will lose connectivity when the system is rebooted.

reboot

Installing the Packages with Internet Connectivity

If you had wired connectivity on your routers WAN port, there would be no need to transfer the files with WinSCP or PuTTY. Instead you could go to web interface with your browser and open System -> Software. Click Update lists then type uqmi in the box that says Download and install package and click OK. Repeat for packages usb-modeswitch and kmod-usb-net-qmi-wwan. Then reboot the system via System -> Reboot.

Configuring QMI

At this point, you may want to log in to the router and confirm that you have a /dev/cdc-wdm0 device present. This represents your USB dongle.

root@OpenWrt:~# ls -l /dev/cdc-wdm0
crw-r--r--    1 root     root      180, 176 Oct  1 12:03 /dev/cdc-wdm0

If you do not have it, try to run the following, wait a short while and check again:

usbmode -l
usbmode -s

If you still don't have /dev/cdc-wdm0 present, run logread and try to see if you can find any clues in the logs.

Now that you have your /dev/cdc-wdm0 device present, you can check that device is responding correctly.
root@OpenWrt:~# uqmi -d /dev/cdc-wdm0 --get-data-status
"disconnected"
root@OpenWrt:~# uqmi -d /dev/cdc-wdm0 --get-signal-info
{
        "type": "lte",
        "rssi": -61,
        "rsrq": -6,
        "rsrp": -88,
        "snr": 290
}

The commands show that mine is disconnected currently and has LTE coverage at the moment. Now I need to issue a start-network command. For that I need to know which APN my dongle needs to use (typically internet, but check from your operator) and if authentication is used. In my case there's no authentication.

root@OpenWrt:~# uqmi -d /dev/cdc-wdm0 --start-network internet --autoconnect
38750672
root@OpenWrt:~# uqmi -d /dev/cdc-wdm0 --get-data-status
"connected"

The autoconnect parameter is important. It makes sure that device automatically reconnects when you restart your router or if you lose the connection for a while. In case you need to define authentication, add the parameters username and password plus possibly the auth-type to the start-network command line:

  --start-network :            Start network connection (use with options below)
    --auth-type pap|chap|both|none: Use network authentication type
    --username :              Use network username
    --password :          Use network password
    --autoconnect:                  Enable automatic connect/reconnect

Now the last thing to do is to add the following lines into /etc/config/network file:

config interface 'wwan'
        option ifname 'wwan0'
        option proto 'dhcp'

You can do this using the vi text editor, but if you're not comfortable with that, point your browser to 192.168.1.1 again, choose Network -> Interfaces and click Add new interface.

Write wwan as the name of the interface and make it cover the wwan0 interface. Choose DHCP client as the protocol.

If you go back to the list of network interfaces, you should soon see the IP address that your dongle has received from your operator.

We're almost there! Now you need to make sure that wwan interface belongs to your firewall's WAN zone. To do that, go to Network -> Firewall, scroll down to wan and click the Edit button.

Now add a checkmark to the wwan box under Covered networks heading, click Save & Apply and you're done.

That's it! You've configured OpenWRT to be your LTE router. Now you can add other kind of functionality like wireless networks, tweak the firewall rules, install further software into the box - possibilities are almost endless. Or then you can just use it to share your USB dongle to your network. Finally, a speedtest.net result of 70+ Mbps downlink and 35+ Mbps uplink - not too bad.

Sunday, October 5, 2014

Bay Trail NUC (DN2820FYKH) Review - part 3

This is the last part of the DN2820FYKH review that I've been working on the last few days. Today we look how the thing works under Windows. If you're interested in the previous articles, have a look here.

Windows on the NUC


I started by installing Windows 8.1 on to the NUC from an USB stick where I had my Windows 8 installation media. The installation was uneventful and successful. After getting to the desktop, I recommend that all Windows users will visit Intel Download Center and download the latest drivers for the NUC. Drivers are available for Windows 7, 8 and 8.1.

Well, what can I say, it does work. All the hardware is fine. Performance is allright, but could be better of course, especially since I only have a 2 gigabyte memory module! Others have reported better performance with 4 or 8 gigabytes of RAM. So, if you plan on running Windows on the NUC, don't skimp on the amount of RAM. For those interested in numbers, have a look what Legit Reviews had to say in their thorough review of the thing.


DTS-HD and Windows


Intel initially claimed DTS-HD support for the NUC. However, in August it turned out that the CPU in the NUC does not support Protected Audio Path (PAP) via the onboard HDMI connector. PAP is a DRM technology that is required for lossless Dolby TrueHD and DTS-HD formats when running Windows. On Linux DTS-HD output without PAP is possible, so OpenELEC is actually fine with DTS-HD. So there you have it, no DTS-HD in Windows on this NUC. The i3 NUC is your next option, in case you need that.

What kind of hardware to buy?


If you're interested in one, you can play around in the NUC configurator that will help you to choose hardware that actually works together. I've specified here a hew example configurations though based on your needs.

Budget NUC


This configuration is pretty much as cheap as you can go and still build a proper working NUC if you plan to run Linux on it. For Windows use, you need to look further. This actually corresponds to the configuration I had in my review and provides a full working system under $200 / €200.
  • Memory: 2Gb DDR3L
  • HDD: 120Gb 2.5" SATA drive
  • HDMI cable

Check the price here.


Windows-desktop NUC


Reasonably equipped NUC with an SSD drive and 4 gigabytes of memory. You'll still need to add a suitable edition of Windows to the package.
  • Memory: 4Gb DDR3L
  • HDD: 120Gb 2.5" SSD drive
  • HDMI cable

Check the price here.


Performance NUC


About as good as it gets: The NUC with an 240Gb SSD drive and 8 gigabytes of memory.
  • Memory: 8Gb DDR3L
  • HDD: 240Gb 2.5" SSD drive
  • HDMI cable

Check the price here.


HTPC NUC


Very balanced HTPC configuration that works fine if you're planning to store your media outside the NUC (on a NAS or on an external hard drive).
  • Memory: 4Gb DDR3L
  • HDD: 60Gb 2.5" SSD drive
  • HDMI cable
  • Remote Controller

Check the price here.


Conclusion


It's not blazing fast, but it's inexpensive, small, rather stylish, quiet and works well as an OpenELEC HTPC. It's an inexpensive entry into HTPCs. In case you want to read the earlier parts of this review, look here:

Bay Trail NUC (DN2820FYKH) Review - part 2

"Building an home theater PC (HTPC)?" is the first thing Intel says on their website. It's clear that this NUC is designed to be the budget HTPC platform. It's got many good characteristics for a HTPC: it's small, it's quiet, it consumes little energy, it's affordable and there's even an integrated infrared sensor.

I previously wrote an article about the DN2820FYKH NUC and it's characteristics. Today I'm going to take a look how the Bay Trail NUC works as a HTPC.

As the Bay Trail NUC is the cheapest Intel NUC with a price tag of only around $130 I think it's natural to pair this NUC with a free operating system. OpenELEC is an open-source project which is designed for one purpose - to run the XBMC/Kodi media center application as smoothly as possibly. You can literally have a full media center running in 15 minutes with OpenELEC.

Furthermore, it strikes as kind of odd to spend a $100+ for a computer and then about the same for a copy of Windows 8. OpenELEC will run just fine with only 2 gigabytes of memory, whereas Windows will require at least 4 gigs to run ok.

OpenELEC on DN2820FYKH


I installed the stable version 4.0.7 of OpenELEC on the NUC. What can I say? Everything worked out of the box: even the wifi card and the IR sensor. I just had to change my settings so that audio was output to the HDMI connector to get the sound out via the TV speakers.

Navigation was smooth, even using a heavier skin like Aeon MQ5. Pretty much all the comments that applied for OpenELEC on the DE3815TYKHE actually do apply for the DN2820FYKH as well. It's perfect for 720p and 1080p content, but if you need live TV or interlaced content, you'll bump into the limits of the CPU and GPU of this small PC. Read the DE3815TYKHE article here.


OpenELEC on Intel NUC DN2820FYKH by nucblog (enable subtitles to see commentary)

Full HD playback


I tried testing out a few 1920x1080 24p videos and the playback seems to be ok. It's good to make sure that the following settings are configured in XBMC:
  • Video - Playback - Adjust display refresh rate to match video: On start/stop
  • Video - Playback - Sync playback to display: Enabled
  • Video - Playback - A/V sync method: Video clock (Drop/Dupe audio)
  • Video - Acceleration - Decoding method: Hardware accelerated
  • Video - Acceleration - Allow hardware acceleration (VDPAU): Disabled
  • Video - Acceleration - Allow hardware acceleration (VAAPI): Enabled
  • Video - Acceleration - Use Mpeg-2 VAAPI: Enabled
  • Video - Acceleration - Use Mpeg-4 VAAPI: Enabled
There are a few very high bitrate test videos at jell.yfish.us that I tried. I tried the 100 Mbps video and even that was fine. There were no dropped frames during the playback. There are a few right in the beginning of the playback, but it stabilizes after first second or so. Do note that in real life most of us will not face a video with 50 megabits/s...

Does It Do 24p?


After the problems that Intel GPUs have had with displaying the 24p content another question everyone had was if the NUC can do proper 24p, meaning not 24 frames per second but 23.976 frames per second. And yes, it seems that the Bay Trail GPU gets the check mark.

Scaling


If you are watching content that is not in 1920x1080 resolution such as a normal SD television, DVD content or even 720p HD content it needs to be scaled up to 1920x1080 resolution by the HTPC. Now comes the bad news, the GPU in this NUC is too slow to support anything except the Bilinear scaling. Bilinear in my opinion is fine for 720p to 1080p scaling, but for SD TV to full HD it produces quite a blocky picture. Especially diagonal lines look bad with bilinear scaling. Note that this is only a concern with SD content, for HD content no scaling is required.
100% crop from a video where SD content has been upscaled.

Deinterlacing


Deinterlacing comes into play if you are watching interlaced content. That is typically live TV content or content recorded by a live TV backend such as Tvheadend. Due to historical reasons TV is often broadcasted in a format where only every other line is drawn on the screen (ie. for 1920x1080i video there's only 540 lines of information at broadcasted at any given moment). This was fine with CRT screens, but modern LCD screens do not really support interlaced content. Thus it needs to be deinterlaced before it can be shown properly. Deinterlacing can be done in many ways and the more sophisticated ways consume more processing power but also provide a better picture.

The graphics drivers for the Intel HD Graphics on Linux are currently in an unfortunate state and the deinterlacing is not really working as it's supposed to work. Thus the alternative is to use CPU for performing the deinterlacing. This works ok for SD content, but for content broadcast in interlaced HD format (1080i) the feeble CPU in the NUC is not able to handle the deinterlacing. Only the plain BOB works, but that provides a jittery image.

Another, rather annoying issue with the software deinterlacing is that you need to enable the option Video - Acceleration - Use SW Filter for VAAPI and then you can choose even Yadif as deinterlacing method (Yadif equals to Deinterlace method De-interlace in the settings) which provides the best result and this is fine for the SD content. However, when you try to play non-interlaced 1080p content, the SW filter option will consume CPU even if there is no deinterlacing to be done. Thus you need to switch off that option if starting to watch a 1080p video.

Again, deinterlacing is probably only an issue if you are watching live TV with your HTPC. Almost all streamed content is in progressive mode and does not need to be deinterlaced. It seems that some work is being done to enable hardware accelerated deinterlacing on the Intel GPUs, so this situation might improve in future.

Live TV


I've successfully installed Tvheadend and watching SD live TV content is not a problem. Interlaced HD TV probably is an issue due to the interlacing woes mentioned above.

DN2820FYKH as HTPC


The DN2820FYKH has lively performance in the menus and good performance when playing full HD videos. It's significantly faster than a Raspberry Pi for example (but that's an unfair comparison) and OpenELEC works smoothly out of the box on it.

On the other hand the Bay Trail NUCs suffer from having only 4 execution units in their GPU. As a result the upscaling and deinterlacing functionality with the current drivers leaves something to be desired. The same situation applies to all Bay Trail motherboards currently.

There's also another BayTrail NUC, the fanless DE3815TYKHE, but considering that it is sold for more or less the same price as the this NUC (DN2820FYKH), I'd say unless you really desperately want a fanless system, go for the DN2820FYKH. Better yet, go for an i3 model and you don't need to ever worry about upscaling or deinterlacing. Don't get me wrong, this NUC is a fine small PC, but you should be aware of its limitations.

More about DN2820FYKH


Read the other parts of the review: