Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

problem in ir transmission range with tsop1738

Status
Not open for further replies.

lucky6772

Junior Member level 2
Joined
Sep 4, 2010
Messages
21
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,441
Hi guys
I am making automatic urinal flush system. I need to dect a person for dat.! I am using tsop1738 for detecting ir signal.! I m generating 38kHz frequency from microcontroller n transmiting it through ir led but I am not getting good range I need at 4ft but the only range m getting is 8cm approx..! I hace chcked the microcontroller at89c2051 is genrating perfect 38khz carrier continuously!!i hv also tried some amplification circuit using transistors 2n2222 but problem is still same..! Help me guys what nexy should I do..!:-(
 

If you read the tsop datasheet thoroughly, you'll realize that it's not designed to receive continuous 38 kHz carrier. You can expect better sensitivity by superimposing a square wave modulation.
 
If you read the tsop datasheet thoroughly, you'll realize that it's not designed to receive continuous 38 kHz carrier. You can expect better sensitivity by superimposing a square wave modulation.



thnxs fvm..
can u tell what else should i do in my code....kindly help me sir..!

Code:
#include <REG2051.H>
void delay1(void);
sbit mybit=P1^7;


void timer0_isr () interrupt 1
{
        mybit = ~mybit;
}

void main ()
{
		P1=0x00;
        TMOD = 0X02;
		TL0 = 0xf4;
        TH0 = 0xf4;
        IE = 0x82;
        TR0 = 1;
        while(1);
	
}
 

Make transmitter transmit 38 KHz burst signals like transmit 38 KHz signal for 1.2 sec and then silent for 0.5 sec then repeat.
Much too long. According to the datasheet, a burst length in the ms range is expected.
what else should i do in my code
Count pulses and send an intermitted signal.
 

Much too long. According to the datasheet, a burst length in the ms range is expected.

Count pulses and send an intermitted signal.
so exactly nw how much should b the burst length tell me excatly....in datasheet it mention 70cycles...but in c language i need in sec or milli sec..so plz tell me..!cant calculate cycles..!
 

On/off frequency is 38 kHz, so I guess you can easily calculate and generate burst duration.

P.S.: I presumed that your code generates 38 kHz, but as I don't know the crystal frequency, I'm unable to check.
 
Last edited:

On/off frequency is 38 kHz, so I guess you can easily calculate and generate burst duration.

P.S.: I presumed that your code generates 38 kHz, but as I don't know the crystal frequency, I'm unable to check.

yes its generating the frequency vry fine..crystal i am using is 11.0592mhz..! but srsly my doubt is dis only dat i have trnsmite dis frequency for how much time..70cycles is equal to much mill sec..? then data sheet mentioned gap of 14 cycle..?
 

Isn't it that cycle calculates as 1/f, e.g. 26.3 us for 38 kHz?

I won't make the problem more difficult than it is, a 50% duty cycle, e.g. 1 ms on, 1 ms off would be just fine.
 

Use Astable multivibrator using 555 timer for generating 38KHz......... You can ON/OFF it using microcontroller by connecting the Reset pin of 555 to an output pin of microcontroller. Note that the Reset input is active low...........So 38KHz will be generated when it is HIGH ...
When the 38KHz IR rays falls on TSOP1738, its output will be low.. otherwise it will be high..

thnxs for the suggestion but i dnt wanna use extra ic.. i wanna do it from controller only...!

- - - Updated - - -

Code:
#include <REG2051.H>
void delay1(void);
sbit mybit=P1^7;
int a;

void delay(unsigned int msec ) // Time delay function
{
int i ,j ;
for(i=0;i<msec;i++)
for(j=0; j<1912; j++);
}

void timer0_isr () interrupt 1
{
		 delay(1);
        mybit = ~mybit;
		delay(1);
		mybit=0;
		delay(1);
	
}

void main ()
{
		P1=0x00;
        TMOD = 0X02;
		TL0 = 0xf4;
        TH0 = 0xf4;
        IE = 0x82;
        TR0 = 1;
        while(1);
	
}


will this thng works..! i made a1.5mill sec delay function..!
 

Code:
#include <REG2051.H>
void delay1(void);
sbit mybit=P1^7;
int c, n;


void timer0_isr () interrupt 1
{
        mybit = ~mybit;
}

void main ()
{
		P1=0x00;
        TMOD = 0X02;
		TL0 = 0xf4;
        TH0 = 0xf4;
        IE = 0x82;
        TR0 = 1;
        while(1)
			{
		if(n%2!=0)
		{
			for(c=0;c<=1912;c++)
		{
			TR0=1;	
	}
		n++;
	}
	else
	{
		for(c=0;c<=1912;c++)
		{
			TR0=0;
		}
		n++;
		}
	}
	
}

nw the burst is continuous but frequency decrease to 27khz..
 
Last edited:

I don't recognize at first sight why the interrupt frequency should be decreased. How did you measure it? Did you check the waveform with an oscilloscope?

But using two timers is straigtforward option anyway.
 

Code:
#include <REG2051.H>
void delay1(void);
sbit mybit=P1^7;
int c, n;
void delay(unsigned int msec ) // Time delay function
{
int i ,j ;
for(i=0;i<msec;i++)
  for(j=0; j<1275; j++);
}

void timer0_isr () interrupt 1
{
        mybit = ~mybit;
}

void main ()
{
		P1=0x00;
        TMOD = 0X02;
		TL0 = 0xf4;
        TH0 = 0xf4;
        IE = 0x82;
       	TR0 = 1;
        while(1)
		{
		 	 TR0 = 1;
			 delay(2);
			 TR0=0;
		
	 }
		
	
}


is this code is correct now..? i am checking the frequency on "proteus" and i also have frequency counter..!

- - - Updated - - -

this is the rough image of circuit..!

http://obrazki.elektroda.pl/5007225600_1371057771.jpg



i have already experiment to lower the value of the resistance which is connect with the base of transistor..!
if lower the value of the base resistance the range get decreses..! at 5k i get the maximum range and beyond that no change in range i have even used 10k but the range comes to b similar at 10k or 5k..!
 

Code:
#include <REG2051.H>
sbit ir=P1^7;
sbit motor=P1^6;
sbit motor1=P1^4;
sbit sense=P3^3;
int a,b,c,d,e,j,k,l,m,i,n,flag;
void delay3()
{
for(j=0;j<1000;j++)
for(k=0;k<500;k++); 
}
void delay7()
{
for(i=0;i<7;i++)
{
for(l=0;l<1000;l++)
for(m=0;m<75;m++);
}
}

void timer0_isr () interrupt 1
{
if(n>0) //	 1.5ms ON-OFF Burst for 10 cycles
{
if(n%2!=0)
{
TR1=0;
TH0=0xfa;	//	1.5ms OFF
TL0=0x99;
ir=0;
n++;
}
else
{
TH0=0xFA;	//	1.5ms ON
TL0=0x99;
TR1=1;
//ir=0;
n=1;
}

}
}

void timer1_isr () interrupt 3
{
ir = ~ir;
}
void isr(void) interrupt 2
{
e=1;
if(flag==0)
{
motor=1;
delay3();
motor=0;
a=1;
flag=flag+1;
}
else 
;

}
void main ()
{
a=0;
flag=0;
e=0;
n=1;
P1=0x00;
//P3=0xff;
TMOD=0X21;
TH1=0xf4;
TH0=0xFA;
TL0=0x99;
IE=0x8f; //0x8f; 
IT1=0; // Configure interrupt 0 for falling edge on /INT1 (P3.2)
//EX1=1; // Enable EX1 Interrupt
//EA=1; // Enable Global Interrupt Flag
TR1=1;
TR0=1;	

while(1)
{
if(a==1)
{
e=e-1;
if(e<0)
{
EX1=0;
TR0=0;
// P3=0xff;
// EA=0;
motor1=1;
delay7();
motor1=0;
// TR0= 1;
EX1=1;
TR1=1;
a=0;
flag=0;
e=0;
}
else;
}
else;	
} 



}
 

plz reply me i am in big trouble cant get a range..:(
 

The code in your previous post looks too confused, I can't clearly see if it achieves the intended burst waveform.

- Double check the code for plausible operation
- Before complaining about the range, you should check correct frequency and burst timing with an oscilloscope.
 
Last edited:

OBJECTIVE:
i want to design a automatic flush system. the system that detect a person and automatically flush the for 7sec after using a toilet by the person..!

TO detect a person i need to use IR SENSOR as per the requirement the system should able be to detect a person standing 2ft in front of pot.
plz dnt suggest to try different sensor because they are cheap and goes with my requirement and there are system that using same sensor

NOW THE ISSUES:

the first problem i am getting is i am not able to get a range upto 2ft as per my knowledge tsop1738 recivers can b operated from 15ft


the second issue i got is i notice the output voltage of tsop1738 does not get proper low as it just go from 5v to 3.5v which is still high signal for a microcontroller so it will not get intruupted until proper zero voltage get or less den 3.5v!
NOWi more thing i get proper zero volt when i simple generate 38khz from microcontroller without any burst cycles but as when i generate dual modulation that is transmitting 38khz wave for 1ms on and 6ms off den output voltage doest not get proper low




the code i am using:

Code:
#include <REG2051.H>
void delay1(void);
sbit mybit=P1^7;
int c, n;

void delay_ms (unsigned int count) // @ 11.0592 MHz
{
unsigned int i; 
while(count) {
i = 115;
while(i>0) i--;
count--;
}
}
void timer0_isr () interrupt 1
{
        mybit = ~mybit;
}

void main ()
{
		P1=0x00;
        TMOD = 0X02;
		TL0 = 0xf4;
        TH0 = 0xf4;
        IE = 0x82;
   
     while(1)
			{ 
			TR0=1; 
			delay_ms(1);
			TR0=0; 
			mybit=0; //LED off 
			delay_ms(6);
			
			}

}


this is my circuit:


- - - Updated - - -

NOW CAN YOU HELP ME THE CODE IS SIMPLE I MAKING 38khz on for 1ms and off for 6ms just help me to achive the range..!

i have check the output is working fine..!

this is how i attached the sensor:


waveform using proteus software but i have also checked on oscilloscope its working fine:



- - - Updated - - -

what is with the pauses between the burst..? right nw my code continously producind burst like 38khz is on for 1ms sec and off for 6ms..?

- - - Updated - - -

what is with the pauses between the burst..? right nw my code continously producind burst like 38khz is on for 1ms sec and off for 6ms..?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top