I recently got given a PacMan Lamp (which can be bought from Firebox) from microsoft because I published a windows store app (called Space Race for those who are interested - its a phonics game for young children learning English!)
The lamp comes with a little remote that lets you select any colour. I just had to figure out how to control this thing with an arduino!
I took the remote to bits, but quickly realized I was going to have to solder a wire per button at least, and this would hardly scale - so I decided the next best option would be to simulate the IR the remote produces.
Lady Ada has a brilliant guide I used to read the IR signals via the arduino. To do this you will need a IR Detector, which I found to hand
Well, I say to hand... No kids toys were (permanently) broken you will be happy to hear
After hooking it all up to the Arduino I was able to pull out the timings of the "On" periods vs the "Off" periods. As advised you ignore the first off, and then look at the time periods for on vs off. It became pretty apparent that most times were around 530 µs, or 1620 µs, and the on periods were always the short time.
Once I had profiled several of the buttons I turned the "Off" periods into binary with the short period representing 0s, and the long periods representing 1s (as shown by column J in the screenshot above.
With enough codes it became fairly obvious that the first 16 bits where always "0000000011110", and the final 3 bits were always "111". After scratching my head for a bit I realised that the first 5 bits, and the last 5 bits where the only things that changed (the middle bits where always "000", and once I had pulled the bits that changed out it was really obvious that they were just the inverse of each other
Now all I had to do was write an arduino script that would take 5 bits, and translate it into the code, and then correctly send it to the IR pins. Heavily borrowing from the sample code Lady Ada provided I was pretty easily able to implement the algorithm. Feel free to grab the code from my GitHub repository. Once you have uploaded your code you will need to add an IR Diode to your arduino as shown in this image (ignore the stuff to the right of the image - thats for hooking up the IR Detector)(Image from Lady Ada's site)
Now with everything loaded I needed to create a little app that would fire some commands at it. I created the following little library class that wraps everything up.
To use it simply construct the object (passing in the com port the arduino is connected to, then call do command passing in a command you want) as shown below
I'd love to hear what you use this for - I have just hooked mine up to Lync (its like skype for business). It now flashes white and blue when I get a call and when I'm not getting called it's coloured the same as my lync presence. I'll get a video up asap.