Our Own Ir Sensor

Embed Size (px)

Citation preview

  • 8/9/2019 Our Own Ir Sensor

    1/23

    Make your own IR obstacle detection sensorTip/walkthrough

    By OddBot @ Tue, 2008-11-11 03:06Detects objects at close range. Can be used for object tracking.Cost to build:$4

    Target environment: indoors

    Description:

    http://letsmakerobots.com/view/node/list/robot_tiphttp://letsmakerobots.com/user/1533http://letsmakerobots.com/taxonomy/term/231http://letsmakerobots.com/files/field_primary_image/Object_tracker_small.jpghttp://letsmakerobots.com/user/1533http://letsmakerobots.com/user/1533http://letsmakerobots.com/taxonomy/term/231http://letsmakerobots.com/view/node/list/robot_tip
  • 8/9/2019 Our Own Ir Sensor

    2/23

    Now with video of the sensor being used as a Mintvelt inspired object tracker! This sensor is ashort range obstacle detector with no dead zone. It has a reasonably narrow detection area whichcan be increased using the dual version. Range can also be increased by increasing the power tothe IR LEDs or adding more IR LEDs

    The photo below shows my test setup with some IR LED's (dark blue) as a light source and two

    phototransistors in parallel for the reciever. You could use one of each but I wanted to spreadthem out to cover a wider area. This setup works like a FritsLDR but with IR. It has a range ofabout 10-15cm (4-6 inches) with my hand as the object being detected.

    I'm only running my LEDs about 20mA. My LEDs are capable of 50mA continuous and someLEDs are capable of 100mA (see "Getting the most from a LED").

    I'm using this setup on Junior as a general purpose object advoidance sensor to prevent himbacking into anything. I'm getting a good response with less than a volt when my hand is upclose and reflecting the IR and over 4.5V with no IR.

    To get this to work well with an A/D input it needs to have a much lower impedance (needs to letmore current through). You can do this with an op-amp but most op-amps like more than 5V andare usually more expensive than my one transistor and three resistors. This is a simple one

    transistor amplifier that gives my ADC good resolution. Click on the schematic for a largerpicture.

    http://letsmakerobots.com/node/2899http://letsmakerobots.com/node/2899
  • 8/9/2019 Our Own Ir Sensor

    3/23

    Starting from theleft you can seemy two IR LEDswith a resistor and

    transistor in series.The transistorallows theprocessor to turnthe LEDs on oroff. This isnecessary to tellthe differencebetween theambient IR fromdaylight and indorlighting and thereflected lightfrom the LEDs thatindicates thepresence of anobject.

    Next are my two phototransistors in parallel with a 1M resistor in series. You could use only onebut I wanted to cover a wider area so my transistors will point in slightly different directions. Ifeither one detects IR it will allow more current to flow. Since volts=current x resistance, even asmall increase in current will create a reasonable increase in voltage across the 1M resistor.Unfortunately the low input impedance of many AD converters will act like a small resistor inparallel with the 1M resistor and dramatically reduce the output to the processor. This is where

    our BC549 transistor comes in to save the day. In conjunction with the 1K and 10K resistors itamplifies the signal so that the analog input on your processor gets a nice strong signal. TheBC549 is not too critical, just about any general purpose signal transistor should do. Mytransistor had a hfe of 490 when measured with a multimeter. You should probably have a hfe ofat least 200-300.

    As you can see mysensor is madefrom liberalamounts ofhotglue. Clickimage for a biggerpicture. This hasthe advantage thatyou can flex theleds and transistorsoutward to cover alarger area. This isjuniors reversing

    http://letsmakerobots.com/files/userpics/u1533/IR_sensor_Schematic.jpghttp://letsmakerobots.com/files/userpics/u1533/IR_sensor.jpghttp://letsmakerobots.com/files/userpics/u1533/IR_sensor.jpghttp://letsmakerobots.com/files/userpics/u1533/IR_sensor.jpghttp://letsmakerobots.com/files/userpics/u1533/IR_sensor_Schematic.jpg
  • 8/9/2019 Our Own Ir Sensor

    4/23

    sensor to prevent him reversing into anything and as such will cover a wide area. I will makesingle Led/Phototransistor sensors for front left and front right. This will allow him to avoidcrashing into obstacles when his rangefinder/object tracker is looking elsewhere.

    Note that the phototransistors are slightly forward of the blue LEDs. This helps stop stray lightfrom the LEDs being detected.

    Below is the sensor hooked up to Juniors mainboard which has three of my amplifiers built in.

    Using a simple test program that turns on the IR LEDs, stores the value of the ADC, turns off

    the LEDs, reads the ADC again and then subtracts the stored value from the recent value I wasgetting readings from 6 to 940. This was with the curtains closed and the lights off. When thereading was 6, my hand was about 300mm (1ft) away. With the lights on the values ranged fromabout 60 to 940 with a value of 60 being with my hand only about 150mm (6inches) away.Considering the max possible resolution with a 10bit ADC is 0 to 1023, I thought 60-960 withthe lights on was a very good result.

    After a comment about using sleeves I repeated these test with heatshrink sleeves on the LEDsand phototransistors. The sleeves actually had a negative effect and reduced the range. After Iremoved the sleeves I did not get the same reduction in range with the lights on. I don't know if itis because during the first test it was daylight outside and the curtains didn't block it all or if itwas the way I held the sensor but the second set of test gave an almost identical range of

    approximately 300mm (12 inches) reguardless of the lights being on or off. I'll have to try againtomorrow when it is daylight again. It seems my initial test was at fault, maybe the way I heldthe sensor?

  • 8/9/2019 Our Own Ir Sensor

    5/23

    This is the singleversion of thesensor and willcost about half. Inthe photo you cansee the currentlimiting resistorfor the LED.Ignore the value asI had differentrequirements forJunior. Use thevalues shown inthe schematic.

    I've joined the positives together so there is only three wires going back to the mainboard.

    Note that the phototransistor is slightly in front of the LED to prevent stray light from the LED

    being detected.

    Once again I'veused hotglue andheatshrink to makeit solid and wellinsulated.

    This is theschematic for thesingle version.Click on it and thephotos for largerimages.

    http://letsmakerobots.com/files/userpics/u1533/IR_Sensor_Single.jpghttp://letsmakerobots.com/files/userpics/u1533/IR_Sensor_Single_2.jpghttp://letsmakerobots.com/files/userpics/u1533/IR_single_sensor_Schematic.jpghttp://letsmakerobots.com/files/userpics/u1533/IR_Sensor_Single_2.jpghttp://letsmakerobots.com/files/userpics/u1533/IR_Sensor_Single.jpg
  • 8/9/2019 Our Own Ir Sensor

    6/23

    Because this sensor only has a single phototransistor it isn't quite as sensitive. To compensateI've increased the current to the LED to almost 50mA which is the maximum continuous currentallowed. Because the LED is pulsed on and off this is quite safe and could have been increasedto 100mA. The problem with pushing a LED to its limits when controlled by a proccesor is thatif a fault occurs in the software then the LED could be destroyed.

    When tested, The readings from the ADC of the picaxe ranged from about 100 - 910 reguardlessof background lighting. Despite the slightly reduced resolution due to a single phototransistor therange was about 400mm (16inches). This increased range was due to the increased power to theLED.

    Make certain your LED and phototransister are parallel to each other for good range.

    It was asked how wide is the detection area. Using my hand as the object at a distance ofaproximately 300mm (12 inches) from the single sensor the detection area was about 150mm (6inches) wide. The double sensor can detect a wider area if the phototransistors are spread out atdifferent angles.

    Using my hand sideon to the single sensor the detection area was only about 60-70mm (2-3inches). This is reasonably narrow due to the lenses in the LEDs and the phototransistors.

    It should be noted that this is not a linear sensor because the intensity of light from the LEDs is 1divided by distance squared. In other words, when the object is twice the distance away, the IRfrom the LEDs is 1/4. As a result, the closer the object, the better the resolution.

    This would be a useful sensor to fill in for the dead zone of other IR sensors such as the SHARPGP2D12. To prevent interferance, one should be disabled when using the other.

    As mentioned at the start, I've also experimented with using two of these sensors for a simple

    object tracker inspired by Mintvelt's "four eyes". This version can't tell the size or distance of anobject but can track an object well enough for a robot to recognise a moving object and givechase. Wish I still had a cat, imagine a robot with a waterpistol chasing a cat around the house :

    I've attached the code used in the video as well as an improved version (V1.7) that eliminated theservo jitter.

  • 8/9/2019 Our Own Ir Sensor

    7/23

    Good luck and enjoy :)

    Sunday 4-1-2009

    This is the latest version of my object tracker as used in SplatBot. I've used 20 IR leds to increasethe range. They are limited to 50mA at the moment so that they can't be damaged by faulty code.If I was to push them to their limit then the range could be increased further but they could thenbe damaged by something like an interupt routine occuring when the LEDs are on.

    http://letsmakerobots.com/node/4150http://letsmakerobots.com/files/userpics/u1533/Object_tracker2.jpghttp://letsmakerobots.com/node/4150
  • 8/9/2019 Our Own Ir Sensor

    8/23

    This is the schematic.

    Click on it for a larger picture. I found with all The LEDs on that the sensors were swamped byreflected IR from my hand even at a distance of about 400mm. The circuit works fine and Idefinitely get a lot more range but I'm going to have to remove the sensors from the board andmount them seperately so that I can adjust their distance relative to each other to optimisetracking and so I can better shield them from ambiant IR.

    This is a work in progress.

    Updated: 19-1-2009

    I've experimented with improving and simplifying the detection circuit. This will give you betterrange.

    http://letsmakerobots.com/files/userpics/u1533/IR_sensor_array_Schematic.jpg
  • 8/9/2019 Our Own Ir Sensor

    9/23

    The MPSA13 is a high gain darlington transistor with a hfe of over 5000. If you get the MPSA14it has about twice the gain. By adjusting the 500 ohm trimpot you should get much better rangethan the old circuit.

    Top of Form

    node 2907

    2 80 /fivestar/vote/no Great

    PoorOkayGoodGreatAwesomeYour rating: None Average: 4 (2 votes)

    http://www.futurlec.com/TransGenMPS.shtmlhttp://www.futurlec.com/TransGenMPS.shtml
  • 8/9/2019 Our Own Ir Sensor

    10/23

    node/2907 Rate fivestar_form_no

    Bottom of Form

    Login orregisterto post comments

    By ViTek@ Sun, 2008-11-23 05:07

    If you put sleeves on the IR

    If you put sleeves on the IR LED's so it won't shine directly into the recievers it may improveperformance :)

    Login orregisterto post comments

    By OddBot @ Sun, 2008-11-23 08:41

    Sleeves

    I tried using small black sleeves of heatshrink that fitted snugly over then LEDs and thephototransistors. This actually reduced the response. I then tried very short sleeves on the

    phototransistors only, with just the body (not the rounded front) covered. This did reduce thefluctuations caused by the fluroesent lights but also caused the value to occasional go negative(jumped to 65535).

    The fluctuations are because the fluro lights pulsate rapidly with the AC from the wall. InAustralia it is 50Hz. Because the picaxe is sampling at a different rate the readings fluctuate.

    The sleeves are not necessary because of the lenses moulded into the LEDs and thephototransistors combined with the fact that the phototransistors are slightly forward.

    Login orregisterto post comments

    By mintvelt @ Sun, 2008-11-23 09:43

    Sharp Rangefinder

    This configuration would probably have a nice wide beam. Dit you test the width of the detectionarea?

    http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1741http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1533http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1223http://letsmakerobots.com/user/1223http://letsmakerobots.com/user/1533http://letsmakerobots.com/user/1741http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1741http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1533http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1223
  • 8/9/2019 Our Own Ir Sensor

    11/23

    I've read that the sharp IR rangefinder uses some sort if modulation to make sure it gives goodreadings in differtent lighting conditions. I asume the frequency of the light is modulated, buthow do you do that with an LED?

    Login orregisterto post comments

    By voodoobot @ Sun, 2008-11-23 10:28

    You could use pwmout to

    You could use pwmout to modulate the led or a 555 timer chip, but you'd then need a modulatedreceiver as well(though those are sold in a nice small package like a tsop4840).

    Login orregisterto post comments

    By OddBot @ Sun, 2008-11-23 11:33

    Modulation

    My sensor, like the FritzLDR and I presume the sharp sensor from what I've seen of its blockdiagram all work by pulsing the IR LED on and off, This is necessary to eliminate false readingsdue to background IR from indoor lighting and daylight. It is not the frequency of the light itselfthat is modulated.

    I've now updated the tip/walkthrough to include the width of the detection area but it is only

    aproximates as it could vary slightly with different components used. Login orregisterto post comments

    By rik@ Sun, 2008-11-23 09:58

    good tutorial

    This kind of writing is what we need on LMR! Forget about that pulsy thingy. We need high

    quality walkthroughs!

    This would be one of them. Thanks Oddbot. Your schematics are starting to become yourtrademark. In a good sense.

    One request though: could you name your sensor after its goal, rather than after its means? Sureit uses IR, but in the end we all want to build a distance sensor, or an obstacle detector.I guess it'sall about that purpose thing again....

    8ik

    http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/747http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1533http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1069http://letsmakerobots.com/user/1069http://letsmakerobots.com/user/1533http://letsmakerobots.com/user/747http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/747http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1533http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1069
  • 8/9/2019 Our Own Ir Sensor

    12/23

    Login orregisterto post comments

    By OddBot @ Sun, 2008-11-23 10:45

    Fair enough

    Sorry Rik, I did do the tag thingy, now I'll work on the name thingy :D

    I'm about to update with the single version of the sensor so I'll do a rename while I'm at it.

    Login orregisterto post comments

    By rik@ Sun, 2008-11-23 12:18

    nice !

    now it's just plain perfect

    Login orregisterto post comments

    By mintvelt @ Mon, 2008-11-24 09:56

    Great!

    very smooth indeed. So beautiful. So small. With the detector and LED so close together theyreally look like two eyes.

    It is strictly speaking not a mintvelt tracker as the eyes don't move individually. However: seeingyour tracker and the demo CTC made, I'm starting to wonder if the individual eye movement is

    needed at all if you don't have a large range (600mm or more) and/or a very narrow beam. You'dneed to narrow the detection area if you increase the range of course.

    Login orregisterto post comments

    By OddBot @ Mon, 2008-11-24 10:41

    http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1533http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1069http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1223http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1533http://letsmakerobots.com/user/1223http://letsmakerobots.com/user/1069http://letsmakerobots.com/user/1533http://wikimediafoundation.org/wiki/Donate/enhttp://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1533http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1069http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1223http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1533
  • 8/9/2019 Our Own Ir Sensor

    13/23

    Strictly speaking

    True it isn't the same as your tracker but I felt you deserved credit for the inspiration. It can'tdetermine the size or distance of an object but set it up with a waterpistol and the cat's in for anasty suprise :D

    I've edited the intoduction text accordingly.

    Login orregisterto post comments

    By OddBot @ Tue, 2008-11-25 09:13

    Narrow beam

    I thought about what you said. In the diagram below I exagerated the detection area.

    http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1533http://letsmakerobots.com/user/1533http://letsmakerobots.com/user/1533http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1533
  • 8/9/2019 Our Own Ir Sensor

    14/23

    As you can see the overlapping area is very small, this is where the object being tracked lies. Theyellow areas are like periperal vision, seeing something in the corner of your eye makes you turntowards it for a better look.

    Turning the eyes in and out is useful for determining the size of the object and changes the sizeof the overlapping area to fit that object.

    Login orregisterto post comments

    By mintvelt @ Tue, 2008-11-25 09:43

    The Big Picture

    it is! It is a big picture. :p

    I see the eye are looking outward to narrow the overlapping area. What I mean by narrowing thebeam, is that if the outer edge of one detection area is angled at 45 degrees, the actual width ofthe detectionarea is the detection range times 2.

    So if you increase the range to 2 meters, your detection area is 4 meters wide. That is prettywide. Even for object tracking by getting both sensors to see the object.

    Still, looking at your video, I'd say the angle is a lot less than 45 degrees

    Login orregisterto post comments

    By OddBot @ Tue, 2008-11-25 23:32

    The angle is narrow because

    The diagram is exagerated, the angle is narrow because the sensors have lenses moulded in. Thedownside is that the LED and the phototransistor need to be aligned optically. In my code for theIR object tracking I had to calibrate the sensors. I found at least part of the reason for this wasthat with one of the sensors, the hot glue set with the LED/phototransistor noticably out ofalignment. Correcting this drastically reduced the problem of getting both sensors to respondequally. Other factors such as different amounts of transistor gain mean that some callibration in

    the software will always be nescessary.The real question is what do you want your robot to do with this ability? Is long range trackingusefull? The greater the range, the more objects that will be detected and confuse the readings.You need to either do high resolution scans (which require more proccesing power than a picaxe)with a precision scanner (which is what I was trying to do with the laser range finder) anddetermine whats moving and what isn't or stick to short range and simple sensors that detectfewer objects and simplify programming.

    http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1223http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1533http://letsmakerobots.com/user/1533http://letsmakerobots.com/user/1223http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1223http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1533
  • 8/9/2019 Our Own Ir Sensor

    15/23

    So far from what i've seen of the more complex robots that use cameras and high end processors,they don't do any more than our very simple object tracking systems except determine the colourof an object. Three LDRs with different coloured cellophane filters (Red, Green, Blue) and awhite LED would work well enough to tell if an object is orange or pink or purple etc.

    Oh crap! I'm rambling again. Sorry :|

    Login orregisterto post comments

    By ViTek@ Sun, 2008-12-07 20:05

    What if you turn the sensor

    What if you turn the sensor pairs inwards?

    /\ Inwards like that Login orregisterto post comments

    By dikos @ Wed, 2008-11-26 12:33

    nice !

    www.GRobot.gr

    Login orregisterto post comments

    By maneuver@ Fri, 2008-11-28 11:07

    Just a thought

    I havent thought this through, I'm just blurting it out, ok?

    What if you put IR film in front of the Phototransistors? Will that prevent the fluctuations

    caused by the fluroesent lights to distract your readings`?

    / vzz-clck-"Maneuver"

    Login orregisterto post comments

    By OddBot @ Fri, 2008-11-28 21:51

    http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1741http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1816http://www.grobot.gr/http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/476http://letsmakerobots.com/user/476http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1533http://letsmakerobots.com/user/476http://letsmakerobots.com/user/1816http://letsmakerobots.com/user/1741http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1741http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1816http://www.grobot.gr/http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/476http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1533
  • 8/9/2019 Our Own Ir Sensor

    16/23

    Good Idea

    But the filtering is built into the phototransistors as they only respond to a narrow band of thespectrum. The problem is that many light sources also put out some IR, even white LEDs. Abigger problem is that sunlight contains so much IR it completely swamps the sensors so thissetup is only good for indoor / nocturnal aplications.

    Login orregisterto post comments

    By mieczotronix@ Wed, 2008-12-03 12:46

    my findings

    Hi. I have tested this circuit, with somewhat different components (L-53F3C + L-53P3BT with

    30deg lens + BC337) and since I had some problems with range I started playing with resistors.My LED is rated 50 mA std (1.2 A peak)

    I've found this page:http://ourworld.compuserve.com/homepages/Bill_Bowden/led.htm where Icalculated Ohms for the LED resistor and my findigs are:

    150 ohm gives 18 mA through each LED - and that's to low for the circuit to sense anythingfurther than a few cms. 50 ohms would be ok to put 50 mA through each LED. I tested 75 ohms(giving 35 mA) and found my LEDs still to dark.Since I only had 1 ohm and 47 resistors, Ifinally decided to scrap the resistor alltogether and switch the LED on briefly before reading theanalog pin and OFF afterwards. Like that

    digitalWrite(IRPIN, HIGH);

    delay( 6 ); /// wait until the LED warms up - I've found that this delay is necessary otherwisereadings flucutateval[buf_w] = analogRead( RANGERPIN );digitalWrite(IRPIN, LOW);

    // ... do some other stuffdelay( 50 );

    I guess that for table-fall-prevent-kind-of sensors I'll use a resistor as it will improve resolutionof short-range measurements and I'll probably use one zero-ohm IR blaster for some obstaclechecks. Anyway I'm quite new to robots, so I'll se what's to come.

    Login orregisterto post comments

    By mieczotronix@ Thu, 2008-12-04 00:35

    I made a small PCB in Eagle

    I made a small PCB in Eagle and fabricated it using (laser printer+iron). Now it's more handy

    http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/2065http://letsmakerobots.com/user/2065http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/2065http://letsmakerobots.com/user/2065http://mieczu.webd.pl/modele/elektr/Irsensor.ziphttp://letsmakerobots.com/user/1533http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/2065http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/2065http://mieczu.webd.pl/modele/elektr/Irsensor.zip
  • 8/9/2019 Our Own Ir Sensor

    17/23

  • 8/9/2019 Our Own Ir Sensor

    18/23

    The gap in the middle free of tracks is meant to aid with fixing the board to a servo. Also LEDscan be mounted vertically as well as the pin header.

    Login orregisterto post comments

    By OddBot @ Thu, 2008-12-04 05:55

    Really nice work!Your board is very neat, looks great! I'm sorry if you had trouble with range. 20-50mA should beenough to get at least 150mm range but since posting this tip I have found / confirmed a numberof things that can reduce your range.

    1. if you IR LEDs are at a different wavelength to your phototransistors range of spectralsensitivity. My LEDs and phototransistors were all rated at 940nm.

    http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1533http://letsmakerobots.com/user/1533http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1533
  • 8/9/2019 Our Own Ir Sensor

    19/23

    2. alignment between LEDs and phototransistors, a small difference in angle can have a bigeffect on range. Keep them parallel to each other.

    3. sunlight / background IR can swamp the light emmited by the LEDs.

    I've been trying to find a datasheet for L-53P3BT with no luck. If you can supply some data on itI might be able to help you increase the range.

    Login orregisterto post comments

    By OddBot @ Thu, 2008-12-04 06:05

    I think you've made a mistake?

    I was looking at you board, it looks like you have mixed up your LEDs and photo transistors.

    The LEDs are blue. Login orregisterto post comments

    By mieczotronix@ Thu, 2008-12-04 08:51

    thanks . Nope, they're not

    thanks. Nope, they're not mixed. These LEDs are white and phototransistors are blue. If I mixedwould'nt work, would it. Anyway I checked them with my videorecorder while I was checkingtheir range. And it were LEDs that were blinking. According to the shop where I bought them,bothphototransistors andLEDs are rated 940 nm.

    I confirm that ambient lighting has great effect - both my computer monitor and fluorescent lampabove the desk can greatly disturb readings. I'll fiddle with the alignment.

    Login orregisterto post comments

    By mintvelt @ Sun, 2008-12-07 17:38

    Range improvement

    I was looking at the specs of the picaxe IR sensor.The one that is used to receive remote controlsignals. This device has a build in amplifier,bandpass and modulator and is very sensitive.

    I built a test setup on a breadboard and measuredthe output voltage of the signal pin with amultimeter when I press a button on my (sony)

    http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1533http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/2065http://letsmakerobots.com/user/2065http://www.tme.eu/fototranzystor-940nm-30-30v-soczewka-przezroczysta/arts/pl/a06/ire5.htmlhttp://www.tme.eu/nadajnik-podczerwieni-led-5mm-940nm-przezroczysty/arts/pl/a06/l-934f3c.htmlhttp://www.tme.eu/nadajnik-podczerwieni-led-5mm-940nm-przezroczysty/arts/pl/a06/l-934f3c.htmlhttp://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1223http://www.rev-ed.co.uk/docs/TSOP18.pdfhttp://www.rev-ed.co.uk/docs/TSOP18.pdfhttp://letsmakerobots.com/user/1223http://letsmakerobots.com/user/1533http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1533http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/2065http://www.tme.eu/fototranzystor-940nm-30-30v-soczewka-przezroczysta/arts/pl/a06/ire5.htmlhttp://www.tme.eu/nadajnik-podczerwieni-led-5mm-940nm-przezroczysty/arts/pl/a06/l-934f3c.htmlhttp://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1223http://www.rev-ed.co.uk/docs/TSOP18.pdf
  • 8/9/2019 Our Own Ir Sensor

    20/23

    remote control unit. It drops from 5 to 2.5V and I asume that it's rapidly switching high and lowfrom the signal.

    In the testsetup an IR-LED was sending a couple of bytes using the picaxe irout command. Thesame picaxe 08M had its input pin (3) connected to the output pin of the ir sensor. Because thepicaxe cannot receive and send at the same time, an interrupt was set on pin3 to go off when pin3

    was low. To signal that the interrupt had been triggered an red LED flashed.I had to put the IR-LED allmost against the sensor to make it trigger the interrupt. But when Iused a remote control unit, no matter where I pointed it, it triggered the interrupt as soon as Ipressed a button.

    When I compared theIR-LED of the remotecontrol to the IR-LEDhooked up to the picaxeby looking at them witha video camera, thedifference in brightness

    was huge! I meanreally huge. The LEDin the remote controlshines brightly and isclearly visible, the oneon the breadboardappears to be off unlesyou point the cameraright at it. Then you seea very dim spot oflight.

    Surely it mustbe possible toget an IR LEDconnected to thepicaxe to shine just as bright?

    Surely it must be possible to shield part of the IR-sensor to obtain a narrower detecionbeam?

    Surely it must be possible to get those two set-up to build an IR object detector with arange of at least 1 or 2 meters?

    Especially when you look at the detectionrange of the IR-sensor when using a regular remote

    control.

    Login orregisterto post comments

    By robologist @ Sun, 2008-12-07 18:16

    http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/610http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/610
  • 8/9/2019 Our Own Ir Sensor

    21/23

    LED current

    In your schematic you are limiting the current to the IR LED to 13 mA (4.3 v / 330 ohm) fromthe PIC pin, which is only capable of 25 mA anyway. Oddbot has the PIC pin switching atransistor, which allows the paired IR LEDs getting around 24 mA (ignoring the transistor loss),driving them a bit harder. If you look up the datasheet for the IR LED being used, you should beable to calculate how hard you can drive them. That remote could be putting a few 100 mAacross the LEDs it uses, though only briefly. Check thisgroup of messages. At the same time, Ithink Oddbot said that the LED current must be tuned to best functionality, as in highest LEDcurrent may not always be best.

    Login orregisterto post comments

    By mintvelt @ Sun, 2008-12-07 19:40

    Tweak!

    I guess I'll have to start tweaking until I get the LED brighter. I was hoping I could buy a 'specialultrabright, built for remotes'-LED somewhere. Still.. The difference between the remote and thebreadboard LEDS is enormous. I can't imagine trippling the current can make that much of a

    difference. Login orregisterto post comments

    By mieczotronix@ Sun, 2008-12-07 20:20

    but these IR sensors are not good

    these IR sensors are no good for linear range measurements as they output binary signal (logical1s and 0s), rather than analog, continuously voltages.

    Login orregisterto post comments

    By mintvelt @ Sun, 2008-12-07 20:50

    I know

    I'm not trying to get a range measurement from the sensor. I'm trying to get it to pick up a signalreflecting of an object in front of it. Like when you aim your remote control at the ground; the IR

    http://letsmakerobots.com/node/2899http://letsmakerobots.com/node/2899http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1223http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/2065http://letsmakerobots.com/user/2065http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1223http://letsmakerobots.com/user/1223http://letsmakerobots.com/user/1223http://letsmakerobots.com/user/610http://letsmakerobots.com/node/2899http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1223http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/2065http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1223
  • 8/9/2019 Our Own Ir Sensor

    22/23

    signal is reflected on the floor and still picked up by the TV. If you can get the same sensitivitybut with focussed IR beam and sensor you could make a nice obstacle detector or even a rangefinder like the laser rangefinder from Oddbot.

    Login orregisterto post comments

    By OddBot @ Sun, 2008-12-07 21:14

    LED intensity

    In a IR remote, the LED can have 200mA pulsed through it for a short duration,Captain Tunahad a forum on the subject. Mintvelt's idea of using the sensor is a good one. If you use thepwmout command to generate a 38KHz pulse to the LED via a transistor then because internalcircuitry is automatically generating the pulse you can monitor the input. This should have good

    range especially if you get a high powered LED like Captain Tuna was using which isspecifically designed for high powered pulses.

    My initial design was only intended for short range but I think this is a great idea, you mayactually have too much range as I find with white walls I can bounce a remote signal off of thewall behind me and still turn on a device in front of me. At least that can be adjusted by reducingthe power to the LED :)

    Login orregisterto post comments

    By mintvelt @ Sun, 2008-12-07 22:08

    It works!

    I used a potmeter / variable resistor set to about 80 Ohms. I didn't think of using PWM, but Iused IROUT which pulses the LED as well. As soon as the receiver starts signalling and pulls theinput low, the IROUT gets interrupted. No transistor between the output of the picaxe and theLED so I guess the LED will only get 25mA. Using a rolled up piece of plastic to shield the sidesof the led, I got a range of about 30cm. That was on a breadboard with the LED and the sensormore or less bend in the same direction.

    Removing the resistor alltogether (Bad! shouldn't do that! against all the rules) I figured both thepicaxe and the LED would surive and they did. I got it op to 40cm.

    I've also looked up the specs for the LEDs they use to provide IR lighting for security CAMs.Some of those LEDs are rated 100mA continuously and 500mA pulsed. Wow!

    Haven't figured out where to get those LEDs.

    Login orregisterto post comments

    By OddBot @ Sun, 2008-12-07 23:04

    http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1533http://letsmakerobots.com/node/2899http://letsmakerobots.com/node/2899http://letsmakerobots.com/node/2899http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1223http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1533http://letsmakerobots.com/user/1223http://letsmakerobots.com/user/1533http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1533http://letsmakerobots.com/node/2899http://letsmakerobots.com/node/2899http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1223http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1533
  • 8/9/2019 Our Own Ir Sensor

    23/23

    Great stuff Minvelt !

    The way your going you shoulb be able to get at least 2-3 meters. If you can find an old remotecontrol, get the LED out of it, should handle at least 250mA pulsed. If you reduce the dutycycleto about 10% you should be able to get 500mA plus but without a data sheet I can't makepromises.

    Careful not to overheat the LED while desoldering!

    Use two or more LEDs to increase the range.

    Login orregisterto post comments

    v

    http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-formhttp://letsmakerobots.com/user/1533http://letsmakerobots.com/thickbox_login?height=220&width=250&destination=node/2907%23comment-formhttp://letsmakerobots.com/user/register?destination=node/2907%23comment-form