Discussion in "Electronics" started by    akashbudhia    Nov 1, 2010.
Mon Nov 01 2010, 02: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, 02: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, 03: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, 10:55 AM
#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, 03: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, 04: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, 05: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, 05:50 AM ]
Sat Nov 13 2010, 08:14 PM
#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, 03: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, 10:19 AM
#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

ajay_bhargav
Sat Aug 30 2014, 12:15 PM
@sufiyan, You can use solenoid lock in place of LED.
Fri Aug 29 2014, 12:17 AM
sufiyan
please can you tell me which type of lock activator should i connect in place of LED? can i use selenoid lock actuator
ajay_bhargav
Thu Aug 28 2014, 06:34 AM
Please post questions in forum
Thu Aug 28 2014, 01:44 AM
yednekachew
can you give a project made bay proteus software
Mon Aug 25 2014, 07:12 AM
Vinod Soni
Hi Sir, How can i make this RFID with ATMega16/32 controller
pavanjain
Sat Aug 23 2014, 05:10 AM
Sir i want to download the hex file in P89v51rd2 microcontroller using max232 IC but we not load the program in IC
Tue Aug 19 2014, 04:51 PM
allen ndumu
please i will like to know if the problem of speed control of dc motor using keypad and l298 was if yes can i have the complete project send it to the address i really need to see it
Tue Aug 19 2014, 10:47 AM
Amit Bisht
sir i want to have some trending projects on which i could work related to ATmega 16 microcontroller
ExperimenterUK
Sat Aug 16 2014, 04:16 PM
@diligent . create a thread
Sat Aug 16 2014, 03:17 PM
diligent
in assembly langauage programming..

Downloads

Comments

bobparihar
Mon Sep 01 2014, 06:19 AM
vijit
Sun Aug 31 2014, 08:33 AM
[email protected]
Sat Aug 30 2014, 04:45 PM
enisi
Wed Aug 27 2014, 06:08 AM
sadalakshmi
Wed Aug 27 2014, 12:39 AM
Paecake
Sun Aug 24 2014, 04:07 PM
pavanjain
Sat Aug 23 2014, 02:33 AM
samchovatiya
Thu Aug 21 2014, 02:30 PM

Online

Guests: 54, Members: 0 ...

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

Members: 37504
Newest member: bobparihar
Forum Activity
Peter_Parker Avatar
Posted By Peter_Parker
Tue Sep 02 2014, 11:20 AM
What is your graph displaying ?I'm assuming it is ...
bobparihar Avatar
Posted By bobparihar
Tue Sep 02 2014, 01:59 AM
iam using EM-18 reader module.. but i want only to...
ExperimenterUK Avatar
Posted By ExperimenterUK
Mon Sep 01 2014, 10:59 PM
What is your graph displaying ?I'm assuming it is ...
Peter_Parker Avatar
Posted By Peter_Parker
Mon Sep 01 2014, 06:19 PM
Just to add to this,I've connected this now to a C...
ajay_bhargav Avatar
Posted By ajay_bhargav
Mon Sep 01 2014, 07:28 AM
Which RFID module are you using? Post link to the ...
ajay_bhargav Avatar
Posted By ajay_bhargav
Mon Sep 01 2014, 07:28 AM
We prefer to use English language on our forums. B...
bobparihar Avatar
Posted By bobparihar
Mon Sep 01 2014, 06:33 AM
i am using a RFID module, i want to connect reader...
ajay_bhargav Avatar
Posted By ajay_bhargav
Sat Aug 30 2014, 12:03 PM
Forgot to attach files. This has source for both R...