Discussion in "Electronics" started by    akashbudhia    Nov 1, 2010.
Mon Nov 01 2010, 06:38 AM
#1
I need to count visitors using AT89C51. The sensor i got from the market has SM0038 printed on it.Kindly answer the following questions:

1. Is SM0038 same as TSOP 1738?

2. SM0038 senses 38kHz IR, right?(this is what is felt from the 38 at the end of sm0038)

3. For achieving 38kHz frequency at IR LED, i planned to use my AT89C51 itself, rather than 555 timers. This is the code i have written as of now:

ORG 0
LJMP MAIN
ORG 000BH
CPL P1.2;INPUT LINE FOR THE IR-LED
RETI
ORG 0100H
MAIN:
MOV IE,#10000010;TIMER-0 INTERRUPT ENABLE
MOV TMOD,#00000010B ; TIMER-0, MODE 2
MOV TH0,#F4H ;FOR f=38kHz =>
 T=0.026ms =>
 0.013ms TIMER =>
 F4
SETB TR0; START THE TIMER
HERE:SJMP HERE


As evident from datasheet of TL17xx above should not work because it will generate CONTINUOUS pulse of IR at 38kHz rather than BURSTS of square wave with gaps.

Now for the bursts and gaps what should be appropriate number of cycles to achieve Visitor Count?

Another doubt, my projects key concept is that the IR is blocked when a visitor is there and TSOP should go high, but on other side we give cycles(high and low alternatively during bursts, and low during gaps) of IR, won't the low states of IR be counted as visitor.

Or is it that when a visitor is passing, absence of IR rays on TSOP for such a long time only makes it high and during the remaining time TSOP will remain low, although pulses of IR is being sent.

4. There' no library in Proteus for IR LED and TSOP! How do i simulate it?

5. Will the following circuit work fine:



Mon Nov 01 2010, 06:46 AM
#2
Hey sorry, by mistake i posted the thread in the news and announcements column.
Can the admin move it to the apt. cateogry.
Actually it's my first visit to the forum.
Mon Nov 01 2010, 07:51 AM
#3
hi akashbudhia

Is SM0038 same as TSOP 1738?


yes it is same in pin configuration

SM0038 senses 38kHz IR, right?(this is what is felt from the 38 at the end of sm0038)


yes it sense 38 khz frequency
code is as
ORG 0000H
LJMP MAIN
ORG 000BH
CPL P1.2;INPUT LINE FOR THE IR-LED
RETI
MAIN:
MOV IE,#10000010b ;TIMER-0 INTERRUPT ENABLE
MOV TMOD,#00000010B ; TIMER-0, MODE 2
MOV TH0,#0F4H ;FOR f=38kHz =>
 T=0.026ms =>
 0.013ms TIMER =>
 F4
MOV TL0,#0F4H
SETB TR0; START THE TIMER
HERE:SJMP HERE
END

As evident from datasheet of TL17xx above should not work because it will generate CONTINUOUS pulse of IR at 38kHz rather than BURSTS of square wave with gaps.

Now for the bursts and gaps what should be appropriate number of cycles to achieve Visitor Count?


this type of configuration u used it is normally used in sending and receiving digital data in the form of zero and one
see this link too
http://www.rentron.com/Infrared_Communication.htm
see these links
http://www.ikalogic.com/ir_prox_sensors.php
http://www.ikalogic.com/ir_prox_sensors_40khz.php
see this site on the same projects threads
http://www.8051projects.net/forum-t37642.html

There' no library in Proteus for IR LED and TSOP! How do i simulate it?


proteus has no such library u can check ur logic in coding using bush button instead of ir reciever

Will the following circuit work fine:


its ans is just try and has good hope that it will work prefer to use 74hc132 diagram as in the first link i provide

Can the admin move it to the apt. cateogry.


yes admin move it in appropriate place
if u want to use just an interrupt u can use other circuits too
i has one circuit that i use often when i just need interruption thats range is 1.5 to 2 meter almost when completely align if u need then u can update here
Mon Nov 01 2010, 02:55 PM
#4
hi akashbudhia
here r the circuit that can be used in interrupt method when ir beam is cut relay turn on otherwise it will be off its range is almost 1.5 to 2 meter i used it
diagram r in live wire software as well as in jpg format too
to check it in live wire software u can download from here

1) http://ifile.it/a0tpecf
2) http://ifile.it/a0tpecf/Livewire%201.11.rar
Wed Nov 03 2010, 07:28 AM
#5
Thanks a lot for your reply.

With respect to the datasheet available here, i am using the following code to generate bursts of 20 cycles(R3=40) and then a gap of length 25 cycles(R2=50) at the LED connected to P1.2.

