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

ajay_bhargav
Mon Oct 20 2014, 11:22 AM
@skrishna, please post in forum so we can help you better.
Tue Oct 14 2014, 01:45 PM
skrishna
how do i write an ALP equivalent 7segment display interfacing embedded c program (both 8051 microcontroller)
Sat Oct 11 2014, 06:41 PM
vaidehi
want details of seven segment LED display common cathode ( IC CD 4026)
Fri Oct 03 2014, 12:52 PM
Narsim
Rickey you inspired me a lot ... I am also planing like you ...
ExperimenterUK
Wed Oct 01 2014, 09:33 PM
We're back.. we had a bug, but posting is back to normal
ExperimenterUK
Sat Sep 13 2014, 04:34 PM
jaimin1212,Pimpalkhare Create a thread for your question
jaimin1212
Sat Sep 13 2014, 06:35 AM
i want to make self balancing robot using MPU6050 using atmega8.. please help to get data of gyro and accelerometer from this sensor through atmega8.
Thu Sep 11 2014, 01:00 PM
Sunil Pimpalkhare
Hello sir, I am trying to make Wearfin project https://www.youtube.com/watch?v=iZ6PVBvQf-g so can u help me in teaching how to built the program???
Thu Sep 11 2014, 06:21 AM
hariom panday
plz hlp me in my project
iec.naga
Tue Sep 09 2014, 05:19 AM
spi

Downloads

Comments

pddung93
Sun Oct 19 2014, 01:56 PM
msideal
Thu Oct 16 2014, 08:48 AM
robotgirl
Tue Oct 14 2014, 06:23 PM
BRV64
Mon Oct 13 2014, 05:48 AM
menadjelia
Mon Oct 13 2014, 02:47 AM
kulbhushan
Sun Oct 12 2014, 12:20 PM
HarrySid
Fri Oct 10 2014, 05:15 AM
pphamtuan
Thu Oct 09 2014, 03:58 AM

Online

Guests: 47, Members: 0 ...

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

Members: 37531
Newest member: pddung93
Forum Activity
jona Avatar
Posted By jona
Tue Oct 21 2014, 08:44 AM
This is the part I boughthttp://www.ebay.com/itm/3...
ajay_bhargav Avatar
Posted By ajay_bhargav
Mon Oct 20 2014, 11:19 AM
Use a 8bit shift register with latch control (e.g....
ajay_bhargav Avatar
Posted By ajay_bhargav
Mon Oct 20 2014, 11:17 AM
You can use the attach file button to attach the i...
ajay_bhargav Avatar
Posted By ajay_bhargav
Mon Oct 20 2014, 11:12 AM
I think you need to first check your code what exa...
ajay_bhargav Avatar
Posted By ajay_bhargav
Mon Oct 20 2014, 09:11 AM
I don't have resources to show this but if I get t...
ajay_bhargav Avatar
Posted By ajay_bhargav
Mon Oct 20 2014, 09:09 AM
Initialise _data in the header file to some value ...
ajay_bhargav Avatar
Posted By ajay_bhargav
Mon Oct 20 2014, 09:07 AM
8051 is slow in doing what? Well I don't think 805...
ajay_bhargav Avatar
Posted By ajay_bhargav
Mon Oct 20 2014, 09:00 AM
I also checked in Intel manual however I could not...
msideal Avatar
Posted By msideal
Sun Oct 19 2014, 07:25 PM
Is there anyone who could help me in solving this ...
jona Avatar
Posted By jona
Sun Oct 19 2014, 02:03 AM
Has anyone used this device? I was able to get the...