| Electronics > Beginners |
| How do IR remotes wake up on key press? |
| << < (5/6) > >> |
| Peabody:
I got the basic device up and running this afternoon, so now I can enter the target channel as the channel number I'm used to using on Cox Cable, and my device will issue the IR commands needed for the Roku to get to that channel. But haven't addressed the sleep and interrupt issues yet. I think that should all be fairly straighforward since I don't need the ISR to do anything except wake up the processor. |
| Ian.M:
Lets hope it stays in sync reliably. :popcorn: However if not, the best option may be to be to put a smart controller on your LAN where it can interrogate your Roku for its current status. The *easiest* way to do that would be running LIRC on a Raspberry Pi Zero W. On the hardware side of things, just add an IR receiver and you can 'drive' it from any 'dumb' remote that doesn't conflict with any of your other AV kit. Add some small IR LEDs and a beefy driver transistor and you can control AV equipment that isn't network aware, e.g. to turn on the TV, select the input your Roku's on and control the TV volume etc.. On the software side of things, LIRC does all the IR protocol 'heavy lifting' but you will have to write the (probably Python) scripts to tie it all together and talk to the Roku ECP network control API. See: https://camp.isaax.io/en/isaax-examples/ir-control-via-lirc-on-raspberry-pi-zero-w https://developer.roku.com/en-gb/docs/developer-program/discovery/external-control-api.md and, for an actual implementation of Roku ECP control, albeit on an ESP8266: https://blog.adafruit.com/2018/09/29/homemade-roku-remote-uses-roku-external-control-api-huzzah-esp8266/ which should save you much wading through the ECP API documentation and much headscratching! :phew: |
| Peabody:
I found that the Roku stays in sync if the interval between IR commands is 400ms, but it couldn't keep up at 250ms, and I ended up one channel short of the target. But at the slower speed it has yet to fail. I did the IR version because I had the parts to do it. But it turns out there are three ways to communicate with the Roku. In addition to IR, there appears to be an RF remote option, which is a direct RF communication (not through the router) between the remote and the Roku. Apparently Roku sticks have to use that because they have no IR, but I think all modern Rokus come with such an RF remote. I haven't found any information about how that works. But then there's the ECP thing, which takes place over the LAN using the Roku's IP address. I assume that's what the iOS and Android Roku apps use. The ESP8266 device you linked to is what I would fall back to if IR doesn't work well in the end. Since this would be battery powered, I think this would be a better option than a Pi, and of course much less expensive. But one thing isn't clear to me. It seems with ECP you can command the Roku to play a specific channel by name. But in my case the channels I want are within Sling, so they are one level down from the Roku Sling channel. I don't see a way to send commands to Sling. I'm thinking of using the * key to tell the Arduino what the current Sling channel actually is - in case it gets out of sync - or maybe just reset it to the first channel. And maybe the # key could tell my TV to toggle the input between HDMI and OTA. I might even throw caution to the winds and get a 4x4 keypad. :-) |
| Ian.M:
The Pi would sit next to the Roku powered with a wallwart and itself controlled over IR from a dumb(ish) off-the-shelf remote, e.g. a universal one programmed for a brand of kit you don't own. If not all the commands/functions you need are accessible by ECP, you could use a hybrid approach: Use ECP to get the Roku into a known state as close as possible to the desired state then transmit IR commands from the Pi using LIRC to get the Roku into the desired final state. Although the Pi Zero W sold ''bare board' seems to be in short supply stateside (probably due to the poor profit margin for resellers if they aren't packaging them with accessories), Adafruit have it in stock for $10 USD, rationed to one per customer. Apart from a SD card, the Pi just needs a wallwart, an IR LED + driver transistor, and an IR receiver module, + a remote to control it, all of which can be scavenged from dead AV kit. An 8 GB micro SD card should be findable for around $5, so all in, it should be under $20. I think that's reasonably competitive against having to build custom handheld remote. Heck the case and keypad could well set you back more than that. To get going with it, you can headlessly tether it to your PC as a RNDIS device (USB 'ethernet adapter') and activate SSH, by editing files on its SD card, then once you've got a console over SSH, and have bridged the Pi RNDIS adapter to your PC's LAN adapter to let it use your internet, you can SSH into it to install VNC and then VNC to its desktop with full access (except for video playback) from your PC's mouse, screen and keyboard. Of course its *EASIER* if you can hook it to a monitor to check progress but its certainly not essential. Hint: To tether it, use a really short USB data cable that came with a phone you have retired, as cheap dollar store USB leads tend to drop too much voltage for a Pi Zero W to be stable tethered. |
| Peabody:
I'm sorry, Ian, but I think you greatly over-estimate my level of knowledge. I don't know what LIRC, RNDIS or VNC are, and have never used a Pi or Linux. And I don't understand the need for a Pi when it appears even for the networked version an ESP8266 remote could do the same thing without the need for any IR - as in your earlier referenced Huzzah-based remote. As for the cost, the total for the Arduino Pro Mini, keypad, 18650 and 18650 holder would be about $18, and that's even paying up for US sources for fast delivery. Don't know about the enclosure yet. I already have the IR LED and an 18650 charger. Since the breadboard version of the IR remote is already working, I think for now I'm going to just get that into finished form and be done with it. If in the end it's not up to the task, the ESP8266 would be the next step. |
| Navigation |
| Message Index |
| Next page |
| Previous page |