Using an Arduino to Program New Codes Into a Universal Remote
I picked up an old Roku at a garage sale recently. I was interested in it because it has composite video out on it in addition to the HDMI, so I would be able to hook it up to some of my older TVs that I have around the house. The owners had lost the remote, but since there’s what appears to be an IR window on the front, I figured I could probably use one of the numerous universal remotes I have. Unfortunately none of my remotes have built-in codes for the Roku. Since at least one of my remotes is a learning remote, I decided I’d use an Arduino to program new codes into the remote. I also can’t use a phone for a remote until I have the Roku joined to the WiFi.
There’s plenty of IR remote examples out there for the Arduino, and very few parts are needed to build both a transmitter and receiver. I really only need to do transmitting in order to control the Roku, but since I had the parts I built the receiver too.
I was able to find codes for the Roku, but they are in Pronto format. The Pronto format is a huge list of hex numbers, but for the most part it’s just a sequence of on/off pulse lengths. The format was simple enough to decode so I converted the hex sequence into pulse lengths and was able to transmit the “down” code to the Roku. Sure enough, the Roku responded. Now that I know the codes are correct and the Roku is working, the next step was to program the remote.
Programming the remote was fairly straightforward. I put the remote into learning mode and then told the Arduino to send the code for one of the Roku buttons. The only catch was that I needed to continue to send the button code until the universal remote signaled that it had learned the code. Since I was manually cutting & pasting, I just repeated the sequence a bunch of times before pasting. I found that sending the code twelve times in a row was enough for the universal remote to learn the codes.
I’ve attached the Arduino code and the converted Roku codes below.
- simple-ir.ino - Source for Arduino IR [2.84 kB]
- Roku.txt - Roku codes for remote [1.88 kB]