Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

Infra red decoding and re-encoding

Infra red decoding and re-encoding

2009-08-11 by Dave McLaughlin

Hi All,

 

I originally posted this on the Codevision AVR list and then realised it was
not the right place so I searched to find the best place to post it and
found this list instead so I hope it is the correct place to post?

 

 

I am developing some home automation gear for my apartment. When I lived in
the UK all the heating was controlled over CAN bus but now that I am in the
Far East I only have air con to deal with. The problem is that I can't run
cables here as I live in an apartment block and most of the walls are
concrete with a few exceptions. What I have developed is a small module
based around a www.display3000.com ATMega2561 based board with TFT display
and putting this on my own motherboard with a Zigbee Pro radio module. 

 

The radio part is easy and working.

 

The part that I am trying to improve upon is the Infra Red input and output.
Doing a search I can find loads of RC5 decoding but the problem is that the
aircon units here are all National (Panasonic) so the infra red code is very
different. I also need it to work with other aircons in the future. Using
the logic analyser it appears to be around 30+bits for each button press.
There doesn't appear to be a discrete ON/OFF, rather it causes the unit to
toggle ON or OFF at each command transmission. The output from the Infra Red
receiver is connected to an interrupt pin. I also have an infra red emitter
connected to one of the timer output pins via a drive transistor.

 

The code is designed such that the user selects from a menu, the programme
mode and then points the original remote control at the receiver and the
device then reads the pulse stream. I have developed some code to look for a
start from the remote and using one of the timers, time the high and low
times and store these in memory.  Not very efficient on memory as I am using
around 120 bytes to store the 16 bit time and the HIGH or LOW state. I have
not tried using an 8 bit timer and this was next on my list. I could store
the HIGH or LOW in the top bit of the 16 bit value and this would reduce the
count by about 30 bytes.

 

For transmission, I setup a timer for a 38Khz output and then just switch
the PORT bit on or OFF based on the original times recorded during the
reception phase.

 

As for ON or OFF I have to keep a flag in the code to know what state the
unit was last in. This works fine until my partner switches the ac with the
original remote. Something I am still trying to train her for  :o)

 

I am still looking at a way to do this more effectively as I would like to
be able to do temp control from the unit also. At present, all it does is
switch on or off the aircon. I would need to be able to decode the infra red
bit stream and so far have not been able to find anything on the net that
describes the encoding scheme used. 

 

I would appreciate any thoughts you all might have on how I could improve
this system? I am not looking for help with the code as I can do that
myself, what I am looking for is some ideas on how to improve what I have
attempted so far.

 

I have built 2 systems so far and have 4 aircons in total to control.

 

PS. These little TFT displays are well cool.

 

Regards
Dave.

 

 



[Non-text portions of this message have been removed]

Re: Infra red decoding and re-encoding

2009-08-12 by stevech11

Look in the Projects archive of avrfreaks.net. Among others, the TWIRP project.


--- In AVR-Chat@yahoogroups.com, "Dave McLaughlin" <dave_mclaughlin@...> wrote:
Show quoted textHide quoted text
>
> Hi All,
> 
>  
> 
> I originally posted this on the Codevision AVR list and then realised it was
> not the right place so I searched to find the best place to post it and
> found this list instead so I hope it is the correct place to post?
> 
>  
> 
>  
> 
> I am developing some home automation gear for my apartment. When I lived in
> the UK all the heating was controlled over CAN bus but now that I am in the
> Far East I only have air con to deal with. The problem is that I can't run
> cables here as I live in an apartment block and most of the walls are
> concrete with a few exceptions. What I have developed is a small module
> based around a www.display3000.com ATMega2561 based board with TFT display
> and putting this on my own motherboard with a Zigbee Pro radio module. 
> 
>  
> 
> The radio part is easy and working.
> 
>  
> 
> The part that I am trying to improve upon is the Infra Red input and output.
> Doing a search I can find loads of RC5 decoding but the problem is that the
> aircon units here are all National (Panasonic) so the infra red code is very
> different. I also need it to work with other aircons in the future. Using
> the logic analyser it appears to be around 30+bits for each button press.
> There doesn't appear to be a discrete ON/OFF, rather it causes the unit to
> toggle ON or OFF at each command transmission. The output from the Infra Red
> receiver is connected to an interrupt pin. I also have an infra red emitter
> connected to one of the timer output pins via a drive transistor.
> 
>  
> 
> The code is designed such that the user selects from a menu, the programme
> mode and then points the original remote control at the receiver and the
> device then reads the pulse stream. I have developed some code to look for a
> start from the remote and using one of the timers, time the high and low
> times and store these in memory.  Not very efficient on memory as I am using
> around 120 bytes to store the 16 bit time and the HIGH or LOW state. I have
> not tried using an 8 bit timer and this was next on my list. I could store
> the HIGH or LOW in the top bit of the 16 bit value and this would reduce the
> count by about 30 bytes.
> 
>  
> 
> For transmission, I setup a timer for a 38Khz output and then just switch
> the PORT bit on or OFF based on the original times recorded during the
> reception phase.
> 
>  
> 
> As for ON or OFF I have to keep a flag in the code to know what state the
> unit was last in. This works fine until my partner switches the ac with the
> original remote. Something I am still trying to train her for  :o)
> 
>  
> 
> I am still looking at a way to do this more effectively as I would like to
> be able to do temp control from the unit also. At present, all it does is
> switch on or off the aircon. I would need to be able to decode the infra red
> bit stream and so far have not been able to find anything on the net that
> describes the encoding scheme used. 
> 
>  
> 
> I would appreciate any thoughts you all might have on how I could improve
> this system? I am not looking for help with the code as I can do that
> myself, what I am looking for is some ideas on how to improve what I have
> attempted so far.
> 
>  
> 
> I have built 2 systems so far and have 4 aircons in total to control.
> 
>  
> 
> PS. These little TFT displays are well cool.
> 
>  
> 
> Regards
> Dave.
> 
>  
> 
>  
> 
> 
> 
> [Non-text portions of this message have been removed]
>

RE: [AVR-Chat] Re: Infra red decoding and re-encoding

2009-08-13 by Dave McLaughlin

Hi Steve,

 

Thanks for that. I have seen this code before but as it does not decode or
handle the Infra Red locally in the device I haven't tried it. My code can
read and send the Infra Red signal but I was looking for some ideas  for a
better way to manage it internally!

 

Cheers

Dave.
Show quoted textHide quoted text
From: AVR-Chat@yahoogroups.com [mailto:AVR-Chat@yahoogroups.com] On Behalf
Of stevech11
Sent: 12 August 2009 09:14
To: AVR-Chat@yahoogroups.com
Subject: [AVR-Chat] Re: Infra red decoding and re-encoding

 

  

Look in the Projects archive of avrfreaks.net. Among others, the TWIRP
project.






[Non-text portions of this message have been removed]

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.