Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

coding using pic 16f877a with tsop4p38(proximity sensor)

Status
Not open for further replies.
The TSOP4P38 is quite similar to the units you mention, except it uses the attenuation of sensitivity by the AGC in the presence of a continuous ("pseudo-continuous") 38 KHz modulated beam to give an analog signal proportional to proximity. The sensing is based on measurement of the reflected beam.

That application is different than the ones you discuss based on beam break.

John
 
Nice little device. The transmitter is identical to the one I presented; so he could just copy that one. And for the receiver, the output is actually digital; a pulse which length is based on the distance. I would suggest to approach this no different than using a SONAR (such as the PING). The only caveat is that this device must be calibrated within the application (environment) to properly be used.
 
I think the real problem will be controlling for changes in reflected intensity due to different incidence angles and surface characteristic. Nevertheless, it looks like a fun project and is the first one I have seen on a couple of forums that uses that device.

John
 
Hi ripingz,

I just found we can upload asc (simulator files). So I have attached my file to this reply. I have modified the components on the higher frequency oscillator to give approximately 38 KHz with 50% duty cycle. Only one resistor is non-standard, and that can be made by a parallel combination of two, 5% resistors.

John

View attachment 61249

how can open this simulation file...im using proteus simulation software....are this circuit u designed are 38khz with 50 percent duty cycle???
 
Last edited:
I think the real problem will be controlling for changes in reflected intensity due to different incidence angles and surface characteristic. Nevertheless, it looks like a fun project and is the first one I have seen on a couple of forums that uses that device.

John


i knew that is the main problem that you had just mentioned. so after i make all the circuit works with coding....i need to calibrate it by testing and error..my lecturer are not pushing me to make the troli 100 percent works...just can make it forward and turning...then she will let me pass for this subject...hehe
 
View attachment 61260

in the attachment....are the tsop4p38 just connected to the microchip....or we have to add some circuit to the receiver...and what circuit i have to put in....the coding process i will forward to my lecturer....:p
 
Nice little device. The transmitter is identical to the one I presented; so he could just copy that one. And for the receiver, the output is actually digital; a pulse which length is based on the distance. I would suggest to approach this no different than using a SONAR (such as the PING). The only caveat is that this device must be calibrated within the application (environment) to properly be used.

what is the limit distance between transmitter and receiver to operate as my project i set the limit between the transmitter and receiver is 1m....and can i just use the circuit ur given without any modification to the circuit? as i can see...u said the we have to use another diode to give more or less output at the transmitter...which determine its output power.....can u tell me what diode i have to use???
 
Last edited:
I used LT Spice, ver. 4.13, which is free from Linear Technology Corporation. The very first time I used it on a project was when ETO was down all day -- it was a good way to waste time productively. This was only my second time using it, so there may well be errors.

From what I have read, several programs can open the .asc file. Certainly, Spice modeling is common. I don't know anything about compatibility with Proteus. Proteus may have an import function; otherwise, I would recommend just installing LT Spice or one of the other spice variants. The nice thing about LT is that it has a library of common and Linear components, including the NE555. I found it quite intuitive to use; although, schematic drawing is a little clunky compared to what I am used to (i.e., Eagle).

John
 
I used LT Spice, ver. 4.13, which is free from Linear Technology Corporation. The very first time I used it on a project was when ETO was down all day -- it was a good way to waste time productively. This was only my second time using it, so there may well be errors.

From what I have read, several programs can open the .asc file. Certainly, Spice modeling is common. I don't know anything about compatibility with Proteus. Proteus may have an import function; otherwise, I would recommend just installing LT Spice or one of the other spice variants. The nice thing about LT is that it has a library of common and Linear components, including the NE555. I found it quite intuitive to use; although, schematic drawing is a little clunky compared to what I am used to (i.e., Eagle).

John

ok downloadinng it now....but for now...i have two type of circuit i can use...which is from you and languer.....which should i choose....i dont really understand the link he given....especially the ir beam .... as this attachment : View attachment 61261 ..... this is a transmitter ir right... and then he also give this image....which is transmitter....how i'm gonna to use it....combined it???View attachment 61263
 
Last edited:
Hi ripingz,

I just found we can upload asc (simulator files). So I have attached my file to this reply. I have modified the components on the higher frequency oscillator to give approximately 38 KHz with 50% duty cycle. Only one resistor is non-standard, and that can be made by a parallel combination of two, 5% resistors.

John

View attachment 61249


please see this attachment View attachment 61265 ...are the resistor (R1) is the resistor i have to parallel it right??? so i have to use 9k x 2 resistor to parallel it....am i right??? why u said the resistor is non standard....???
 
Last edited:
ok..i have understood after discuss with my lecturer with all given circuit...which sir john has given a circuit which provide carrier frequency 38khz plus with 50% duty cycle. and then we must include the data with the carrier with using microchip which is MCU. how the circuit gonna be??? the tsop4p38 can make the distance measurement pulse by referring to reflected beam right??????
 
Last edited:
Yes, it is the 14K resister that you will need to find the parallel equivalent for. Have you studied how to calculate parallel resistance yet? Two, 9K resistors in parallel will give only 4.5K.

The formula using two resistors, R1 and R2, to get the resistor you need (Rn) is:

Rn = R1*R2/(R1 + R2)

Edit: I don't know what data you are talking about including in the IR transmitter signal. I think you may have confused the three different uses for these devices: 1) beam break detection; 2) data transmission, as in a TV remote; and 3) proximity detection. You are doing #3, I think. Also, at the outset, I thought you wanted to use 555's for the transmitter and an MCU (16F877) for the detector. You can also use an MCU for the transmitter.

