Author Topic: IR remote decoding in hardware?  (Read 4768 times)

0 Members and 1 Guest are viewing this topic.

Offline shadewindTopic starter

  • Frequent Contributor
  • **
  • Posts: 329
IR remote decoding in hardware?
« on: September 02, 2012, 08:18:51 pm »
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?
 

Offline codeboy2k

  • Super Contributor
  • ***
  • Posts: 1836
  • Country: ca
Re: IR remote decoding in hardware?
« Reply #1 on: September 02, 2012, 08:35:06 pm »
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.
 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 13987
  • Country: gb
    • Mike's Electric Stuff
Re: IR remote decoding in hardware?
« Reply #2 on: September 02, 2012, 08:41:09 pm »
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.
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline shadewindTopic starter

  • Frequent Contributor
  • **
  • Posts: 329
Re: IR remote decoding in hardware?
« Reply #3 on: September 02, 2012, 09:56:55 pm »
A CPLD sounds a bit overkill and I was already thinking about the exact idea Mike is describing.
 

Offline eliocor

  • Supporter
  • ****
  • Posts: 522
  • Country: it
    • rhodiatoce
Re: IR remote decoding in hardware?
« Reply #4 on: September 02, 2012, 10:31:24 pm »
I suggest you to use the following Arduino library:
http://www.arcfn.com/2009/08/multi-protocol-infrared-remote-library.html
I ported it to different microcontrollers without too much fuss: it require very few CPU resources (except for the usage of an HW timer)
 

Offline shadewindTopic starter

  • Frequent Contributor
  • **
  • Posts: 329
Re: IR remote decoding in hardware?
« Reply #5 on: September 03, 2012, 01:33:02 am »
That uses a repeating timer interrupt. Input capture would probably use less resources since the are no interrupts when nothing is being received.
 

Offline eliocor

  • Supporter
  • ****
  • Posts: 522
  • Country: it
    • rhodiatoce
Re: IR remote decoding in hardware?
« Reply #6 on: September 03, 2012, 01:44:29 am »
That uses a repeating timer interrupt. Input capture would probably use less resources since the are no interrupts when nothing is being received.
You 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.
 

Offline firewalker

  • Super Contributor
  • ***
  • Posts: 2452
  • Country: gr
Re: IR remote decoding in hardware?
« Reply #7 on: September 03, 2012, 07:55:17 am »
Once I used the following library.

http://www.mikrocontroller.net/articles/IRMP

Alexander.
Become a realist, stay a dreamer.

 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 13987
  • Country: gb
    • Mike's Electric Stuff
Re: IR remote decoding in hardware?
« Reply #8 on: September 03, 2012, 08:04:14 am »
That uses a repeating timer interrupt. Input capture would probably use less resources since the are no interrupts when nothing is being received.
The 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.
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline amyk

  • Super Contributor
  • ***
  • Posts: 8414
Re: IR remote decoding in hardware?
« Reply #9 on: September 03, 2012, 08:18:17 am »
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.pdf

Holtek also makes a few.
 

Offline ptricks

  • Frequent Contributor
  • **
  • Posts: 672
  • Country: us
Re: IR remote decoding in hardware?
« Reply #10 on: September 03, 2012, 01:21:24 pm »
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.

 

Offline codeboy2k

  • Super Contributor
  • ***
  • Posts: 1836
  • Country: ca
Re: IR remote decoding in hardware?
« Reply #11 on: September 03, 2012, 09:57:19 pm »
A CPLD sounds a bit overkill and I was already thinking about the exact idea Mike is describing.

I 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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf