Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Multi-room audio with Snapcast and Raspberry Pi (oyvn.github.io)
215 points by elgfare 11 days ago | hide | past | web | favorite | 37 comments

I use Snapcast and mopidy on a home server with the iris front end. It integrates with home assistant so you can have automations play sounds in all or some rooms.

With covid I've been able to pipe my meetings to snapcast from the web browser (listen only) which is great for restroom breaks and snacks in long unengaging meetings.

I rigged up a AC sniffer circuit and wifi microcontroller to my dumb doorbell which snapcasts a recording of a doorbell chime throughout the house when it's pressed so I can hear it when music is playing.

Snapcast can also stream to a phone, so I can Bluetooth into the hot tub speakers and have it on the whole house audio too.

Open source home automation with home assistant and this tech is really fun if you want to get into it as a hobby. Certainly requires work, but that's fun for me.

I also have it all integrated into a home-brew weather station and an indoor air quality sensor system with co2 and pm levels so I can get alerts to open windows or turn on fans if co2 gets too high. I also get raindrop noises when it starts raining so I go close the windows. Fun times.

Of course there's a security system involved too which arms at night and when the family's WiFi all disconnects. It disarms automatically based on WiFi auth and an openwrt script, so it's totally autonomous. Works very well.

Working on a tensorflow based automation now to have the front door camera detect packages and send email alerts. Does not work at all, yet.

All local, all self-hosted, with a bridged MQTT server on a VPS for communicating with my location tracker and my mom's house (I get alerts if she's on vacation and the furnace dies or basement floods or there's a break in or whatever). I vpn in to my router to control things when out. But if internet dies at home, everything local still works great.

Mopidy also connects to Spotify, of course.



I made a similar setup with Home Assistant running on a low power Raspberry Pi 3A+ connected to a Xiaomi Mijia Bluetooth Low Energy temperature and humidity sensor (model code LYWSDCGQ). It takes a single AAA battery and it's lasted almost a year on one.

There's a ready-made Home Assistant component but I wrote up a guide on how to read the data from a Linux terminal on your laptop: https://unop.uk/xiaomi-mijia-bluetooth-temperature-and-humid...

I also have Volatile Organic Compounds / equivalent carbon dioxide (Sensirion SGP30) and Particulate Matter (Plantower PMS5003) sensors soldered up to a Raspberry Pi Zero W over I2C/UART for logging. It lasts quite a while on a USB battery so you can take it out and about. An ESP8266/ESP8285 would last longer but it's easy to log with a python script and the SD card gives you loads of storage. I haven't written this up yet but will if anyone is interested?

Can you tell us more about your home brew weather station? That sounds cool.

Have you done any tinkering with node-red yet? It’s pretty handy for tying stuff like that together and runs nicely on a pi (incl mqtt integration for esp/arduino/sonoff integration)

I have not. I do it all in yaml still, which I feel like I like. I've seen some pics of node-red graphs and it looks pretty slick though.

It's super slick. Runs pretty good in docker on the Pi if you just want to tinker without making a mess. I'm using it to do process control for a small fractional distillation apparatus. It's doing temp monitoring, production monitoring (by weight) and using a PID loop to manage heat input. Takes a minute to figure out how it works but once you get used to the message format you can stack on functionality extremely quickly. With MQTT adding functionality from other devices is super easy too.

Overall have had a really good experience with it. My only complaint is that it's not multi-threaded, so if you have a process that blocks (e.g. the dallas 1-wire library for reading temp sensors) then you'll stall the flows. Most of those issues have simple workarounds though.

> indoor air quality sensor system with co2 and pm levels

What do you use for monitoring this? I've been looking for something decent here for a while now.

I use a Esp8266 microcontroller reading a MH-Z14A NDIR CO2 sensor [1] and a Laser PM2.5 HM3301 from grove [2]. Pretty easy to code up in C. Once tge sensors data is read, the esp sends the it over the MQTT protocol on wifi to home assistant which puts them in SQL db and does plots and stuff.

[1] https://www.winsen-sensor.com/d/files/infrared-gas-sensor/mh...

