Martin's corner on the web

Receiving IR with Funky v2

I ran a quick test today to see how Ken Shirriff’s IR library behaves on the Funky v2. One of the things I noticed in my current design is that I don’t have a pin with timer output routed to the side header, so I changed that in the final product to enable easy IR sending. So until then, I decided to test out the receiving part; Using Ken’s library it is a minimal effort. Ken has a quite interesting sketch that allows using arbitrary remotes, not just recognized ones. How this works is by creating an unique 32bit hash for each different code it receives. This means that we don’t need to decode an IR protocol in order to use it, we just make sure that each key on it generates an unique 32bit has, and this is exactly what Ken’s sketch does. I modified slightly the sketch to  print  decoded value if protocol is known and the 32bit has just in case we use unknown remote. Note that hashing works one way only i.e. you can find out that a specific key was pressed, but you cannot recreate the IR pulse train from that hash to send it back. Still this is a perfect approach for sending remote commands to the Funky v2, which in turn will print them to the serial; Since Funky’s serial happens to be the virtual (CDC) serial / COM port, that means we can simply plug the Funky v2 to Raspberry Pi’s USB port and it will spit out the IR codes it receives to /dev/ttyACM0 .. cool. Just plug the Funky, no driver installation is needed, and it will talk to that port.

Here is it running:

IMG_1947 IMG_1948So the possible application for this is to send remote commands to the Raspberry Pi, a simple script will just wait on /dev/ttyACM0 and parse out known hashes, then execute certain actions. Another fun application would be the serial to TCP redirector in Python. If placed near my TV, I can examine my couch potato habits and log them 🙂

Another project that I will try once I get my revised PCBs is an IR bridge over RFM12b, just capture raw timings, compress and send to another Funky that will replay them.