The Raspberry Pi As An IR To WiFi Bridge

[Jason] has a Sonos home sound system, with a bunch of speakers connected via WiFi. [Jason] also has a universal remote designed and manufactured in a universe where WiFi doesn’t exist. The Sonos can not be controlled via infrared. There’s an obvious problem here, but luckily tiny Linux computers with WiFi cost $10, and IR receivers cost $2. The result is an IR to WiFi bridge to control all those ‘smart’ home audio solutions.

The only thing [Jason] needed to control his Sonos from a universal remote is an IR receiver and a Raspberry Pi Zero W. The circuit is simple – just connect the power and ground of the IR receiver to the Pi, and plug the third pin of the receiver into a GPIO pin. The new, fancy official Raspberry Pi Zero enclosure is perfect for this build, allowing a little IR-transparent piece of epoxy poking out of a hole designed for the Pi camera.

For the software, [Jason] turned to Node JS, and LIRC, a piece of software that decodes IR signals. With the GPIO pin defined, [Jason] set up the driver and used the Sonos HTTP API to send commands to his audio unit. There’s a lot of futzing about with text files for this build, but the results speak for themselves: [Jason] can now use a universal remote with everything in his home stereo now.

28 thoughts on “The Raspberry Pi As An IR To WiFi Bridge

    1. adafruit has them for $10. If they are currently out of stock, put in your email address and they will send you an email when they are in stock. Respond quickly and you can get one.

      If you are being completely unreasonable and expect one for $10 with free shipping, I can’t help you.

      1. my subjective impression is that they are always out of stock. looking today, they are out of stock. sniping at a small time window is more like a promotional give-away than a generally-available product. the pi zero’s low price is a fraud of one sort or another and pretending it isn’t is dishonest.

        1. So, just because, I guess, I moseyed on over to, and purchased a Pi Zero W just now. With exchange rate from British Pounds to USD, I ended up paying $10.15 USD, shipped. Yes, it will take a couple weeks to get here. Adafruit sells out fast, sure, but it’s not promotional in nature, they only get so much stock, and they’re importing them in bulk, which has more hassle at customs than a single tiny package.

          Even back when people were always complaining about the low availability of the first Pi Zero’s it was relatively easy to get one from British retailers, they are a British company after all.

    1. +1. An ESP8266 boots in less than a second, uses less power than a Pi Zero, needs no SD card, can be powered off at any time and is smaller than a Zero. Most importantly, it’s cheaper and easier to find.
      Why did this guy use a Pi Zero for such a simple task? Probably only to advertise and to get his work featured here as a Pi “hack”…

      1. Or, y’know, cause it’s what he had on-hand. You’re right that this is a job better-suited to one of the ESP-family devices, but there is value in reminding people that the Pi ZeroW has GPIO that are easy to access.

        1. And the ESP8266 doesn’t? Both aren’t breadboard friendly, and soldering the wires directly to the GPIO defeats your assumption that it’s the accessibility that was the deciding factor here.

    2. Isn’t this the complete opposite to the original post?
      This is about controlling internet only systems with infrared, your link is about using WiFi to control systems that already use infrared. An I misdating something?

    1. if its a typical amplified/filtered (integrated) 38khz ir receiver, no; its an output device, so the cpu only reads from it. you should have a .1uf bypass close to pwr/gnd on the receiver module. you could add a ‘safety’ resistor of, say, 1k, in series with the ir’s output, just in case your gpio is set to output mode instead of input.

    1. You have a cool hack too. This one turns the IR into HTTP requests for the local network. Having worked with Sonos before, I can tell you that it is a lot of work to control it. Sonos does not have a published API and the commands are difficult to replicate on an ESP. For example, you have to track the state of the Sonos and set the volume proportionally. The trick in this hack is that the Pi is hosting a node.js app that interfaces to the Sonos and does the heavy lifting. From that point, anything could listen to the IR and send the commands to the Pi server.

  1. I did originally plan to use the ESP8266. But communicating directly with a Sonos speaker is a nightmare without the node.js library doing the heavy lifting. I suppose I could have hosted the node service somewhere else on my network and sent the calls to it from an ESP8266, but I was going for an all-in-one solution. Since the Pi Zero can run node.js itself, I was able to put everything on one device.

    1. I wish this was in the HaD article text! I (like others, apparently) wondered why an ESP8266 wasn’t used, but this makes perfect sense. I’m sure that with enough time someone could write a full Sonos library for the ESP, but if the Pi can do it all already, you might as well go with what works. Nicely done!

  2. What I love the most about *this text* written to that project is how “simple” it looks, at least from the perspective of the finished product (an IR-to-Wifi bridge). Surely the theory behind all that (node.js, LIRC, etc etc) is much uglyer.

  3. I’d like to make one, but the other way round… I have older devices that only use IR and I just upgraded to the Google pixel XL from the hrc M8… I have been missing my integrated it blaster.

    I was thinking I could write a simple app to send commands over the network and the pi would send them out an Omni directional ir transmitter…hololight

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.