Saturday, April 03, 2010

rcIR



rcIR (v1.0 - 4/3/2010)
source code included

Here is a little command line utility I wrote to help reboot the Hauppauge HD PVR on a regular schedule (say 4am every morning) using IR blasting. You need a few additional items for this to work:
- $5.62 Universal IR Remote Controlled AC Outlet for Appliances (110V)
- $50-55 usbuirt
- Any IR remote control with a button you don't use in the immediate area.

The basic idea is you hook up the HD PVR (or really any device you want to reboot) to the IR plug. The IR plug learns the remote button press. Then, you use rcIR to learn the same signal which saves it as some long hex looking string. After that you want to place the usbuirt near the IR plug. Use windows task scheduler to schedule when to run rcIR. It will blast whatever IR code you pass to it, wait a number of seconds you specify, and blast the IR signal a second time. This will trigger the IR plug to turn off (basically cut power at the outlet to the hd pvr) and then turn it back on basically doing a power cycle for you. It works and seems pretty reliable as long as you have the IR plug and the usbuirt positioned correctly. USBUIRT is pretty powerful and can usually even bounce off a wall and still trigger the IR plug.

Example:
- rcIR (no parameters): short help and description.
- rcIR learn
- hold the remote control about 1 inch from the usbuirt and hold down a button. Make sure you get 100% signal quality otherwise try it again. It should display some long IR code like this:
Learned IR Code = F42R0395815480AA163F1615163F1615151516151615154015161515161516151540154015151615161516151515163F163F163F16151615151615151615161515151615163F163F16|075881555516
It's also written to the log. Copy that into the clipboard.
- rcIR reboot "F42R0395815480AA163F1615163F1615151516151615154015161515161516151540154015151615161516151515163F163F163F16151615151615151615161515151615163F163F16|075881555516" 10
Make sure you use quotes around the IR code. This means blast the above ir code, wait 10 seconds, then blast the ir code again. This simulates a "toggle" to reboot a device. If you have a device that has separate on/off ir codes just pass 0 for waitsec and it will only send the IR signal once. Then you could basically just run rcIR twice back to back each with a different IR code.