building infra red remote control switch

Thread Starter

4EverYoungs.71

Joined Jun 4, 2014
4
Hi everybody
I'm new friend on this usefull forum and also very beginner on microcontroller hardware and programming so pls help.
I want to build a remote control switch cct using 16F84A,i understand the backbone of the circuit,except one thing,

what's the content of the remote control transmitted signal ?
how to decode and encode the signal of the remote control?
how to distinguish between the different pressed buttons?

thanks in advance.
 

BobTPH

Joined Jun 5, 2013
8,967
IR remotes typically work by sending bursts of 38KHz. There are receivers for this that are very good. A transmitters is just an IR LED pulsed by your microcontroller, fairly high power is good. There are many protocols for coding the functions. Typically they consists of a sequence of long and short bursts to encode a number. You can find lots of info online about these codes.

I am currently working on an IR interrupter alarm that uses these components:

IR dectector TSOP2438
IR led TSAL7200

This combination is so sensitive that you practically have to totally enclose the LED in order for it not to be detected, you can point it an any direction and it will still be seen by reflection. I wanted to use these because my interrupter needs to work in sunlight, so a simple IR on / off detection would be impossible.

Bob
 

pwdixon

Joined Oct 11, 2012
488
There are a number of different formats, all created by various manufacturers of tv's etc. You will need to google the particular format that you want to work on.

You will also find it much easier to encode a signal and transmit rather than receive and decode, especially with a limited PIC processor. You might be able to find example circuits and code online that will either do what you want or at least guide you towards a solution.
 

Thread Starter

4EverYoungs.71

Joined Jun 4, 2014
4
Thanks for all of u my friends and thanks for the links,
but i need more details from "pwdixon" u said "You will also find it much easier to encode a signal and transmit rather than receive and decode",

do u mean i create custom format for my own and let the processor send it via IR led and at the receiver cct i check the received signal to distinguish between different buttons
 

hexreader

Joined Apr 16, 2011
581
I have a finished project that may do all that you want.

... but I will not give you the link unless you ask, as it will leave nothing for you to do, and may take all the fun away.

Let me know if you want the finished project.

Is this a school project? or a home hobby project?

I have used Sony IR protocol, which is the simplest common protocol, as explained here:
http://www.sbprojects.com/knowledge/ir/sirc.php
Other protocols and basic operation is described very well elsewhere in the site.
 
Last edited:

THE_RB

Joined Feb 11, 2008
5,438
I bought a bag of 5 ebay remotes, very cheap.

They use a common format sending a start bit and then 4 bytes;
byte1 = device code (usually 00)
byte2 = device code inverted (FF)
byte3 = key code
byte4 = key code inverted

(edit; has been corrected) :)
 
Last edited:

MMcLaren

Joined Feb 14, 2010
861
I bought a bag of 5 ebay remotes, very cheap.

They use a common format sending a start bit and then 4 bytes;
byte1 = device code (usually 00)
byte2 = key code
byte3 = device code inverted (FF)
byte4 = key code inverted
Got a link, Roman? I suspect a number of us might be interested. Thanks.
 

THE_RB

Joined Feb 11, 2008
5,438
I'm not sure if this is the same seller I bought from before, but it is the same remote. I bought a bag of 5;


http://www.ebay.com/itm/HX1838-Infr...nfrared-Remote-Control-NEC-Code-/251539222962

The one above is $2.82 with the receiver module included.

Without the receiver the remote is $1.72.

I can post a screen capture from my IR sniffer software if you like, that will show the data pulses and format.
:)

(edit) After seeing my screenshot again I realised I wrote the data bytes in the wrong sequence in my previous post. Sorry!
 
Last edited:

THE_RB

Joined Feb 11, 2008
5,438
Here's the screen capture.

The waveform is shown as active high (HI = IR carrier) so you need to invert it as the IR sensor goes LO when it detects carrier.
 

Attachments

micropad

Joined Dec 24, 2011
106
I would like to see your project, Hexreader.

I just posted an SIRC Decoder Demo on another forum yesterday.

Cheerful regards, Mike
Can you please explain this area
Rich (BB code):
movf    TMR0,W          ; pulse lo time (64-us ticks)     |B0
        addlw   -(2600/64+1)    ; test for ~2400 ± 200 usecs      |B0
        addlw   400/64+1        ; C=1 (2200..2600 usec range)?    |B0
        skpc                    ; yes, skip (in range), else      |B0
        goto    irloop          ; branch (abort & start over)     |B0
 

Thread Starter

4EverYoungs.71

Joined Jun 4, 2014
4
Thank u Hexreader,
if i fail to do it, i will tell u to kindly show me your project, and want to let u know that my project is a home hobby project.
 

MMcLaren

Joined Feb 14, 2010
861
I'm not sure if this is the same seller I bought from before, but it is the same remote. I bought a bag of 5;


http://www.ebay.com/itm/HX1838-Infr...nfrared-Remote-Control-NEC-Code-/251539222962

The one above is $2.82 with the receiver module included.

Without the receiver the remote is $1.72.

I can post a screen capture from my IR sniffer software if you like, that will show the data pulses and format.
:)

(edit) After seeing my screenshot again I realised I wrote the data bytes in the wrong sequence in my previous post. Sorry!
I've been looking for something exactly like that and in that price range but I guess I wasn't using the right search terms.

Thank you, Roman. I really appreciate it.

Regards, Mike
 

THE_RB

Joined Feb 11, 2008
5,438
No probs. :)

It's actually a pretty good way to get a keypad on a project. For the pin cost of 1 input pin, and parts cost of a cheap IR sensor, you get a 21 key keypad (that can be used from across the room).

For years I've been using 12 key keypads that cost $15 and need 8 pins to connect.

One thing I tried that worked really well was to receive and decode the IR pulses in a timer interrupt which runs a few times faster than the pulse period. The int decodes and error checks the IR data, and if all is good it just outputs a single byte for the pressed key (and 0 for no_key).

So the IR is handled totally automatically and all the other code needs to do is check that one byte to see if a key has been pressed.

Someone of your ability could whip that up in assembler pretty easily.
 

MMcLaren

Joined Feb 14, 2010
861
That's exactly what I had in mind. It's a 1-pin keypad solution for $1.75... Nice!

Someone of your ability could whip that up in assembler pretty easily.
I've decoded SIRC at 100-usec interrupt intervals in the past and it worked well, taking only a handful of instructions. I've never done NEC protocol though.

Thanks again... Mike
 
Top