I recently made a neat little gadget with my Arduino Mega that controls my Xbox 360. It uses the remote control codes from the lirc project. I used an old keypad and an infrared led I found at a hamfest. Its works really good for controlling Hulu and Netflix. I used to have to turn the controller on and wait for it to connect when all I wanted to do is pause the video. With this I just turn on the Arduino and press the pause button and the Xbox pauses the video. It is so much easier now to control the xbox. What I would really like to do is turn it into a permanent device with maybe a touch screen and learning capabilities. Then it would be just like one of the logitech 100 dollar remotes. As of right now it runs on my breadboard. The infrared led is controlled with a library from the experimental branch of Ken Shirriff’s IR library. My version of the library also includes the ability to control Panasonic devices. I previously used it to control my 50″ Panasonic. The library uses the pwm output of timer 2 on the arduino, which on the mega is pin 9. Ken’s blog says pin 3 but that is for the Arduino Uno. The circuit includes a transistor because it is drawing more current than a pwm pin can supply. I didn’t have any low value resistors, so I hooked four 220 ohm resistors in parallel. I also modified the Keypad library from the arduino.cc playground to work with my old non-matrix keypad. Both modified versions of the libraries are available on Github here KeypadSimple and here IRremote.
Here are some pictures of it wired up on the breadboard. Click on any of them to get a close up.
I’m getting so much trouble trying to Xbox 360 receive the RC6 codes from the arduino. Do you mind sending me/ posting your sketch to see how you did it?
Thank you!
Sure. Here is the inital code I used before I started experimenting with some other aspects of it. Xbox360Remote.ino – GitHub.com You have to make sure the IR LED is being supplied with enough current. Even with the 220 ohm resistor I had in series, the IR output was still far inferior to my remote controls for my TV and other devices. It required me to point the LED directly at the xbox because it was not bright enough with the current that was being supplied to it. I do vaguely remember something about having problems with the RC6 codes myself. It may have been due to the endianess of the AVR CPU. In which case the binary of the RC6 codes would have to be reversed or at least taken into account when transmitting.
Wow! That’s great I edited the code to get working from the serial monitor and Baam! Worked straightaway! I’ll study a little more what you’ve done here to understand where were my flaws. But I already have a question: why did you used PROGMEM instead of the common SRAM? Do you think that the SRAM memory would be easily fill up with the 64 ints?
Soon I will make a post about it on my blog (mariocarta.tumblr.com). Do you mind if I link to your code or post a simpler example based on your code?
Sorry to reply only now… Because I only was notified today! (Weird!)
Thank you, my friend!
It might if the chip is of the smaller variety. The atMega 168 for example only has 1K of sram but 16K of flash. The array for the 64-bit progmem constants use 360 bytes alone. Thats a pretty good chunk of ram for the more diminutive versions of the Arduino. There are some newer implementations of progmem declarations that allow for easier to read code. Though, I haven’t played with it for a while.
Sure. I really need to add a README file to the repo at github. Here is the repo I forked the ir library from https://github.com/shirriff/Arduino-IRremote. My version has some additions to it to control my xbox with 64-bit RC6 codes. My fork of the ir library can be found here https://github.com/infomaniac50/Arduino-IRremote.
It’s not your fault, by default wordpress doesn’t send email updates to comment replies. There is not an option to configure such a function either. I had assumed that emails were sent out automatically much like forums do. As I found out that is not the case and is the correct behavior. We wouldn’t want all the WordPress installs out there spamming people with comment updates when the server doesn’t allow it or is not configured properly. I have added a plugin to address that problem.
I can’t believe this! I dumped all the code of my Xbox IR Controller and used this data instead of Shirriff’s or LIRC’s. I’ve been struggling on this for months only to realise, viewing your code, that mine was missing the final c before the LL of the OnOff code. I’ve must deleted it when commenting the code or something like this. I was thinking that the master branch of the IRRemote lib was without this features or that was a problem with types or typecasting. Now everthing is working fine! Except, of course, this toggle bit that makes everything harder if you are trying to automate. I wish we could have a better way to handle this instead of the guess work or tweak it manually before using.
But I enjoyed the way you handled the Serial.print for the ULL!
Thank you again!
PS: WP sent me your reply notification right away this time!
Have you made this into a permanent touchscreen remote yet? I’m looking to do that for my TV/Surround/Apple TV/Xbox and would love to see how you set it up!
No I have not. That would be an interesting project though. I also don’t have a touchscreen to play with. I imagine it would be similar to a Logitech Harmony remote. Though it might take quite a bit of CPU time away from the underpowered arduino. Unless you had a shield with its own graphics processor. I believe adafruit.com has such a product but I don’t remember what it was called. It had an AVR32 mcu on the shield that could be controlled through either SPI or I2C. Not sure on that one “SPI or I2C”. The shield’s mcu could even be flashed with a different program I believe. Also if you are going to battery powered route then you may have to opt for a bare avr solution as the arduino’s regulator uses power regardless of the mcu’s power save mode. A bare avr can get down to micro amps range if you power down all of its functions short of a cpu interrupt and a watchdog timer for brown outs. It would also save you the time of waiting on the bootloader to init the main program since it waits a short bit to look for new code on the uart at startup.
Right, it would be exactly like the Harmony remote. I haven’t found a project identical to this online yet, but by piecing together different projects I’ve determined that the shield would be the best option. I’m going to hard wire this into my desk, so I won’t need to bother with a battery. After the bootloader initializes the main program the first time it won’t have to again, correct?
I’m fairly new to arduino programming, so I really appreciate your guidance.