[2] https://www.seeedstudio.com/Grove-Laser-PM2-5-Sensor-HM3301....

My DIY sensors[1] (temp/humidity) are running on attiny84 and 3xAAA batteries, which I really like as they last for about a year (sending updates every ~1 minute and then sleeping).

But because I'm not using a voltage regulator, since that would mean losing the very nice onboard voltage monitor, it's been really hard to find some CO2/PM2.5 sensors that can work from ~5V to ~3.4V.

> Working voltage 4.5 V ~ 5.5V DC

> Operating Voltage 3.3V / 5V

Guess I need to keep looking, but thanks for linking the specific models!

[1] https://ambient.emilburzo.com/#overview

Interesting as another proj

What do you use for amps for the speakers?

In one room I use a regular large stereo amp. I have a IR led taped to it to turn it on and off via LIRC because it uses 100 watts on standby and I can't stomach running it all night. It gets audio via snapcast through a raspberry pi 3.

In another room I have my home workstation/server/NAS hooked to nice speakers via a $10 mini Kinter MA170 amp that I thought for sure would sound like crap but honestly is pretty darn good.

are SnapCast and Mopidy complementary or supplementary?

Complementary. Mopidy supplies the music data from Spotify or your library. Snapcast sends it around the house to different networked stereos.

After kicking around a bunch of these solutions and discovering that none of them work quite right or you still have to spend quite a bit on the hardware, I eventually bent the knee to Sonos recently. The interface is pretty garbage, but it just works and the sound quality is good.

Part of it was that I just don’t think I could face the wrath of my family when it didn’t work. I guess you get to a point in life when you have kids, and hours for tinkering are reduced so you need to pick your battles.

I like the Snapcast model though, it follows the Linux philosophy. From memory the audio stream is basically just wrapped along with a time stamp. Then you transfer those blocks to another device that plays them at the right time (where they’re unwrapped back into an audio stream).

I think I'm in the same boat. I have a rpi, installed home assistant before, I do devOps/sysadmin stuff, setting up virtual machines, docker, creating and contributing to open source etc etc...

