Skip to content
This repository has been archived by the owner on Jun 4, 2023. It is now read-only.

Successful quick install on latest Raspberry Pi 2 #212

Open
YellowLemon1 opened this issue Sep 11, 2015 · 34 comments
Open

Successful quick install on latest Raspberry Pi 2 #212

YellowLemon1 opened this issue Sep 11, 2015 · 34 comments

Comments

@YellowLemon1
Copy link

Hi! The latest airsonos v0.2.4 works great on a new Raspberry Pi 2 as of November 2015 - using a much faster method than the beaglebone method described on the other thread which involved compiling node from source - I'm doing this writeup for total noobs like me.

COMMENTS/RESOLVED ISSUES

  • This now works with node 4.2.2+ as of airsonos version 0.2.4. ALAC support has also been added supposedly.
  • Rather than compile node from scratch using the 'beaglebone method' which took 1-2 hours on the poor pi, I used this precompiled version from nodesource as per instructions here: http://joshondesign.com/2013/10/23/noderpi
  • After getting airsonos running I would see "Searching for Sonos devices on network..." but no speaker devices would ever show up. The solution was: getting rid of the "BRIDGE" device in my SONOS system. Airsonos seems to only work if you have an actual speaker plugged in by ethernet OR using the standard WiFi setup which was recently introduced by SONOS. The Bridge must be blocking/dropping the broadcast packets rather than sending them into "SONOS-NET" where all my Sonos speakers reside.

See identical issue here: #30

I tried all these solutions to get it to work with the 'Bridge' with no success:
#125
#135
bencevans/node-sonos#73

If you really need to use a Sonos Bridge you could try hardcoding the Sonos speakers IP addresses like this:
#79
also see here: #88

STEP BY STEP INSTRUCTIONS

  1. Buy Raspberry pi 2 and case, 4GB+ microSD card, and USB power adapter. Install Raspbian "Jessie" on the microSD card as per instructions with the raspberry

  2. Use puTTY to SSH into the Raspberry's IP address - it's hostname is 'raspberrypi' if you check on the DHCP leases on your router.

  3. Type the following commands (I did all this as sudo su)
    sudo su
    raspi-config =basic initial Raspberry setup, overclock etc.
    apt-get update =update raspberry
    apt-get upgrade
    apt-get install libavahi-compat-libdnssd-dev =install avahi needed for airsonos
    curl -sL https://deb.nodesource.com/setup | sudo bash - =add nodesource to sources
    curl -sL https://deb.nodesource.com/setup_4.x | bash - *=install node v4.x.x

  4. Log out/in to get the PATH right.

  5. Use node -v to check version, make sure node is working OK.

  6. Now install airsonos with:

sudo su
npm install airsonos -g
airsonos

It should look like this:
image

And it all works perfectly from here!

To have airsonos start on startup:

sudo nano /etc/rc.local
And add a line:
sudo /usr/bin/airsonos &
Save, reboot.

Check airsonos is running with:
ps aux

Reference: https://www.raspberrypi.org/documentation/linux/usage/rc-local.md

Thank you Stephen for this great software.

PS I also got one of these tiny Raspberry Pi Hat Screens that work great with the official red/white raspberry case - now I can monitor the status of airsonos straight on the device at a glance, to make sure it picked up all my speakers, cost <$40, link here: http://www.4dsystems.com.au/product/4DPi-24-HAT/

image

@Htaborda
Copy link

Shouldn't it be "curl -sL ...." instead of "url -sL...." ?

@YellowLemon1
Copy link
Author

Yes thank you, I corrected it now.

@Muurtegel
Copy link

Great tutorial, thank you! Installation finally worked for me!

Unfortunately Airsonos still doesn't work correctly over here. Although 1 device tunnel is set up, I don't see any devices in my airplay. Anyone else experiencing this?

Edit: It didn't work when I started Airsonos from SSH. But adding it to the rc.local file and then rebooting did the trick. My iPhone hasn't found the speaker yet, but my macbook is currently streaming without any problems.

Thanks again!

@jsnoble7
Copy link

jsnoble7 commented Oct 9, 2015

