When I got my PhidgetSBC3 I was really excited because I was going to try to get go running on it (which I did) but while it recognized my Logitech Z205 speakers, playing any audio file resulted in a lot of crackling (hear for yourself). After searching until my eyes bled months ago, I gave up. But recently I took another stab (because I want our foosball table horn back at Shopify) and finally found a solution then I figured out the actual problem.
I've tried solution after solution hoping it would work because none of the regular troubleshooting would work as the device was being recognized and was able to be used. It just sounded horrible. I did find this wiki entry for archlinux for crackling sound with USB devices but that solution didn't help. But did make me try restarting the PhidgetSBC3 which then lead some actual errors when trying to use alsa.
cannot open mixer: No such file or directory
root@phidgetsbc:~# aplay /usr/share/sounds/alsa/Front_Center.wav
ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
ALSA lib conf.c:4241:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4241:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4241:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4720:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM default
aplay: main:682: audio open error: No such file or directory
Searching for this lead me to this forum post about a usb speaker not being detected and suggested creating a
/etc/asound.conf file and restarting alsa. This solved the problem of not finding the device and the crackling. The
card 1 in the file suggested an ID of some sort and then I checked the ID of the device and found it matched.
root@phidgetsbc:~# cat /proc/asound/modules
I wanted to confirm this was the device missing issue so I restored to factory and plugged the Z205 in and looked again.
root@phidgetsbc:~# cat /proc/asound/modules
And suddenly it makes sense. For whatever reason, before installing
alsa-base the PhidgetSBC3 will use ID 0 for the Z205 but after that it will use ID 1. I have no idea why the crackling went away but it might have something to do with setting
type hw or maybe it just doesn't like ID 0.
If you're trying to get sound on the PhidgetSBC3 to work. Try this and restart.
root@phidgetsbc:~# apt-get install alsa-base alsa-utils -y
root@phidgetsbc:~# cat > /etc/asound.conf
root@phidgetsbc:~# /etc/init.d/alsa-utils restart
[ ok ] Shutting down ALSA...done.
[ ok ] Setting up ALSA...done.
Now that go is installed (see Part 1), you can get down to business and start using phidgets. I've written a go phidgets library (currently only
IR phidgets are implemented, open an issue or pull request if you want more) at github.com/samuelkadolph/go/phidgets.
Continue reading "Go on the PhidgetSBC3 Part 2"
The latest version of the PhidgetSBC line includes an ARMv5 processor which means it now has support for go. Unfortunately the current golang package in the debian repository does not work but I was able to compile golang from source on the PhidgetSBC3 and it worked (including
cgo). Thanks to the
"The Go Language Gophers" team I downloaded the
golang-tip package and built it on my PhidgetSBC3. I've made this
deb available in my apt repository so you can easily install go and get rocking.
Continue reading "Go on the PhidgetSBC3 Part 1"
If you are using a PhidgetSBC3 you might see this a lot:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_CA.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
This is because perl is very vocal when you are missing the locales that your environment specifies. The fix is easy, just generate the locales that you want to use (
en_CA.UTF-8 is the default). This assumes you have already set up SSH on your PhidgetSBC3.
- Enable full Debian Package Repository
- Update apt
- Install the locales package
apt-get install locales -y
- Add the
echo "en_CA.UTF-8 UTF-8" >> /etc/locale.gen
- Generate the locale
You should see it generating the locale you specified and once it's done, you will no longer see the locale error messages.
There's actually a much easier way of doing this. Just
apt-get install firmware-linux-free and boom! You get the carl9170 firmware and the DWA-160 is recognized.
I recently got my hands on a PhidgetSBC3 and plugged a D-Link DWA-160 into and found that it already had support built into the kernel but it had an error. So I went searching in the
/lib/firmware directory and saw there was no
carl9170-1.fw file. So I downloaded and when I plugged the DWA-160 back in it worked and correctly showed up in the web interface. Installing it is very easy:
apt-get install curl -y
curl -L http://linuxwireless.org/en/users/Drivers/carl9170/fw1.9.7?action=AttachFile&do=get&target=carl9170-1.fw > /lib/firmware/carl9170-1.fw
So I've had a little project going on with the foosball table at work: a system to detect when someone scores a goal. I've built a prototype photogate that goes inside of the goal. My design is to have 2 photogates hooked up to my PhidgetSBC2 and write some ruby code to detect a goal and send a message to a connected iPad app to indicate who scored. Everything was going fine until I took the PhidgetSBC2 to our foosball table and discovered our 2.4GHz network had no coverage there. Which means the wifi usb adapter I had for the PhidgetSBC2 was useless. Undeterred I started on 2 different solutions.
Continue reading "PhidgetSBC2 and D-Link DWA-160"
Installing ruby (and the
phidgets-ffi gem) on the PhidgetSBC2 is fairly simple. You will need to check
Include full Debian Package Repository under
System > Packages in the SBC admin page. And then just ssh into the server and run the following:
apt-get update && apt-get install ruby1.9.1 ruby1.9.1-dev build-essential -y
And then you can install the
phidgets-ffi gem like so:
gem1.9.1 install ffi phidgets-ffi
The gem doesn't find the
libphidgetsbc.so.0 on the PhidgetSBC, so we need to symlink it to somewhere that the gem will find it.
ln -s /usr/lib/libphidget21.so.0 /usr/lib/libphidget21.so
Once we're done this we can test it with this:
ruby1.9.1 -rphidgets-ffi -e 'puts Phidgets::FFI.library_version'
I also like to run this to add the
ruby1.9.1 executables (i.e.
gem) without the
update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby1.9.1 400 \
--slave /usr/bin/erb erb /usr/bin/erb1.9.1 \
--slave /usr/bin/gem gem /usr/bin/gem1.9.1 \
--slave /usr/bin/rake rake /usr/bin/rake1.9.1 \
--slave /usr/bin/testrb testrb /usr/bin/testrb1.9.1 \
--slave /usr/bin/rdoc rdoc /usr/bin/rdoc1.9.1 \
--slave /usr/bin/irb irb /usr/bin/irb1.9.1
I also like to create an
.gemrc to skip installing
rdoc documentation to save on space.
echo install: --no-rdoc --no-ri >> ~/.gemrc
echo update: --no-rdoc --no-ri >> ~/.gemrc