Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Capturing IR Pulse Stream Ideas

Status
Not open for further replies.

Gayan Soyza

Active Member
Hi IR Experts!

I’m researching a method to detect an Unknown IR pulse stream (Protocol).

All the time I was doing Sony (SIRC) & RC5 protocols individually. So it can detect only a particular protocol which stored inside the PIC.

I was thinking hardly how to capture an unknown protocol & store the data so it can work with only that remote.(Ex: If I have a remote at home I can use that.So it doesn't need to be a sony or phillips remote)

This must do with a general I/O pin without using CCP modules.

Those ideas came to my mind & like to know what is the best way to do this. I like to hear your ideas on how to capture an unknown pulse stream.

Method1

After detecting start pulse, store only the mark time of the pulses using a timer (TMR0) & update the data (mark times) in many registers.

Method2

After detecting start pulse, turn on a fix timer (1000ms) & after timer expires check the pulse is high or low update the data registers & again start the fix timer likewise check the whole pulse stream.

I have attached a timing diagram of RC5 & SIRC for easy view.

Thanks
 

Attachments

  • IR Patterns.PNG
    IR Patterns.PNG
    13.5 KB · Views: 279
Last edited:
Oh no no no this is the one I'm going to build.

**broken link removed**

The pulse stream must capture & store inside the PIC.

That product doesn't contain a particular protocol SIRC or RC5.It has some other decoding method.So it can use with any other brand remotes as well.

I hope this clears what I'm going to do.
 
Last edited:
Probably the most universal method would be to record the period of the both marks and spaces. You would need some intelligence in your code so that you stop recording when the bit stream repeats itself. Most remotes send the same bit pattern over and over as long as the button is held down.
Then you would look for that bit stream. You'd look for the first mark and continue if it is within a set tolerance. Then look for the first space and continue if it is within a set tolerance. If any part fails, your code would loop back to the start and resume checking again. Once all valid mark/spaces are gone through, we assume a valid code and turn on the lamp, etc. Once you've decoded a valid command you'd need wait for a silent period (No data from remote) before you accept another command. Otherwise keeping the button pushed would cycle the lamp on and off repeatedly.
 
Last edited:
Thanks kchriste for your idea.

So then the final solution is to record the whole period with marks & spaces.I'll try to do that.Packet ending routine will be fine I have done that before "waiting for a silent period".

The most required part is to store marks & space times separately.My plan is to use only one timer.Without using two timers.
 
Since you are using a general IO pin it will be easier to use an 8bit timer (Timer0) rather than a 16bit timer (Timer1). This is because reading the 16bit value, while the timer is running, is tricky because it could be rolling over during the 2 8bit reads. The CPP module would be the way to go. What PIC are you going to use?
 
Hi kchriste its a historic PIC 12F629.Must do it with a general I/O pin.

Here a sample code using TMR0.I captured from my mind the 2nd pulse stream in my 1st attachment.

Code:
TMR0 PS	=1:16,4Mhz XT

	movlw	20h
	movwf	FSR

;---------------------------------------------------------
;ignore the start pulse & wait for next mark pulse present
;---------------------------------------------------------

	;----code here to---
	;-----ignore the----
	;-----start bit-----
				;mark detected
;------------------------------------------------
;Measure the mark time length until space detect
;------------------------------------------------

DO_Mark	
	call	Start_T		;turn on the TMR0
	btfsc	INTCON,T0IF	;see if the mark time too long?
	goto	Invalid		;256X16 = 4096 ??
	btfss	GPIO,GP2	;wait for space pulse
	goto	$-3		;no,still mark time then go back
				;yes,space detected
	movf	TMR0,W
	movwf	INDF		;save the mark time
	incf	FSR,F
;------------------------------------------------
;Measure the space time length until mark detect
;------------------------------------------------

DO_Space
	call	Start_T		
	btfsc	INTCON,T0IF	;see if the space time too long?
	goto	Invalid		;256X16 = 4096 ??
	btfsc	GPIO,GP2	;wait for mark pulse
	goto	$-3		;no,still space time then go back
				;yes,mark detected
	movf	TMR0,W	
	movwf	INDF		;save the space time	
	incf	FSR,F
	goto	DO_Mark		;


Start_T	clrf	TMR0		;reset TMR0
	bcf	INTCON,T0IF	;
	return

Invalid	goto	Somewhere	;packet expires

;result registers from 20h-30h
==============================

112H
55L
55H
55L
55H
112L
112H
112L
55H
55L
55H
55L
112H
112L
112H
112L
55H
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top