Most important is for you to set out what you want to do in a logical sequence and work on getting that done. It is easy to get pulled in different and interesting directions and to want to try all sorts of new ideas, but that will really lengthen the time it takes to get to the finish line. I think the simple transmitter design I gave you will work. I would spend my time on prototyping it to be sure it works and then concentrate on the detection and analysis of results. Once you get the programming under your belt, if there is time, you can return to improving the transmitter.

John
 
Last edited:
Yes, it is the 14K resister that you will need to find the parallel equivalent for. Have you studied how to calculate parallel resistance yet? Two, 9K resistors in parallel will give only 4.5K.

The formula using two resistors, R1 and R2, to get the resistor you need (Rn) is:

Rn = R1*R2/(R1 + R2)

Edit: I don't know what data you are talking about including in the IR transmitter signal. I think you may have confused the three different uses for these devices: 1) beam break detection; 2) data transmission, as in a TV remote; and 3) proximity detection. You are doing #3, I think. Also, at the outset, I thought you wanted to use 555's for the transmitter and an MCU (16F877) for the detector. You can also use an MCU for the transmitter.

Most important is for you to set out what you want to do in a logical sequence and work on getting that done. It is easy to get pulled in different and interesting directions and to want to try all sorts of new ideas, but that will really lengthen the time it takes to get to the finish line. I think the simple transmitter design I gave you will work. I would spend my time on prototyping it to be sure it works and then concentrate on the detection and analysis of results. Once you get the programming under your belt, if there is time, you can return to improving the transmitter.

John

so there is no 14k resistor valued in market ???? i have calculated it..it using about two resistor that valued 28k to get the rn=14k.see this attachment:View attachment 61268 is this only place resistor will be modified by parallel it. and about the transmitter.why my lecturer said the circuit is only have carrier frequency and duty cycle but it do not have data ....so to make it work...the transmitter need an pic to produce data.as the receiver tsop4p38 need the data signal that combining with the frequency 38khz....that is modulated signal i mean.....the signal will demodulated to get the original data back.. this is wat my lecturer said in facebook.... and how about you sir??? did u design the circuit as simple as that for the transmitter without any additional circuit combined with ur circuit.. is that only needed for receiver tsop4p38 to recognise the signal ??? as in datasheet of tsop4p38 (see this attachment)View attachment 61270 View attachment 61271... im using this slide that is Reflective sensor 3: AGC of the IR Receiver is Used to Detect the Strength of the Optical Signal. that suitable for my project...tell me your feedback about this
 
Last edited:
When I said that 14K is not a standard resistor, I was referring to 5% resistors. Resistor values follow available standards based on the tolerance. That is, there are fewer values available for 5% resistors (E24 series) than there are for 1% (E96 series).

This chart may help: https://www.logwell.com/tech/components/resistor_values.html

John

in table...i can see valued 100 to 910 ..it is ohm...for example...if the resistor is valued 100 ohm... if i want to use 5% tolerance...so by looking the table e24....i will take 110 valued???? is that it???
 
Last edited:
When I said that 14K is not a standard resistor, I was referring to 5% resistors. Resistor values follow available standards based on the tolerance. That is, there are fewer values available for 5% resistors (E24 series) than there are for 1% (E96 series).

This chart may help: https://www.logwell.com/tech/components/resistor_values.html

John

how about the transmitter....will be receiver tsop4p38 will work with the transmitter that u have designed...is that only simple as that ???? using 5v ???
 
Last edited:
View attachment 61232 this is transmitter ... and then the receiver will be construted as in the labsheet data of the tsop4p38. and the output will attenuate two motor power window using this motor driver circuitView attachment 61233

how about the transmitter....will be receiver tsop4p38 will work with the transmitter that u have designed...is that only simple as that ???? using 5v ???

I am getting a little confused. Your post#5 (quoted above) was even simpler. Yes, I designed it for 5V, because I figured you would have a 5V supply for your MCU.


I cannot say with certainty that the receiver will work with the transmitter. That is why people build prototypes. I have never used the TSOP4p38 , and no one else has spoken up here who has experience with that device either. I have used TSOP detectors and IR senders, as have many people here. That transmitter design is one I used several years ago with a similar TSOP detector for a beam break device. It has been modified to meet the datasheet requirements for the TSOP4p38.

John
 
I am getting a little confused. Your post#5 (quoted above) was even simpler. Yes, I designed it for 5V, because I figured you would have a 5V supply for your MCU.


I cannot say with certainty that the receiver will work with the transmitter. That is why people build prototypes. I have never used the TSOP4p38 , and no one else has spoken up here who has experience with that device either. I have used TSOP detectors and IR senders, as have many people here. That transmitter design is one I used several years ago with a similar TSOP detector for a beam break device. It has been modified to meet the datasheet requirements for the TSOP4p38.

John

at the transmitter circuit... do i have to put one mcu combined with the circuit given or just plug and play and test it????just say yes or no ... i'm bad in english...sorry make u a little bit confuse....im really sorry sir john ...have u seen the datasheet i have posted...as the tsop4p38 required..... distance measurement **broken link removed** ...
 
Last edited:
can u give me how the receiver will be constructed............:p:p:p.. as in datasheet....i have to add some circuit right...what circuit i gonna use
 
Last edited:
ripingz said:
can u give me how the receiver will be constructed.............. as in datasheet....i have to add some circuit right...what circuit i gonna use
You do not need a circuit for constructing the receiver. It is included in the TSOP4p38. Please study that datasheet again.

In your post #26, you described how to connect that receiver to your MCU. Those connections look OK to me and were the ones recommended by Vishay. All you have to do is get the programming done and, of course, get your MCU connected to power and whatever output devices you intend to use.

John
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top