Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

RC6 Decoder Class


  • Please log in to reply
9 replies to this topic

#1 phil

phil

    Member

  • Members
  • PipPip
  • 11 posts

Posted 23 August 2010 - 02:02 PM

As promised a class and a sample program using it that decodes the IR signals from RC6 remote controls. I used a Vishay TSOP34836 IR receiver connected as follows: Pin 1 (output) to netduino D7 input Pin 2 (GND) to netduino GND pin Pin 3 (VS) to netduino 3V3 pin I have attached a copy of the datasheet for the IR receiver, the decoder class, and a sample program that uses it, and just prints out the control values when a code is received. To use the class, you create an InterruptPort for the pin that the IR receiver output is connected to an event handler for when a code is received. You then set the public attribute in the class for the RC input pin to that InterruptPort. You MUST use an interrupt port - forget pin polling, it simply will not be fast enough. I measured the decode process as taking about 40ms. It is seriously not optimised - there are several opportunities to reduce the memory footprint and execution speed. However as the remote I'm using repeats codes every 75ms this is plenty fast enough to decode a repeated transmission. The theory of operation is simple. As each pulse level changes, the time of the edge is recorded in an array. Once we get a "quiet time" (the pulses stop) the timer will be triggered and the decode process commences. I have written that to be as easy to follow as I can, to make it easy to adapt to other IR code types. I have added some commented out debugs for various failure conditions. One of the tricks with the RC6 protocol is that it uses Manchester encoding. This is where 1's and 0's are encoded not by a signal level, but by a *change* in level of a signal. A 1 is encoded in this instance by the signal changing from a high to a low, and a 0 is encoded by a signal changing from a low to a high. Thus, when we record pulses, we're recording the "middle" of the bits (big hint there on how to massively optimise this program! :^) I show the details of this as decoding a sequence of half-bits, depending on the pulse time. There are many different IR protocols. The only reason I am using RC6 is I have access to piles of Microsoft Media Centre remotes (I work with a company that buys MCs and uses them for display units, and the remotes are just tossed out). The remotes in your house probably use as many different protocols as you have remotes. You can see the RC6 protocol explained at: http://www.sbproject...edge/ir/rc6.htm If you do not know what protocol your remote uses, then use this class and look at the state and timing arrays when the decode method is first called. You should be able to work out what the protocol is from those, and then you'll have to rewrite the decoder, of course! That page has most of the other protocols explained as well. Have fun .. I hope someone find this useful. I'm going to go the next step in a few days, if I get time, and add 8 MOSFET drivers to the sensor. I can then use the remote to individually dim up to 8 MR16 LED downlights (6W = 0.5A a piece). I can then create some cool mood lighting in a couple of the rooms of my house with remote control. Fun! We're actually planning to use the netduino as a dev tool for some commercial products, but right now I'm just exploring the capabilities of this processor (I also have a pile of other .net MF demo kits with different CPUs of varying types and speeds, so we can get our heads around the potential of these devices and the .net MF). PS - the big hint about optimisation .. imagine that the edge tells you what a bit was! The time since the last transition tells you what kind of bit it was (leader, trailer, etc). Something for the keen folks to play with. Phil

Attached Files


  • Woodchuck2000 and Voliverio like this

#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 23 August 2010 - 03:22 PM

Phil, that's pretty awesome. I believe that's the first Netduino projects using an InterruptPort to decode an incoming signal. Neat! Phase 2 sounds awesome as well. Chris
  • phil likes this

#3 Woodchuck2000

Woodchuck2000

    New Member

  • Members
  • Pip
  • 1 posts

Posted 04 September 2011 - 05:16 PM

Brilliant! Spent a couple of hours trying to hack something together based on a serial port running at 48KHz and had no luck so decided to Google it. This works beautifully without any modifications, and thanks for keeping everything clear and easy to follow.

#4 Tek10

Tek10

    New Member

  • Members
  • Pip
  • 6 posts

Posted 28 September 2011 - 04:43 AM

just getting started with netduino and this looked like a cool project. What was hoping to do is detect any remote controls codes and be able to send them codes thru code. I've run this but my remote (Comcast remote) just reports.. Code=0x00000000 This will come up for every button push anywhere from 2 to 8 times. Any help would be appreciated.

#5 jpr

jpr

    New Member

  • Members
  • Pip
  • 2 posts

Posted 30 December 2011 - 10:26 AM

just getting started with netduino and this looked like a cool project. What was hoping to do is detect any remote controls codes and be able to send them codes thru code. I've run this but my remote (Comcast remote) just reports..

Code=0x00000000

This will come up for every button push anywhere from 2 to 8 times. Any help would be appreciated.


I have the exact same problem, any solution yet?

#6 wood

wood

    New Member

  • Members
  • Pip
  • 9 posts

Posted 24 January 2012 - 01:42 AM

I'm only getting the "Code=0x00000000" output as well. Any suggestions?

#7 Alexa

Alexa

    New Member

  • Members
  • Pip
  • 5 posts

Posted 03 December 2012 - 06:08 AM

I'm only getting the "Code=0x00000000" output as well. Any suggestions?


You all may not be using Philips RC-6 remotes. My NEC remote (which I'm hacking this library to use), displays similar output. The OP's earlier post links to reference pages which should help you modify his classes to support more remotes.

#8 Voliverio

Voliverio

    New Member

  • Members
  • Pip
  • 1 posts

Posted 11 May 2013 - 04:08 AM

Hi Phil,

 

Great Post, I just decoded my Philips television remote control, but now I'll begin my search in how to transmit the data using IR trasmitter!

 

Anyone got any help on doing this?

 

Thank you!



#9 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 13 May 2013 - 09:43 AM

Phil, this is great since I'm a big fan of using IR remotes in my Netduino projects.
 

I've been using this NEC IR-receiver class which works great with many of the cheap credit card sized remotes available on eBay:

http://forums.netdui...col-ir-decoder/

 

It works well but does not support command repetition (such as volume adjustment).

 

I'm using it in several projects including my CD-player and I2C-driven LCD.

 

Hi Phil,

 

Great Post, I just decoded my Philips television remote control, but now I'll begin my search in how to transmit the data using IR trasmitter!

 

Anyone got any help on doing this?

 

Thank you!

You should be able to use SPI to send IR. Have a look at this thread on how to accomplish that:

 

http://forums.netdui...ased-ir-remote/

 

In the same thread I also wrote about how IR-transmissions are modulated in general using so called "burst pairs".



#10 ToniA

ToniA

    Advanced Member

  • Members
  • PipPipPip
  • 40 posts

Posted 13 May 2013 - 05:10 PM

Would this be of any help: http://forums.netdui...er-on-netduino/

 

I've used this to decode Panasonic split-unit air conditioner IR protocols. I also have a project to control those remotely using Arduino, also on my Github page.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.