The code also is counting up (fm 0 to 9 and back to 0 if more) on a common anode 7-segment display connected to port P2 whenever TSOP goes high(in absence of IR, i.e a visitor)

ORG 0000H
LJMP MAIN
ORG 000BH
CJNE R3,#0,DOWN
DEC R2; WHEN R3=0
CLR P1.2
CJNE R2,#0,DOWN1
MOV R3,#40
MOV R2,#50
RETI
DOWN1:
RETI
DOWN:
CPL P1.2;INPUT LINE FOR THE IR-LED
DEC R3
RETI
ORG 0100H
MAIN:
MOV 30H,#0C0H; values for 7-seg display 0 to 9
MOV 31H,#0F9H
MOV 32H,#0A4H
MOV 33H,#0B0H
MOV 34H,#99H
MOV 35H,#92H
MOV 36H,#82H
MOV 37H,#0F8H
MOV 38H,#80H
MOV 39H,#98H
MOV 3AH,#00H; 0 for identifying the terminating condition
MOV R0,#30H; counter starting from 0
MOV A,R0
MOV P2,A; displaying 0 on the 7-seg
SETB P1.0; TSOP O/P to P1.0, configured as I/P pin
MOV IE,#10000010B;TIMER-0 INTERRUPT ENABLE
MOV TMOD,#00000010B ; TIMER-0, MODE 2
MOV TH0,#0F4H ;FOR f=38kHz =>
 T=0.026ms =>
 0.013ms TIMER =>
 F4