@Muurtegel If your iDevices are running iOS9, then that is a known issue with Nodetunes that is being worked through by a few excellent people. Hopefully close to being resolved. (See here: stephen/nodetunes#1)

@Muurtegel
Copy link

That might explain thins. I am updated to iOS 9. Thanks for the info!

@garz75
Copy link

garz75 commented Nov 16, 2015

Hi, I just followed the instructions and everything went fine. Airsonos works, it discovers my two sonos, The playback from an iPhone or Mac works correctly for a while, then it starts skipping... Is the Raspberry Pi 2 powerful enough to decode/transcode the audio steams ? I would think so... using top, I see that node is using 100% CPU of one core (25% overall CPU usage...). Due to the single-thread nature of node, am I hitting a CPU performance bottleneck ? I use the Raspbian, with the latest updates. @YellowLemon1 what OS do you use on the RPI? Do you see the same issue with your setup ?

[edited] I tried with both an ethernet and wifi connexion to rule out other hardware problems. My Raspberry is not overclocked (700MHZ).

@jsnoble7
Copy link

Elsewhere, it's been discussed that upgrading your Pi to Raspbian Jessie (as opposed to Wheezy), and also using Node 4.2.1 works perfectly. And that's what I'm running and it's all working sweetly for me.

On 16 Nov 2015, at 12:36 PM, garz75 [email protected] wrote:

Hi, I just followed the instructions and everything went fine. Airsonos works, it discovers my two sonos, The playback from an iPhone or Mac works correctly for a while, then it starts skipping... Is the Raspberry Pi 2 powerful enough to decode/transcode the audio steams ? I would think so... using top, I see that node is using 100% CPU of one core (25% overall CPU usage...). Due to the single-thread nature of node, am I hitting a CPU performance bottleneck ? I use the Raspbian, with the latest updates. @YellowLemon1 what OS do you use on the RPI? Do you see the same issue with your setup ?


Reply to this email directly or view it on GitHub.

@YellowLemon1
Copy link
Author

Hi @garz75 I am on the (now old) Wheezy with R Pi 2 and no such problems. Are you sure you have R Pi 2 and not the older model since RPi 2 runs standard at 900 Mhz not 700 Mhz also I get no overclocking options on RPi 2 I think you might be using RPi 1?

@garz75
Copy link

garz75 commented Nov 16, 2015

I bought a kit from canakit, the label on the box says Raspberry Pi 2 Model B 1 GB

$ free
total used free shared buffers cached
Mem: 948120 907092 41028 0 111448 481688
-/+ buffers/cache: 313956 634164
Swap: 102396 0 102396

$ cat /proc/cpuinfo
processor : 0
model name : ARMv7 Processor rev 5 (v7l)
BogoMIPS : 38.40
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 5

..
..
..
..

Hardware : BCM2709
Revision : a01041
Serial : 0000000095506e5f

Looks like an RPI2 Model B doesn't it ?

However, it looks like my PI was under clocked:

$ grep freq /boot/config.txt
arm_freq=700
core_freq=250
sdram_freq=400

$cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq
700000

I guess I did something wrong with raspi-config...

I upgraded to Raspbian Jessie, and commented out the *_freq entries in /boot/config.txt
I got 900000 in cpuinfo_cur_freq, the CPU was less loaded (75% / 80% of a core), but I was still getting some skipping and lag, although much less than before, using node v0.10.40 from deb.nodesource.com

I am currently trying node 4.2.2 from https://deb.nodesource.com/ : no problem after 15 minutes... the CPU load is lower (50-60% of one core)... I think I fixed my problem...

Thank you @YellowLemon1 and @jsnoble7

@Bernte83
Copy link

Hi @garz75. Thanks a lot for your hint. My Pi2 was skipping as well. Now with node.js 4.2.2 instead of 0.10.40 it works fine!

@rmustard
Copy link

I was successful with node.js 4.2.2 on Raspbian Jessie

Basically the instructions above, but install 4.x using
curl -sL https://deb.nodesource.com/setup_4.x | bash -

I saw this warning while installing forcing me to install using apt-get install nodejs and then confirm twice.
WARNING: The following packages cannot be authenticated!
rlwrap

@YellowLemon1
Copy link
Author

Thanks @garz75 @Bernte83 @rmustard for the info, I have updated the instructions in the first post to use node v4.x.x because this now works well with the latest airsonos version 0.2.4+

I am getting CPU load around ~30-60% on my Pi2 with a single stream going, no skips, no problems.

@sportsnapper
Copy link

Great instructions. Worked first time, and also on iOS9 - which gave me issues before....

@XBeg9
Copy link

XBeg9 commented Dec 4, 2015

Guys, do you have also delay of sound about 2-3 seconds? I am using airsonos on OS X

@Muurtegel
Copy link

@XBeg9 yes, this is default behaviour for airplay https://discussions.apple.com/thread/4173205

@XBeg9
Copy link

XBeg9 commented Dec 4, 2015

@Muurtegel yeah, also just for audio players like Spotify? You still have delay?

@Muurtegel
Copy link

@XBeg9 yes, the delay is always there. It's also there when you use official airplay speakers.

I'm not a 100% sure, but I believe the delay is there because of some sort of buffering.

@XBeg9
Copy link

XBeg9 commented Dec 4, 2015

@Muurtegel ok, but as I understand Raspberry setup works perfect with iOS 9... I can't get working iOS9 support from terminal. What's the issue?

airsonos --version
0.2.5

@Muurtegel
Copy link

@XBeg9 I can't help you with that, sorry. I haven't used Airsonos in a while.

@XBeg9
Copy link

XBeg9 commented Dec 5, 2015

@Muurtegel heh, it was my wifi connection. sorry. 0.2.5 works great with iOS 9.

@KRider92
Copy link

@XBeg9 So the delay in your setup was caused by WiFi?
I've got over 5 seconds of delay here, which is terribly annoying... Could you maybe tell me what you did to resolve this?
On my original AirPlay-speakers I don't see this delay at all: Video & Audio is in sync, even if I play browser video.

@cja1
Copy link

cja1 commented Dec 30, 2015

Awesome job - thanks!

One minor comment / edit: I had a problem with the change to rc.local i.e.: sudo /usr/bin/airsonos &. It wasn't working consistently.

Using a suggestion here: http://stackoverflow.com/questions/23914382/rc-local-file-not-working-raspberry-pi I removed the sudo from the line... and all seems to work fine.

@deluxestyle
Copy link

@KRider92 I have the same issue with the delay. I've got also over 5 sec.
Does none one else has this problem?

@jimmyeao
Copy link

Instructions incomplete, on a brand new setup npm is not installed, in fact, it seems a hole lot of node components dont get installed if I do an apt-get install npm...
Edit... then the build fails.. should there be a apt-get install nodejs step in here?

@A5HRAJ
Copy link

A5HRAJ commented Apr 5, 2016

If anyone is having problems with these instructions, make sure you're using the full version of Raspbian Jessie, not Raspbian Jessie Lite

@rbennion
Copy link

rbennion commented Apr 19, 2016

Raspberry pi 3 with Raspbian Jessie / Node.js V5 checking in. Working fine with < 10% processor load.

EDIT: Also monitoring core temp while streaming...62.3 degrees average.

EDIT: After 20 minutes...%CPU = 9.2%.

@bbrendon
Copy link

bbrendon commented May 1, 2016

NOTE TO PEOPLE WITH RaspPi 1

These instructions will work on the RPI 1, but you will get segmentation faults. The package management doesn't make sure you're on the correct CPU.

RaspPi 1 is ARMv6 while the 'armhf' Debian distro is for ARMv7 (RaspPi 2)

@darrylyoung
Copy link

darrylyoung commented Jun 17, 2016

Thanks for the tips here, everyone. I know the previous comment mentions some issues with the Raspberry Pi (1) but does that mean it actually won't work? I have airsonos running on my Raspberry Pi B+ and I see the speaker on my iOS device but when I play nothing comes out of the speaker. If this is simply a performance thing with the Model B+ then I'll pick up a new one; I just figured I'd try it as I had this old one lying around.

Here's what I see:

pi@raspberrypi:~ $ airsonos
*** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node>
*** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node&f=DNSServiceRegister>
Searching for Sonos devices on network...

Office (@ 10.0.1.15:1400, ...)

Search complete. Set up 1 device tunnel.

@cjhodges77
Copy link

Sweet! Worked first time. Various warnings but I didn't have to do anything, just ignoring them. Excellent work. Kudos!!

@partymike
Copy link

personally I would install this as a service then it will start on boot and restart if it hits a problem:

So, create a new file in /etc/systemd/system, called airsonos.service
Paste the following into the new file eg. sudo nano airsonos.service:

[Unit]
Description=start airsonos server
After=syslog.target network-online.target

[Service]
Type=simple
ExecStart=/usr/bin/airsonos
Restart=on-failure
RestartSec=10
KillMode=process

[Install]
WantedBy=multi-user.target

Then use the following commands in order to start the service:
systemctl daemon-reload
systemctl enable airsonos.service
systemctl start airsonos

Finally check the service is running ok, and enjoy your tunes!
systemctl status airsonos

@helge1979
Copy link

helge1979 commented Nov 9, 2016

Hi there,

i installed airsonos on my raspberry pi 2. And the output looks like in your screenshot:

pi@raspberrypi:~ $ sudo airsonos
*** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=node>
*** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or >only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=node&f=DNSServiceRegister>
Searching for Sonos devices on network...

Küche (@ 10.203.1.37:1400, ...)

Search complete. Set up 1 device tunnel.

And i find my sonos speaker via airplay on my mac and on my iPhone. I can choose the sonos speaker, but i did not hear anything.

When i play a song via Airplay i can only see that the cpu utilisation is geting higher and higer. My pi is overclocked with 1000 MHz

Somebody a idea what could be wrong?

@wilhar0046
Copy link

I am also running into some issues. I am using node version 4.7.2. When I first try to do the npm install airsonsos I get errors that I need to install GIT in order for it to work. After installing GIT I was able to install airsonos but I got a lot of errors and warnings about depreciated code and commands. Once I tried to launch airsonos it acts like its going to search for my bridged speakers and then errors out more. Anyone have any thoughts or ideas?

pi@raspberrypi:~ $ sudo airsonos
*** WARNING *** The program 'nodejs' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs
*** WARNING *** The program 'nodejs' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs&f=DNSServiceRegister
Searching for Sonos devices on network...

/usr/lib/node_modules/airsonos/node_modules/bluebird/js/main/promise.js:680
throw e;
^
Error: Internal Server Error
at maybeWrapAsError (/usr/lib/node_modules/airsonos/node_modules/bluebird/js/main/util.js:70:12)
at /usr/lib/node_modules/airsonos/node_modules/bluebird/js/main/promise_resolver.js:41:50
at /usr/lib/node_modules/airsonos/node_modules/sonos/lib/logicalDevice.js:112:20
at done (/usr/lib/node_modules/airsonos/node_modules/sonos/node_modules/async/lib/async.js:126:15)
at /usr/lib/node_modules/airsonos/node_modules/sonos/node_modules/async/lib/async.js:32:16
at /usr/lib/node_modules/airsonos/node_modules/sonos/lib/logicalDevice.js:106:22
at done (/usr/lib/node_modules/airsonos/node_modules/sonos/node_modules/async/lib/async.js:126:15)
at /usr/lib/node_modules/airsonos/node_modules/sonos/node_modules/async/lib/async.js:32:16
at /usr/lib/node_modules/airsonos/node_modules/sonos/node_modules/async/lib/async.js:251:17
at done (/usr/lib/node_modules/airsonos/node_modules/sonos/node_modules/async/lib/async.js:126:15)
at /usr/lib/node_modules/airsonos/node_modules/sonos/node_modules/async/lib/async.js:32:16
at /usr/lib/node_modules/airsonos/node_modules/sonos/node_modules/async/lib/async.js:248:21
at /usr/lib/node_modules/airsonos/node_modules/sonos/node_modules/async/lib/async.js:572:34
at /usr/lib/node_modules/airsonos/node_modules/sonos/lib/events/volumeListener.js:24:14
at Listener. (/usr/lib/node_modules/airsonos/node_modules/sonos/lib/events/listener.js:123:9)
at Request.self.callback (/usr/lib/node_modules/airsonos/node_modules/sonos/node_modules/request/request.js:129:22)
pi@raspberrypi:~ $

@sojapiccante
Copy link

I can get Airsonos working, but the version of node it uses seems to be incompatible with Node Red. So when you get to this step:

curl -sL https://deb.nodesource.com/setup_4.x | bash -

it won't complete without removing nodered (and some other stuff). If I try to re-install nodered I get a lot of package dependency errors. If I try to use a different setup (6 or 8) then I get zillions of compilation errors.

So, it looks like since I need to have Node Red for other reasons, I can't use Airsonos? Unless someone knows differently I suppose if all else fails I could buy an extra Pi just for Airsonos.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests