| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| NivNavick 
 
 
 Joined: 01 Nov 2010
 Posts: 47
 
 
 
			    
 
 | 
			
				| IR Delay |  
				|  Posted: Sat Feb 05, 2011 8:14 am |   |  
				| 
 |  
				| Hi, I am using an IR sensor to detect a ball that send IR pulses (rcj-05).
 The sensor works perfectly but when the ball leave the IR sight the IR entered to delay and when the ball enter to the IR sight the sensor doesn't
 See the ball for the next few second.
 What can cuse this problem?or thats happens in all IR sensors?
 My final and most important question is if the problem can be solve by code?
 
 Thank you and have a nice weekend!
 |  | 
	
		|  | 
	
		| temtronic 
 
 
 Joined: 01 Jul 2010
 Posts: 9588
 Location: Greensville,Ontario
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Sat Feb 05, 2011 8:55 am |   |  
				| 
 |  
				| Full moon ? Spilled your coffee ? Odd numbered day of the month ??? Honestly, you have to post a complete, small, compilable program that shows the problem,also include compiler version and PIC type !
 No one can help you without this information !
 |  | 
	
		|  | 
	
		| NivNavick 
 
 
 Joined: 01 Nov 2010
 Posts: 47
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Sat Feb 05, 2011 10:40 am |   |  
				| 
 |  
				| There is no code,I saw this by the Scope. And my question was if thus can be solved by code?
 |  | 
	
		|  | 
	
		| Ttelmah 
 
 
 Joined: 11 Mar 2010
 Posts: 19966
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Sat Feb 05, 2011 10:58 am |   |  
				| 
 |  
				| No. The PIC is not able to predict the future. If the sensor is not sending pulses, then no amount of coding can fix things....
 
 Best Wishes
 |  | 
	
		|  | 
	
		| NivNavick 
 
 
 Joined: 01 Nov 2010
 Posts: 47
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Sat Feb 05, 2011 11:19 am |   |  
				| 
 |  
				| But usually IR sensors have a delay sometimes? I checked two different types of IR sensors and both
 Of them have delay.
 
 P.S.
 I am using TSop1240.
 
 Thanks
 |  | 
	
		|  | 
	
		| temtronic 
 
 
 Joined: 01 Jul 2010
 Posts: 9588
 Location: Greensville,Ontario
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Sat Feb 05, 2011 3:01 pm |   |  
				| 
 |  
				| I suggest you download the data sheet for the sensors and read all of it. 
 hine You'll find out it is a 'smart ' sensor not just an IR detector.
 
 Also be aware you must have the correct snesor for your 'ball' transmitter.
 
 I'm assuming you're building a motorized cart to find and /or capture the
 ball ???
 
 If so it's an interesting project,tons of similar code already on the net....
 |  | 
	
		|  | 
	
		| NivNavick 
 
 
 Joined: 01 Nov 2010
 Posts: 47
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Sat Feb 05, 2011 3:27 pm |   |  
				| 
 |  
				| I'm competing in Robocup Junior Soccer competition  and for that I need the ball. 
 What do you mean by not just IR detector and smart sensor?
 
 thanks!
 
 P.S
 I am from software team, not electronic, but eventually my responsibility is
 to integrate all the hardware to work together I guess you know what I mean.
 The electronic team read the DATA SHEET 100 times and still can't figure out what is the problem.
 |  | 
	
		|  | 
	
		| temtronic 
 
 
 Joined: 01 Jul 2010
 Posts: 9588
 Location: Greensville,Ontario
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Sat Feb 05, 2011 4:42 pm |   |  
				| 
 |  
				| A 'simple' sensor would only detect, usually in an analog form the object of interest, in this case IR energy, however this is what I call a 'smart' sensor', loaded with electronics to 'filter' the signal. 
 Quoting from the datasheet....
 ... The circuit of the TSOP12.. is designed so that unexpected
 output pulses due to noise or disturbance signals
 are avoided. A bandpass filter, an integrator
 stage and an automatic gain control are used to suppress
 such disturbances.
 
 ... The distinguishing mark between data signal and disturbance
 signal are carrier frequency, burst length
 and duty cycle.
 The data signal should fulfill the following conditions:
 • Carrier frequency should be close to center frequency
 of the bandpass (e.g. 38 kHz).
 • Burst length should be 10 cycles/burst or longer.
 • After each burst which is between 10 cycles and 70
 cycles a gap time of at least 14 cycles is necessary.
 • For each burst which is longer than 1.8 ms a corresponding
 gap time is necessary at some time in the
 data stream. This gap time should be at least 4 times
 longer than the burst.
 ...
 Obviously you can develop PIC code to use this sensor, as it's very similar what others have already done.
 |  | 
	
		|  | 
	
		| Douglas Kennedy 
 
 
 Joined: 07 Sep 2003
 Posts: 755
 Location: Florida
 
 
			      
 
 | 
			
				|  |  
				|  Posted: Sat Feb 05, 2011 5:05 pm |   |  
				| 
 |  
				| There is a whole lot of IR in the environment.  Fluorescent lights especially. IR signaling is modulated and filtered to help contrast the signal against the background. Background IR noise wouldn't be modulated so a modulated signal can be teased out of the noise.  IR remote controls go to some length in filtering and coding to screen out environmental noise that could trigger things.
 |  | 
	
		|  | 
	
		| NivNavick 
 
 
 Joined: 01 Nov 2010
 Posts: 47
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Sat Feb 05, 2011 11:07 pm |   |  
				| 
 |  
				|  	  | temtronic wrote: |  	  | A 'simple' sensor would only detect, usually in an analog form the object of interest, in this case IR energy, however this is what I call a 'smart' sensor', loaded with electronics to 'filter' the signal. 
 Quoting from the datasheet....
 ... The circuit of the TSOP12.. is designed so that unexpected
 output pulses due to noise or disturbance signals
 are avoided. A bandpass filter, an integrator
 stage and an automatic gain control are used to suppress
 such disturbances.
 
 ... The distinguishing mark between data signal and disturbance
 signal are carrier frequency, burst length
 and duty cycle.
 The data signal should fulfill the following conditions:
 • Carrier frequency should be close to center frequency
 of the bandpass (e.g. 38 kHz).
 • Burst length should be 10 cycles/burst or longer.
 • After each burst which is between 10 cycles and 70
 cycles a gap time of at least 14 cycles is necessary.
 • For each burst which is longer than 1.8 ms a corresponding
 gap time is necessary at some time in the
 data stream. This gap time should be at least 4 times
 longer than the burst.
 ...
 Obviously you can develop PIC code to use this sensor, as it's very similar what others have already done.
 | 
 
 I have on my robot 9 IR sensors.
 But because there is a delay I'm afraid that they will get stuck during the game and the robot will not be able to find the ball.
 
 From what I understood, the filter is probably the cause of the delay. Most of the teams are using IR 'smart' IR sensors of 40KH to detect only the signal of the ball.
 Are you suggesting to stay with the above senor or should I replace it?
 |  | 
	
		|  | 
	
		| FvM 
 
 
 Joined: 27 Aug 2008
 Posts: 2337
 Location: Germany
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Sun Feb 06, 2011 1:24 am |   |  
				| 
 |  
				| You didn't tell the sensor manufacturer and type. As far as I understand, it's a common 38 kHz remote control receiver. None of the sensors I ever saw have a "few second" response time respectively delay. 
 Either you managed to design a weird circuit or a strange software.
 
 P.S.: I found the sensor specification in a later post.
 
 I see that TSOP1240 is also listed as possible detector for the RCJ-05 modulation. In so far there should be no general technical issue.
 
 But how are you using the sensor? I guess you intend to determine the ball direction. So you have to restrict the sensor's angle of view. Are you sure, that you have sufficient IR signal on the sensor when you see the delay?
 
 For an effective position tracking, one would prefer sensors that give an intensity information rather than an on/off detctor like the TSOP1240. I understand, that the trapezoidal waveform is used to convert intensity into pulse width. But it's a rather rough method.
 |  | 
	
		|  | 
	
		| NivNavick 
 
 
 Joined: 01 Nov 2010
 Posts: 47
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Sun Feb 06, 2011 2:21 am |   |  
				| 
 |  
				| maybe the electronic circle cause it? |  | 
	
		|  | 
	
		| NivNavick 
 
 
 Joined: 01 Nov 2010
 Posts: 47
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Sun Feb 06, 2011 5:22 am |   |  
				| 
 |  
				| What IR sensor are you suggesting? |  | 
	
		|  | 
	
		| temtronic 
 
 
 Joined: 01 Jul 2010
 Posts: 9588
 Location: Greensville,Ontario
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Sun Feb 06, 2011 6:24 am |   |  
				| 
 |  
				| Niv... you're not giving us enough information!
 Where's your PIC code and are your sensors' the correct type? ie: same frequency as the ball's IR transmitters?
 |  | 
	
		|  | 
	
		| NivNavick 
 
 
 Joined: 01 Nov 2010
 Posts: 47
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Sun Feb 06, 2011 8:45 am |   |  
				| 
 |  
				|  	  | Code: |  	  | int16 ir(int16 pin) {
 set_TIMER5(0);
 while(((input(pin)==1))&&(get_timer5()<=800));
 if(get_timer5()>=800)
 return 0;
 while(input(pin)==0);
 set_TIMER5(0);
 while(((input(pin)==1))&&(get_timer5()<=800));
 if(get_timer5()>=800)
 return 0;
 //if(get_timer5()==272)
 //return 0;
 return get_timer5();
 }
 
 | 
 
 I don't think there is a problem with the code
 The name of the PIC is PIC18F46K22.
 the ball frequency is 40KHZ and the IR get only frequencies that equal to 40KHZ.
 Did you hear on an IR sensor like this?
 |  | 
	
		|  | 
	
		|  |