MOV TL0,#0F4H
MOV R3,#40; bursts of 20 cycles 
MOV R2,#50; gap of 25 cycles
SETB TR0; START THE TIMER
WAIT:JNB P1.0, WAIT; can skip the following, for counting up on detection
LCALL COUNTUP
LCALL DELAY
SJMP WAIT
	`
COUNTUP:
INC R0
MOV A,@R0
JNZ DISP
MOV R0,#30H
MOV A,@R0
DISP:
MOV P2,A
RET

DELAY:
MOV R4,#0FFH
DELAY2: MOV R5,#0FFH
DELAY1: DJNZ R5,DELAY1
	DJNZ R4,DELAY2
RET
END


Kindly verify whether the code is perfect for the IR LED transmitter for getting detected at TSOP 1738?

May ignore the 7-segment part(COUNT UP method and DELAY method).

As for now i am concentrating on the sensor part, but TSOP's Vout goes low(approx 2.2V) only for a second or two,on RESET of AT89C51 and remains 4.8V for remaining time.

Following is the TSOP's requirement from the datasheet
Wed Nov 03 2010, 08:40 AM
#6
hi akashbudhia
it cannot be said that code is perfect or not
check it on hardware that will be better answer
ru check voltage with meter if yes then it show almost 3,1.8,3.9 etc not zero becoz zer0 and 1 comes so fast and meter is slow

generate a 36 or 38 khz according to sensor using 8051 and sena a byte 8 to 10 times to some pin use 74hc132 for mixing both and then drive led and see results
Wed Nov 03 2010, 09:44 AM
#7
hi budhia,
it is much easier if u will use an IR sensor circuit to trigger the input of the controller. Ur code is easy to0 bcoz u will only monitor the output of the iR sensor circuit wether 0 or 1 logic.
Here how 8 works.
When IR beam is interrupted the IR sensor sends logic 0 to the controller and it counts then display every event of interruption.
Just make a code of that.
hope 8 helps.


[ Edited Wed Nov 03 2010, 09:50 AM ]
Sun Nov 14 2010, 01:14 AM
#8
As you said i have been working on the hardware since so many days. But the code i have posted is not giving the expected output.

First i will explain my code:
I am generating 38kHz square bursts with 20 cycles/bursts.
Alternatively i am keeping it low for 25 cycles.

In absence of IR LED TSOP's output voltage is 4.9 V.
In presence of IR LED the output voltage of TSOP is dropping, but it is around 4.4 V (which should be around 0V as per datasheets).

Please read my code(I know it's painful, I will optimize it for you):

ORG 0000H
LJMP MAIN
ORG 000BH
CJNE R3,#0,DOWN
DEC R2; WHEN R3=0
CLR P1.2
CJNE R2,#0,DOWN1
MOV R3,#40
MOV R2,#50
RETI
DOWN1:
RETI
DOWN:
CPL P1.2;INPUT LINE FOR THE IR-LED
DEC R3
RETI
ORG 0100H
MAIN:
MOV IE,#10000010B;TIMER-0 INTERRUPT ENABLE
MOV TMOD,#00000010B ; TIMER-0, MODE 2
MOV TH0,#0F4H ;FOR f=38kHz =>
 T=0.026ms =>
 0.013ms TIMER =>
 F4
MOV TL0,#0F4H
MOV R3,#40; bursts of 20 cycles
MOV R2,#50; gap of 25 cycles
SETB TR0; START THE TIMER
WAIT:SJMP WAIT
Tue Nov 16 2010, 08:49 AM
#9
Hi again.. well sorry I dont know assembly hehe I only know C programming.. hehe lets wait for the others..
Tue Nov 16 2010, 03:19 PM
#10
@Akash
the code looks fine though you could reduce the gap from 25 to ~15 cycles as per the datasheet (which says "atleast 14 cycles")..

are you using the ckt from the 1st post?
how did you arrive at the resistor values?
with the 10k collector resistor,you get only ~0.4 mA drive current for the IR led... needless to say it is toooooo low.
so change the resistor to ~100 ohms for ~40mA current.If you find the range is not adequate decrease the value further to ~82 or 68 ohms... consult your IR led's datasheet for max. peak current rating.

also put the the ir led in series with the collector....

Get Social

Information

Powered by e107 Forum System

Conversation

ExperimenterUK
Thu Nov 20 2014, 06:00 PM
@Mehboob.. I don't think you can do that.
Sat Nov 15 2014, 06:41 AM
Mehboob
Pls can you send me code in c of PWM generation using UART/serial port in 8051.
Fri Nov 14 2014, 02:51 PM
mohammad aqil
NEED A BOOK ON MICROPROCESSOR AND INTERFACING BY D.V.HALL. RIGHT NOW, I SHALL BE VERY THANK FULL TO U....
Thu Nov 13 2014, 02:15 PM
m
please code hex project avr blood pressure monitor
Thu Nov 13 2014, 05:56 AM
Lambo
hi mate, whats the ajay-bhargav? tell us more pls
ExperimenterUK
Wed Nov 12 2014, 12:56 AM
@tmtm000.. have you been able to join ?
ExperimenterUK
Wed Nov 12 2014, 12:54 AM
@Alice..become a member,then send a PM to ajay_bhargav the site owner.
Tue Nov 11 2014, 03:58 AM
Abhishek Bansal
Thanks a lot for your informative tutorials!
Mon Nov 10 2014, 09:03 AM
Alice
Hello, This is Alice from a PCB rototype manufacturer. Our company is interested in your website contents, and wonder if we can advertise our company with payment on your website. There are two ways to advertise: first, if we an get a instant quote section on your main site columns; second, whether we can get a advertising section if you have any avaliable one. If any of above ways avaliable, please contact me with your detailed scheme and advertising charge. Thanks. Alice
Sat Nov 08 2014, 11:58 AM
Mohamed_123sd
Signals and Systems, 2nd Edition by Alan V. Oppenheim Alan S.willsky with S.Hamid Nawab?

Downloads

Comments

VikiPeter
Tue Nov 18 2014, 09:13 AM
gentlboy
Sun Nov 16 2014, 11:13 PM
philipeastbourne
Wed Nov 12 2014, 05:32 AM
astra91
Mon Nov 10 2014, 08:11 AM
francise
Thu Nov 06 2014, 02:55 AM
ashbir
Tue Nov 04 2014, 11:13 PM
shruthig
Tue Nov 04 2014, 10:50 AM
sk8boardboy
Mon Nov 03 2014, 11:20 AM

Online

Guests: 56, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 37547
Newest member: VikiPeter
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Sat Nov 22 2014, 06:15 AM
@ExperimenterUKI make small table to observe Outpu...
Max.otto Avatar
Posted By Max.otto
Fri Nov 21 2014, 02:31 PM
@ExperimeterUKForgot my last question.As i told be...
Max.otto Avatar
Posted By Max.otto
Fri Nov 21 2014, 02:05 PM
@ExperimenterUKI make small table to observe Outpu...
Max.otto Avatar
Posted By Max.otto
Fri Nov 21 2014, 01:12 PM
@ExperimenterUKThank u. I do it. Ohne Period it's ...
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Nov 20 2014, 05:56 PM
You set the on/off times here as 47%float PWMcom...
vijay.parmar1992 Avatar
Posted By vijay.parmar1992
Thu Nov 20 2014, 04:06 AM
Right now i am studying Bootloader.I want to writ...
Max.otto Avatar
Posted By Max.otto
Wed Nov 19 2014, 03:11 PM
How can i get PWM on-off time..?pls check the atta...
Max.otto Avatar
Posted By Max.otto
Wed Nov 19 2014, 03:05 PM
I am using PSoC 5LP.pls check the attached design ...
ankitbajaj01 Avatar
Posted By ankitbajaj01
Wed Nov 19 2014, 01:49 PM
Thanks for the prompt response, I will try it out ...
engr1931 Avatar
Posted By engr1931
Wed Nov 19 2014, 11:45 AM
this one sir! i attached the whole project! ...