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
Forum Activity
Peter_Parker Avatar
Posted By Peter_Parker
Fri Aug 01 2014, 09:37 AM
I linked the tx and rx pins,opened up the hyperter...
majoka Avatar
Posted By majoka
Fri Aug 01 2014, 07:25 AM
attached is the whole project with Proteus simulat...
pravin_35 Avatar
Posted By pravin_35
Thu Jul 31 2014, 01:49 AM
attach is the code for lcd may be need a little ch...
majoka Avatar
Posted By majoka
Wed Jul 30 2014, 02:45 PM
@ sermeteraythank you for sharing your experience ...
majoka Avatar
Posted By majoka
Wed Jul 30 2014, 02:38 PM
@ Peter_ParkerHC06 by default baud rate is 9600try...
majoka Avatar
Posted By majoka
Wed Jul 30 2014, 02:25 PM
attach is the code for lcd may be need a little ch...
majoka Avatar
Posted By majoka
Wed Jul 30 2014, 02:21 PM
@ pravin_35both compilers are almost sameif you ha...
pravin_35 Avatar
Posted By pravin_35
Wed Jul 30 2014, 07:38 AM
http://extremeelectronics.co.in/pic16f877a-tutoria...
NexusRevZ Avatar
Posted By NexusRevZ
Wed Jul 30 2014, 02:31 AM
Ok, I have edited the code, it's updated above wit...
NexusRevZ Avatar
Posted By NexusRevZ
Wed Jul 30 2014, 02:10 AM
Oh tahnk you so much for the reply. I will do imme...

Conversation

Thu Jul 31 2014, 04:32 PM
1
-1'
Thu Jul 31 2014, 04:32 PM
1
1
NexusRevZ
Tue Jul 29 2014, 09:32 PM
Anyone good in Asm lang?
ajay_bhargav
Mon Jul 28 2014, 12:34 AM
@ Anshu Raj sorry we do not take such requests.
Sun Jul 27 2014, 12:23 AM
Anshu Raj
sir plz send the automatic collage alram bells in 2 hrs bells ring. For microcontroller programme plz sir
ajay_bhargav
Thu Jul 24 2014, 01:06 AM
@R.ABHISHEK where? I dont see it. is it in forum?
Wed Jul 23 2014, 05:49 AM
R.ABHISHEK
sir,pls message on microcontroller 8051 assambly language new program
Wed Jul 23 2014, 05:47 AM
R.ABHISHEK
sir,pls message on 8051 microcontroller assambly language program new quastions
ajay_bhargav
Tue Jul 22 2014, 09:18 AM
@Pragya Android application is taken from google play. Only Author has its source with him. Application is only used in this project.
Tue Jul 22 2014, 04:58 AM
Pragya
plz send me 8051 code and android code for android based device controller via Bluetooth .Here in this project I am using Hc-06 Bluetooth module

Downloads

Comments

jayachandra
Fri Aug 01 2014, 04:47 AM
risko
Thu Jul 31 2014, 03:53 PM
ismaelfogaca
Thu Jul 31 2014, 10:50 AM
NexusRevZ
Tue Jul 29 2014, 09:29 PM
kritz22
Mon Jul 28 2014, 10:33 AM
Abbasans786
Mon Jul 28 2014, 03:15 AM
Imran.pk
Fri Jul 25 2014, 07:50 PM
PavanKh
Fri Jul 25 2014, 12:56 AM

Online

Guests: 45, Members: 0 ...

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

Members: 37487
Newest member: jayachandra