Simple beam break sensor


Closed Thread
Results 1 to 24 of 24
  1. #1
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697

    Default Simple beam break sensor

    Hi, I want to make a simple beam break sensor. Ive got some IR emiters and photo transisters.

    I connected the photo transister to an NPN transister which is connected to an LED. When i aim a remote at it the LED starts flashing (all good so far). When i connect the emitter up and aim it at the PT i can get the LED to light up but only at very close range (about 10CM). I tested again with my remote and managed to get about 30CM out of that.

    How can i make a beam break sensor that works over about 2 meters? For a start do i need different emitters and PTs? Eventually i want a PIC chip to check the beam but for now im just doing quick tests with a transistor and an LED. Do i need any special circuit to make it more sensitive? I messed with the grounding resistors and got it so it was as sensitive as possible without being triggered by normal light but i still cant get more than a few CM range

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


    Did you find this post helpful? Yes | No

    Default

    http://www.rentron.com/Infrared_Communication.htm

    Set up to receive the modulated frequency and you can in effect increase your range.
    Sometimes a focusing lens is needed for very long range. 6 meters.
    Dave
    Always wear safety glasses while programming.

  3. #3
    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)

  4. #4
    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.

  5. #5
    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.

  6. #6
    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.

  7. #7
    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

  8. #8
    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.

  9. #9
    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.

  10. #10
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by The Master View Post

    Is there a way to calculate what resistors and capacitors to use? .
    http://www.national.com/ds/LM/LM555.pdf
    The formula is in this data sheet near the end, page 10 between figure 13 & figure 14.
    Last edited by Archangel; - 27th July 2009 at 07:14.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

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


    Did you find this post helpful? Yes | No

    Default

    Sorry, i dont understand that formula. Its a bit more complicated than i thought.

    Ive been reading a few webpages (and re-reading this thread) and i think im starting to understand how it works. I like the 555 idea but if i need to send it in bursts then ill need 2 555s (1 for the 38.5khz frequency and 1 to control the bursts). Other sites also recommend a variable resistor for fine tuning.

    I think its best if i do use the PIC chip. I do still have the MCLR pin which can be used as an input only (for a sensor). Hopefully one of the pins on this chip has hardware PWM and hopefully that works how i think it does. That way i can adjust the frequency to suit and have the burst thing without having to make the PCB bigger and use extra components... and i wouldnt have to figure that equation out

    Im going to put an order in soon and get some new emitters/PTs and ill see how it goes. No doubt ill be back for more help when it doesnt work :P

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


    Did you find this post helpful? Yes | No

    Default

    Any of the PICs output pins can control the 555, look at the trigger pin of the 555. It is basically an on and off pin. The basic stamp folks did it this way before they had a freqout command.
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    Thats a good idea. Ill add some 555s and the related components to my next order

  14. #14
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    A simple beam break sensor, what about a $5.00 US laser module and a simple CdS cell ?
    http://www.doctronics.co.uk/555.htm#transducer
    easier formula here http://www.doctronics.co.uk/pdf_files/555an.pdf
    Last edited by Archangel; - 29th July 2009 at 09:09.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

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


    Did you find this post helpful? Yes | No

    Default

    I dont want people to be able to see the beam but if i cant get IR working then that might be the only option.

    Thanks for the links. Ill have a read through them

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


    Did you find this post helpful? Yes | No

    Default

    Im trying to get this 555 circuit working but nothing is happening. Ive been following a few different diagrams on the internet and none of them seem to work

    I found this calculator on google. I entered 38.5KHz, 50% duty cycle and 0.001uF (1nF) capacitor. It said to use an 18.7K resistor for RB and 0K for RA. Ive been using a 15K resistor with a 5K variable resistor as another website said. It doesnt really matter if its at the right frequency for now though. the LED just wont light up at all (im using an LED for now so i can see it working).

    Ive tried putting the output through a transistor. Ive tested the transistor by itself and it works fine.

    My circuit currently looks like the one on that calculator site. Does anyone know what ive done wrong or what to check next?

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


    Did you find this post helpful? Yes | No

    Default

    http://www.uoguelph.ca/~antoon/gadgets/555/555.html
    The above tells a lot about the 555. Try the metronome sample and step it up.
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    Ive had a read of that page and i tried the metronome example but its still not working. I didnt have a 250K variable resistor so i use a 220K normal resistor and i connected and LED to the output (and tried through a transistor).

    Ive tried 4 different 555s now so im sure its not the chips that are at fault

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


    Did you find this post helpful? Yes | No

    Default

    Been awhile since I have played with a 555, but I seem to remember something about different types.

    What are the numbers on you 555s?
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    I swapped to a different breadboard and its starting to look a little better. The metranome circuit worked. Ive put it back how i had it to start with and it seems to be oscillating but not properly.

    The circuit ive been copying is the Infrared Emitter 555 Schematic.

    The chips i have are NE555N. Aparently the ones that start with NE are good for driving LEDs etc directly

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


    Did you find this post helpful? Yes | No

    Default

    Mold...Mold on the bread board.

    You may be picking up some stray capacitance someplace.
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    I think its just got a few bad connections on it.

    The circuit still isnt working. Ive had a look at the output on my picoscope and its not a 50% duty cycle. I dont really know how to read the results properly but im pretty sure its the wrong frequency too.

    Im gonna go sleep on it. My head hurt a little after reading that link you posted. I think ill go back to the metranome and mess with some values tomorrow.

  23. #23
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by The Master View Post
    I don't want people to be able to see the beam, but if I cant get IR working then that might be the only option.

    Thanks for the links. Ill have a read through them
    red laser / infrared filter might work . . .
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

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


    Did you find this post helpful? Yes | No

    Default

    This seems to be working now. The calculators ive used say that RA (or R1) should be 0K. The circuit doesnt work unless i put a 1K resistor in. Ive tried a few lower values but the LED will go off after a set amount of time then not come back on. 1K doesnt give me a 50% duty cycle but it seems to be alright.

    Once it was flashing correctly i changed the other values to what the calculator said and the LED came on but dimmer than usual so i assume its flashing really fast. I replaced with an IR LED and it now works over 2M

    I hope it keeps working once its all soldered into a PCB :P

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