[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.
Where can you get a pi zero for $10?
I’m not sure if you’re implying that the Pi Zero W is more or less than $10 (the original Zero is $5, W is $10), but here you go:
https://www.raspberrypi.org/blog/raspberry-pi-zero-w-joins-family/
Retailer links at the bottom of the article.
Australia.
</bait>
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.
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.
So, just because, I guess, I moseyed on over to pimoroni.com, 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.
Use a ESP32 this task does not required more.
I can not imagine, that it needs more than an ESP8266. IR decoding was already done decades ago with 8051 CPUs with 12MHz (1MHz cycle clock)
Perhaps, but the ESP8266 can’t do A/D conversion while the WiFi is active.
Why would you do something like that? Use TSOP IR receiver and you get a nice clean digital signal.
Looks like two for $10 @canakits.com– you said pi zero
or $10 for the Pi zero Wireless
If you really want to do it on a dime have a look at https://community.home-assistant.io/t/esp8266-cheap-ir-remote/3140
+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”…
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.
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.
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?
You are right, that post is about the opposite direction (my bad :-(), however it seems quite possible to use a ESP for IR control of a wifi target, e.g. using https://github.com/arpruss/esp8266ir
I haven’t got a Sonos unit, however https://github.com/tmittet/sonos claims to be able to fully control a Sonos unit on an arduino, so at least in theory it should be possible to run the whole thing on an ESP.
should this sensor have a resistor to limit the current?
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.
But the recommended application schematic for tsop31236 includes a 100 ohm resistor on the Vs pin
I did this a few days ago with an Arduino Wemos and a eBay receiver kit…I’m pushing the data to MQTT The whole thing cost me $6.50…
Here’s a link to my writeup if anyone is interetsed in another way to do this…. http://guyfromhe.blogspot.ca/2017/04/ir2mqtt.html
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.
Where was all this two months ago?
I ended up using Arduino with an ethernet shield. I like hard wired. http://mbarland.blogspot.com/2017/03/ir-to-ip-bridge-with-arduino.html
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.
Makes sense if you want it as an all in one. An OrangePi would also be a good choice for this. Maybe as an all in one Echo like system as well as a wifi, IR, MQTT, bluetooth bridge.
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!
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.
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