Sunday, June 16, 2013

Beware of ebay wifi dongles claiming RT5370 chipset

I just thought I'd give a quick PSA regarding buying wifi dongles on ebay. Sometimes I think ebay's tagline should read "Ebay : Caveat Emptor" instead of "Ebay : World's Online Marketplace" :)

I recently scoured ebay for usb wifi dongles using the RT5370 chipset for use in my PiFi Mini project, I'd found this chipset is nicely supported by raspbian and works great in both managed and ap modes.

I already had one kicking around which I used when I was developing the project but I found it's signal levels lower than they should be so I wanted to order a few others. I ordered two different ones on ebay, one with an external antenna and one without.

 Works

Does not work

The version without the antenna arrived first and works great (ebay seller ovolink) and I found the signal levels to be better than the original dongle I was using. A week or so later the antenna version arrived (ebay seller priceneer) but I didn't have a chance to test it right away.

Today I finally tried it and was surprised to find it did not work with my Pi. I plugged it into a Windows PC and using the Device Manager I checked the PID and VID numbers and found that instead of being vid_148f&pid_5370 it shows up as vid_148f&pid_3070. Even stranger was that after taking the casing apart I found the chip inside is indeed marked as RT5370???

As far as I can tell one of two things is happening here:
1) These chips are actually 3070 chips and were deceptively labelled 5370 or
2) They really are 5370 chips but the eeprom was programmed incorrectly.

Now with these dongles being as cheap as they are and all of them coming from China either explanation is possible, theory #2 could be a factory mistake and these were sold out the backdoor. Working in the electronics field I'm always astounded by the amount of fake/counterfeit/backdoor chips out there even when the real thing is only pennies a piece.

Further investigation showed that my Pi was loading the RT2800usb module and a bunch of googling found others had issues with this chipset. One solution shows installing ralink wireless tools, blacklisting the rt2800usb and instead loading the rt2870sta module. More work than a $6 dongle is worth for me at the moment so it's going back in the box for now.

I've sent and ebay message to the seller priceneer explaining that his listing is incorrect and asking if they are willing to do anything. Since it would cost me more than the $6 the dongle is worth to ship it back I'm not going to bother with that. I asked the seller at the very least to update his listing so that others aren't mistakenly ordering it thinking it'll work with their Pi. In their defence they might have been fooled themselves.

If you experience issues and your Pi doesn't seem to be working this could be your issue.

Checkign VID & PID in Raspbian:
Type the following into a terminal session:
lsusb

One of the lines should read 148f:5370 if it is truly an RT5370 chip, if it reads 148f:3070 or anything with the last 4 digits being something other than 5370 you're likely going to have issues.

Checking VID & PID in Windows:
In Windows as soon as you plug the dongle in if you press the windows key + pause/break to open System Properties, then click on the Hardware tab, then click Device Manager, you should see a device with a yellow triangle and exclamation point and it will be listed as 802.11 n WLAN. Right click on this then click on the Details tab, it will show you the VID and PID numbers.

So in short, be careful when ordering dongles even if they claim to be a certain chipset. If your chipset isn't the 5370 you may be able to get it working by following some help online, however since I've not tested the RT3070 chipset I can't say whether it would work with the PiFi project.

Good luck and buyer beware :)

UPDATE:  The ebay seller Priceneer has contacted me and claim that they mistakenly sent me the wrong item and that they are willing to either refund or reship. They were really quick with a response and seem eager to help resolve the situation.

UPDATE 2: After a few back and forth emails it turns out they cannot send me a replacement that wouldn't suffer the same issue so they're refunding me and letting me keep the original item. 

Sunday, June 2, 2013

PiFi Optional Extra - Icecast2 Streaming



What is Icecast?

It's your very own little internet radio stream.

For the PiFi Mini I didn't initially think of adding Icecast because the music is being played locally out of the attached speakers so it didn't make much sense to stream the output as well. However I've just started working on the next PiFi variation which will be an always on music server. The core features will still be present but this one will reside in the stereo cabinet, it will sacrifice wifi but gain a hard drive and digital output. This will eventually become my home audio server and itunes source library, more about that another time.

Installing Icecast2

READ BEFORE CONTINUING:
The following assumes you've already followed my PiFi-Mini Tutorial Part 1 or you've installed mpd already on your own.

Either connect to your PiFi via ssh or connect it to a display along with a usb keyboard.

Ok let's get started, first we'll update our packages, then we'll install icecast2.


As it installs you'll be asked to configure icecast2.
When it asks you for the hostname just stick with the default of "localhost"
Next it'll ask you to specify passwords for source, admin, and relay. Enter whatever you want but make note of what you enter (fyi these are written to /etc/icecast2/icecast.xml).

Next we need to go back and edit our mpd.conf file, find the audio outputs section (remember ctrl+w in nano is search) and paste this in below your existing audio_output. Make sure to change the password to whatever you entered for Icecast Source earlier. Then save and exit the file (ctrl+x, press y, hit enter).


Restart mpd and icecast2


Check if the new audio output is enabled.


You should see something like this:
Output 1 (PiFi Mini Analog Output) is enabled
Output 2 (PiFi MPD Stream) is disabled


Enable output 2 (or if you have more whichever one icecast2 is)


Make sure mpd is playing something then browse to your PiFi's ip address on the network.

http://pifi_ip_address:8000  or you can try http://pifi-mini.local:8000
*Remember the .local address doesn't seem to work on Android and possibly other devices or configurations, if it doesn't work for you use the direct ip address method.

You should be presented with an Icecast2 Status page

Click on the M3U link, on a smartphone it should start playing it, on a computer it should open your default music program that's tied to m3u files and then start playing.

One thing to note is that this stream will not be in sync with the output of the pi's headphone or hdmi jack.
Also beware that icecast2 takes up a bunch of cpu time (~60%) so I suggest you only enable the icecast2 output stream when you plan to use it.

Enjoy!

Credit where credit is due, I followed these instructions when setting mine up so thanks Steffan Muller for posting them.