IR remote decoding in hardware? - Page 1
Forum section: electronics / projects

author: shadewind
author_rank: Frequent Contributor
timestamp: September 02, 2012, 08:18:51 pm
content: I plan on using an IR remote for a project but most guides to this seems to use bit banging for decoding the IR signal. This uses a lot of processing time so I'm wondering if there is a better way to do it than simply polling the GPIO?

author: codeboy2k
author_rank: Super Contributor
timestamp: September 02, 2012, 08:35:06 pm
content: sure. Do it on a small CPLD. you'll need to write the verilog or VHDL code for it, which is not that hard to do if you're already familiar with using HDLs and programmable logic devices.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: September 02, 2012, 08:41:09 pm
content: It needn't take much time - use a capture timer peripheral to measure the interval between edges - this will have fairly minimal processing requirements as data rate is typically only a kbit or two per sec.

author: shadewind
author_rank: Frequent Contributor
timestamp: September 02, 2012, 09:56:55 pm
content: A CPLD sounds a bit overkill and I was already thinking about the exact idea Mike is describing.

author: eliocor
author_rank: Unknown
timestamp: September 02, 2012, 10:31:24 pm
content: I suggest you to use the following Arduino library:http://www.arcfn.com/2009/08/multi-protocol-infrared-remote-library.htmlI ported it to different microcontrollers without too much fuss: it require very few CPU resources (except for the usage of an HW timer)

author: shadewind
author_rank: Frequent Contributor
timestamp: September 03, 2012, 01:33:02 am
content: That uses a repeating timer interrupt. Input capture would probably use less resources since the are no interrupts when nothing is being received.

author: eliocor
author_rank: Unknown
timestamp: September 03, 2012, 01:44:29 am
content: Quote from: shadewind on September 03, 2012, 01:33:02 amYou are right: I modified the code exactly as you wrote (Freescale MC9S08AW60), but even working as in the original code, the burden on the CPU is much lower than what proposed by the original poster.

author: firewalker
author_rank: Super Contributor
timestamp: September 03, 2012, 07:55:17 am
content: Once I used the following library.http://www.mikrocontroller.net/articles/IRMPAlexander.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: September 03, 2012, 08:04:14 am
content: Quote from: shadewind on September 03, 2012, 01:33:02 amThe other thing about capture is it is insensitive to any latency caused by other interrupts, as the counter value is latched in hardware, so you only need to handle it any time before the next edge.

author: amyk
author_rank: Super Contributor
timestamp: September 03, 2012, 08:18:17 am
content: If you know the protocol that the remote uses (and there aren't that many) then there are ICs available that will do all the decoding for you.E.g.http://www.rentron.com/Files/CIP-8.pdfHoltek also makes a few.

author: ptricks
author_rank: Frequent Contributor
timestamp: September 03, 2012, 01:21:24 pm
content: Most of the for sale decoder IC are simply standard off the shelf MCU that are programmed for that task. You don't need anything expensive, something like the $1 pic18F14k22 can do IR decoding for your main application MCU and that pic needs no external parts to work.

author: codeboy2k
author_rank: Super Contributor
timestamp: September 03, 2012, 09:57:19 pm
content: Quote from: shadewind on September 02, 2012, 09:56:55 pmI read your post and thought you didn't even want the micro involved, so I proposed an off chip solution.Often my first go-to solution is a hardware one, not a software one.Mike's solution and other solutions using PIC chips to decode the IR stream are good for this too.