... buuuuuuuut, having looked at the article, my eyes started to glaze over, and a sinking despair sipped in quickly... I want to love this, but I just can't bring myself to. I guess I'm at this point of giving in and getting a Sonos :(

I get that. It's not exactly easy. But FWIW it seems quite stable, I'm not having to SSH in and restart services like i did when i tried a year ago. IMO snapcast, librespot, and hifiberry should all get fully integrated into raspbian so that it's easier to set up.

Regarding cost, yeah i think it's only significantly cheaper than Sonos for the same quality if you can configure some of your existing setups to become clients.

I've had a Sonos system for maybe 5 years and just started dismantling it a week ago. The hardware is great, but the apps have always been terrible -- they add just enough friction that I've been subconsciously avoiding using the system for some time now. If you're into voice control, it's probably OK, but I'm not interested in that. The Spotify app (via Spotify Connect) is probably the best interface for Sonos, but I'm not a big Spotify fan and want to be able to easily play from other sources.

I also looked into DIY options and came to the same conclusions about reliability and time spent fiddling with it.

We have mostly Apple devices, so I decided to just give Airplay 2 a shot. I bought a used Airport Express for our living room hi-fi system and a portable Libratone Zipp speaker to use elsewhere (it's in the kitchen right now). If the system continues to work as well as it has over the past week, I'll probably get a couple more Zipps. But because it has its own battery power, it's easy to just unplug and carry it to where I need it, so I don't think we'll need one for every room like we did for Sonos.

Sorry if this is a dumb question, but isn’t Sonos also AirPlay 2 compatible? Or is it locking you into its own walled garden?

Edit: in other words what’s the trade-off between Sonos and Zips in this case?

Definitely not a dumb question. The newest Sonos speakers are Airplay 2 compatible, but mine are older and don't support it. You're right that I could've bought one new Sonos speaker to enable Airplay 2 for my whole system, but I'd always have to group that new speaker with older speaker(s) to use Airplay.

I could replace all my old Sonos gear with the new versions to solve that problem, but that's a pretty expensive proposition. The Sonos One and Zipp aren't that different in price ($200 vs $190), but the Zipp really competes with the $400 Sonos Move portable. And the Sonos Port (connects Sonos directly to a traditional amp) is ridiculously priced at $450, although I suppose I could just use the Airport Express if I'm not going to use the Sonos software.

The real reason, though, is that I don't want voice control and you can't get Sonos speakers that support Airplay 2 but don't have voice control. The Zipp also supports Bluetooth and line-in, so they're more flexible.

Edit: forgot that the Sonos Move also support Bluetooth (but that's their only device that does).

Volumio’s pi OS is a pretty easy way to do this. There’s a Snapcast plugin on github along with instructions. Pair the pi with a hifiberry amp and some speakers and you’ve got your own custom networked audio client.

We’ve got sync’d audio running in 4 different rooms at home and control via home assistant. Not as easy as Sonos I’m sure but I like that I can use whatever speakers I want.

I've recently had some time to go through a spate of "home improvement" (needless tinkering) tech projects.

Replacing alexa and ok google devices with open source ones was on the list. This looks great for the music - though I was mainly stuck for good voice control.

Check out Rhasspy for voice control. IMO it's the best FOSS solution available for this atm.


The holy grail for cheap-ass networked audio is a surround-sound set constructed from random (or a set of) Bluetooth speakers and some sort of wireless receiver. I can't tell you how many people came into my old workplace expected that to be possible, and being disappointed that the only options were somewhat expensive demi-audiophile WiFi-based (read: hooked into an app that required an internet connection and sometimes iOS) solutions from Sonos/Bose/B&W/Klipsch that locked you into their platform. IIUC latency and bandwidth are an issue?

This is a cool step in the right direction though.

I looked into using Bluetooth speakers for smarthome purposes a while ago. The audio is more than good enough, and it's a lot cheaper than "real" speakers. There's one major drawback, though: most BT speakers automatically turn off when they don't recieve audio for a while!

With networked audio, you'd want the speakers to stay on, idling until you want to push audio through them. Having to manually turn them on every time you want to use a speaker pretty much defeats the purpose.

Sad even closed like HomePod which evaluates sound in a room and adjust its sound acoustics go nowhere

Why isn't that possible? It doesn't sound like it would be that hard.

I thought so too, but then, I could never manage it myself. I imagine a solution would be to build a receiver with a Bluetooth antenna for each channel, so that it would be device-agnostic, and a mic port for calibration. Maybe a traditional RCA port for a powered subwoofer.

But if it were so simple, I'm sure someone would have done it by now. There may also be weird licensing issues involved, like perhaps Dolby/DTS don't want to certify such a system, and so access to whatever you need to decode their signals isn't readily available.

I'm not sure you'd even need separate Bluetooth chips/antennas. In theory one device can connect to up to 7 others. Although, to be fair Bluetooth audio streaming is barely reliable with one device so maybe that is just asking too much of it.

Apparently Samsung phones can connect to two devices:


Here's another one:


Yes, dual output is possible (there are receivers that do this today). However, BT4.2's low bandwidth limits the bitrate of sound that can be streamed, and I'm unclear on if each connection can receive different channels (basically, separate streams for each speaker), if it's limited to two identical stereo streams.

I am a layman, though; I just sold the stuff and therefore had an understanding of what people expected to be possible.

I think Bluetooth is just getting there now, so we will probably see more of this going forward.


That's Low Energy Bluetooth though, a totally different thing. You can't do audio through BLE at all before this.

Snapcast seems to also have integrations with Airplay and Home Assistant. This post is also quite nice, I've saved it to use as reference for whenever I get around to setting up Snapcast.

Nice article you can hook up studio monitors like genelec 8010 for a very good sounding setup. Monitors will Likely last a lifetime so better for the environment.

This looks like an interesting project. I found the naming creative: (S)y(n)chronous (a)udio (p)layer.

Could have gone with Synaps. Synchronous Audio Playing System.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact