Simple beam break sensor


Closed Thread
Results 1 to 24 of 24

Hybrid View

  1. #1
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Isnt there a simpler way to do it? The emitters and PTs will all be connected to the same PIC. That PIC needs to do PWM on a few sets of LEDs and needs both its UART pins for talking to a PC. I dont have a spare IO pin to control the emitters either. I was hoping to just connect them to VSS/VCC through a resistor.

    I dont need to send data. I just need a simple beam break system (on/off)

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    1. Emitters and Sensors prefereably should be matched in the same IR range... One Emitter may not work well with a Detector best suited for a different range.

    2. You may be being swamped by ambient light (which contains IR, UV, cats, dogs and the neighbours barbie smoke as well). To see if this is the case, try your experiment in a darkened room and you'll discover you have a much improved range over a room in broad daylight. Use an IR filter (wrench one out of your neighbours TV's facia as an experiment). Modulating the emitter at something like 32kHz and decoding similarly by the detector is what separates the signal from ambient noise (this nothing to do with actually sending Data).

    3. The TSOP range of Detectors (eg TSOP17xx & TSOP18xx) contain integral filters and decoders which means you don't have to worry about that part of it. Even then when you look at the Datasheets you'll see they are optomised for certain frequencies).

    4. You may notice (from Datasheets) that the junk IR Emitter/Receiver pairs are really specified for only a few cm operation.

  3. #3
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    The ones i got are matched (according to rapid). They are most likely a "junk pair" though.

    When i was testing the room was fairly dark. The LED did light up when i shon a lamp into the PT but without a bright light it stayed off until i shon the emitter into it.

    Rapid dont sell the ones you mentioned but they do have some that say "Demodulated output signal can directly be decoded by a microprocessor". Is there such thing as an emitter that modulates itself or will i need to find another IO pin for that.

    This is my first time dealing with IR and it seems i dont know much about it. When i was at school a teacher said i could use it in the same way as an LED and an LDR. Nobody said anything about modulating it.

    Lets just make sure i understand how this works. The emitter is modulated at a set frequency. For a 3 pin PT that has a demodulated output does that mean that even though the beam is modulated i will see a steady output?

    Would this emitter be suitable with this PT (55-0902)? The emitter looks relatively powerfull and the PT has a demodulated output, IR filter, "High immunity against ambient light" and is highly sensitive etc.

    Both sides will be set about 7cm into holes which should stop any external light getting into the sensor. They will be just over a meter apart but i want this to work over 2M to make sure its reliable.

  4. #4
    Join Date
    Mar 2006
    Location
    China
    Posts
    266


    Did you find this post helpful? Yes | No

    Default Well

    To start with I must say that the data sheets for these products are not that detailed.

    It seems to be a good match between the LED and the Receiver and that is a good start. Around 940 nm so this will not be a problem.

    Your big problem here is that you MUST modulate the LED with a 38kHz carrier frequency for the receiver to work. To make things even more difficult you can not just modulate it with 38k always, it has do be done in bursts. Please keep in mind that the PIC can only provide 25 mA current and that will not be enough for this to work well. You will need a mosfet or ULN 2001 or anything faster than a relay.

    Let me explain some more...
    In a better datasheet for a TSOP it will say the minimum number of carrier cycles for the receiver to decode the signal. 6-10 is a quite normal number. It will also say that a gap (off time) must be usually around 10-15 cycles between bursts.... and if any burst is longer than 70 cycles you will need a gap at least as long as the burst. VISHAY is a great place to find good datasheets.

    This is for the gismos and gadgets inside the TSOP to work.. if the carrier is always on the AGC will adjust the sensitivy lower and then you will not get any result. There are some new TSOP by Vishay (TSOP4038, TSOP58038 are specially made for light barrier systems)that can be modulated continously but I hardly think this one has that based on the date 2007 and the poor datasheet.


    If you want to use this one you must find a way to send bursts of 38kHz square wave to the LED and each of these bursts should probably be 10-70 cycles and followed by a gap where the LED is off for a time period similar to 15-20 cycles.

    The easiest way would require 2 pins on your PIC. One HPWM set up to 38k (manually) and the other pin connected to the receiver to check if the output pin goes low. Pros: Since you have modulated the LED and it is only turned on in short bursts you can drive it really hard. 300-500 mA would probably work depending of how often you send a burst. More current=more light= longer distance!

    If you only have one pin I would recommend you to use a AD or comparator input and read a LDR or PIN diode. In this case you can leave the LED on and check for a drop in the AD voltage when the beam is broken. Cons: The background light in the room can really influence the result. Indoor with a proper optical filter the ambient light should not be a problem when using IR. In this application a cheap laser pointer could probably work better than the LED since you will get a much higger mW/mm2 on the receiving end. But that would be harder to aim :-)

    As mentioned before... use lens, a normal magnifying lens in front of the LED and one more in front of the receiver helps alot if they are properly focused. This you can easily see if you try with a RED led, then you will see what happens when you move the lens in front of the LED.

    And if you go for a IR led solution get a optical filter. It sais that the TSOP has a built in filter but adding the dark piece of plastic Melanie suggested to "borrow" from a neighbour will help alot.
    Last edited by Jumper; - 24th July 2009 at 16:50.

  5. #5
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    How picky are these things about the frequency? I should be able to get a PIC to output close to 38KHz but it wont be exact and the chip will be doing PWM on other outputs aswell as sending and receiving serial data so it might change a lot.

    When you say "cycle" i assume you mean the emitter turning off and back on again (not an instruction cycle on the PIC).

    Ive got some transistors i can use to drive the emitters so that bits ok.

    Would i be able to do this without the lenses? I might be able to find some of those IR filters somewhere but i cant think of anywhere i could get magnifying lenses from

    Ill add a few of the ones i mentioned before to my next order so i can do some more tests

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    You can rig a 555 to for the 38.5KHz. then all you have to do is trigger it when needed.

    Cheap lens = cheap loupe. 10x might be a good start.
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Good idea. I never thought of using a 555. Do you know what value resistors and capacitor i would need to get the right frequency? Ive been using a 555 calculator and ive got 0.820K, 1.5K and 0.01uF. They give about 37.6MHz. Does it have to be exactly 38.5KHz?

    Is there a way to calculate what resistors and capacitors to use? It would be better if there was a calculator where you can enter the Hz and it will calculate those for you.

Similar Threads

  1. Need a cheap touch sensor idea.. here it is
    By mister_e in forum Code Examples
    Replies: 20
    Last Post: - 16th April 2016, 22:42
  2. Ultrasonic distance sensor with PIC16F84A
    By MrRoboto in forum mel PIC BASIC
    Replies: 3
    Last Post: - 29th June 2009, 09:01
  3. PICBASIC PRO-coding for wireless sensor node
    By syazila in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 10th February 2009, 00:05
  4. Replies: 0
    Last Post: - 2nd February 2009, 23:23
  5. Replies: 6
    Last Post: - 18th January 2008, 08:17

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts