Author Topic: Need help w/ prog. for IR transistor circuit  (Read 3737 times)

0 Members and 1 Guest are viewing this topic.

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Need help w/ prog. for IR transistor circuit
« on: June 26, 2008, 02:31:26 PM »
Hello, I'm currently trying to make a object detecting circuit using IR emitter and IR transistor.  I need help on what the program needs to be like in order to emit a frequency and then have the receiver take a reading.  I'm programming in basic BasicMicro IDE. 02.2.1.1  Any help would be greatly appreciated.

See attachment of schematics

Bane
« Last Edit: June 26, 2008, 02:36:06 PM by BANE »

Offline bens

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 332
  • Helpful? 3
Re: Need help w/ prog. for IR transistor circuit
« Reply #1 on: June 26, 2008, 02:36:06 PM »
If you're using a phototransistor, your detector circuit is missing a current-limiting resistor...

Offline hazzer123

  • Supreme Robot
  • *****
  • Posts: 460
  • Helpful? 3
Re: Need help w/ prog. for IR transistor circuit
« Reply #2 on: June 26, 2008, 02:37:50 PM »
So i guess what you mean by emit a frequency is use a modulated signal. As far as i know this is just taking a measurement of the IR levels, then turning the IR LED on and taking another measurement of the IR levels.

The bigger the difference between the readings, the closer/shinier/bigger the detected object.

I would create a function, called getIRMeasurement(), and it would return a value which is related to how close/shiny/big the object is.
Imperial College Robotics Society
www.icrobotics.co.uk

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: Need help w/ prog. for IR transistor circuit
« Reply #3 on: June 26, 2008, 02:40:03 PM »
Quote
If you're using a phototransistor, your detector circuit is missing a current-limiting resistor...
They use this circult on SumoBots from Parallex, and they don't use a limiting resistor.... ???  May be they don't use them.

Any idea about the program?

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: Need help w/ prog. for IR transistor circuit
« Reply #4 on: June 26, 2008, 02:44:05 PM »
Quote
I would create a function, called getIRMeasurement(), and it would return a value which is related to how close/shiny/big the object is.
Yes thats what i'll do once i can emit the frequency and receive at the same time :P.

Here an idea, (maybe this how you'd have it set up) have the IR leds always emitting a frequency instead of controlling when its emited.

bane

Offline bens

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 332
  • Helpful? 3
Re: Need help w/ prog. for IR transistor circuit
« Reply #5 on: June 26, 2008, 03:05:22 PM »
They use this circult on SumoBots from Parallex, and they don't use a limiting resistor.... ???  May be they don't use them.

So maybe they're using a photoresistor instead of a phototransistor, or maybe they're using a more complicated integrated detector like this, which is a phototransistor with an integrated 30k resistor and other electronics.  If you are just using a phototransistor you need a current-limiting resistor or else you are creating a short between power and ground.  Where did your schematics come from and are you using the same detector as is in the schematic?

- Ben
« Last Edit: June 26, 2008, 03:06:13 PM by bens »


Offline bens

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 332
  • Helpful? 3
Re: Need help w/ prog. for IR transistor circuit
« Reply #7 on: June 26, 2008, 03:54:28 PM »
Taking a quick look at the datasheet shows that your detector is a phototransistor with an internal 20k pull-up, so you'll never have a short between power and ground.

- Ben

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: Need help w/ prog. for IR transistor circuit
« Reply #8 on: June 26, 2008, 04:07:09 PM »
Thats nice :)  here is the program that they use.
Code: [Select]
' Program Listing 1.1 - Testing the IR Beam.bs2

IR_detect  var  bit
low 7

loop:

  pause 50
  freqout 7, 1, 38500
  IR_detect = in8
  if IR_detect = 0 then unbroken

    ' Make sure to add six spaces to the debug statement
    ' below.  That way both debug statements will have the
    ' same number of spaces for a better display.

    debug home, "Beam is broken; object detected.      "
    goto loop

  unbroken:
    debug home, "Beam is unbroken; object not detected."
    goto loop

the part that gets me in this program is that they only define one pin they use.  I need one pin for the output frequency and one for the receiver signal.

bane

Offline bens

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 332
  • Helpful? 3
Re: Need help w/ prog. for IR transistor circuit
« Reply #9 on: June 26, 2008, 04:22:37 PM »
It looks like they're ouputting a frequency on pin 7 to drive the LED and taking the detector input on pin 8...

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: Need help w/ prog. for IR transistor circuit
« Reply #10 on: June 26, 2008, 04:34:05 PM »
you mean the "in8" part?

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: Need help w/ prog. for IR transistor circuit
« Reply #11 on: June 26, 2008, 05:24:33 PM »
You know what, i think i'm going throw away the phototransistors that i have and just buy two pairs of simple emitters and detectors.
Has anyone tried these out?
http://www.radioshack.com/product/index.jsp?productId=2049723&cp=&sr=1&origkw=infrared&kw=infrared&parentPage=search

then i could use the schematics fromhttp://www.societyofrobots.com/schematics_infraredemitdet.shtml

Bane
« Last Edit: June 26, 2008, 05:27:43 PM by BANE »

Offline bens

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 332
  • Helpful? 3
Re: Need help w/ prog. for IR transistor circuit
« Reply #12 on: June 27, 2008, 12:11:27 AM »
You could also consider using a prebuilt IR emitter-detector solution:

http://www.pololu.com/catalog/product/958
http://www.pololu.com/catalog/product/959



It's got all of the extra components you need in a compact package, optimized for performance.  All you need to do is connect power (5 V capable of delivering 25 mA), which can typically be supplied by a digital output if you want to control when the sensor is on, or you can just directly connect it to your power bus.  The OUT pin is the sensor output, which will be an analog measure of IR reflectance.  The QTR-1A outputs an analog voltage as a function of reflectance, so you would need an ADC to read it.  The QTR-1RC outputs a pulse whose length is a function of reflectance (usually between 0.1 and 1 ms), so you can use a standard digital I/O line to read it.

- Ben

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: Need help w/ prog. for IR transistor circuit
« Reply #13 on: June 27, 2008, 06:30:21 AM »
Quote
Maximum recommended sensing distance: 0.375" (9.5 mm)

I kind of need something that has the maxmium distance of 10 in. through, but thanks becuse I might use something that cheap and small for sensing when the biped has had contract with the ground.
 :)
Bane

Offline bens

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 332
  • Helpful? 3
Re: Need help w/ prog. for IR transistor circuit
« Reply #14 on: June 27, 2008, 12:17:15 PM »
I don't think the sensors you linked from Radio Shack are going to detect reflections from 10" away any better than the QTR sensors.  We have been able to use the  QTR-1RC version to detect something up to around 8" away, but this was only when there was very little ambient IR hitting the receiver.  The maximum recommended sensing distance listed on the sensor's web page is for getting a good analog measure of white and black surfaces (e.g. the maximum height you would want to mount it for a line following application).  If you just want to know if a wall is in front of you, you can use it for much greater distances so long as:

1) the wall is sufficiently reflective.  If it is a black wall, you won't see it well at all.
2) there is very low ambient IR.  Ambient IR will cause your weakly reflected IR to be lost in the noise (just like it's much harder to see a candle flame several blocks away on a sunny day than it is to see that same candle on a dark, moonless night).  For example, you wouldn't be able to see something 8" away with a QTR sensor in a room with a lot of sunlight streaming in through the window.

If you really want to see farther, you'll need a brighter IR source so that your detector has a better signal to see.  You could achieve this by running more current through the LED, but this will cause the LED to burn out faster, or you could perhaps find a matched LED that can handle more current.  Or you could consider getting a Sharp IR sensor (note that this stops working for objects that are within a minumum distance of the sensor) or a sonar sensor (this has pretty much no dead zone, but it can also see a lot farther than 10" so it might be overkill for your application).

- Ben

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: Need help w/ prog. for IR transistor circuit
« Reply #15 on: June 27, 2008, 12:45:25 PM »
I already have a Sharp IR sensor in the center of the biped.  What i need is two more small sensors on the sides for spot checks.
I do have a pair of QTI that i had got form parallax http://www.parallax.com/Store/Microcontrollers/BASICStampModules/tabid/134/txtSearch/qti/List/1/ProductID/100/Default.aspx?SortField=ProductName%2cProductName

but the sensing range kind of sux :P

Bane

Offline bens

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 332
  • Helpful? 3
Re: Need help w/ prog. for IR transistor circuit
« Reply #16 on: June 27, 2008, 12:59:44 PM »
The QTR-1RC sensors are the same interface as the Parallax QTIs.  The only noticeable differences are that the QTR sensors are much smaller than the QTis, they have the three pins arranged in a different order, and they draw more current in order to make the IR LED brighter, so the QTRs would conceivably be able to see a little farther than the QTIs.  Additionally, the QTRs are also almost half the price of the QTIs.

- Ben

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,659
  • Helpful? 169
    • Society of Robots
Re: Need help w/ prog. for IR transistor circuit
« Reply #17 on: July 04, 2008, 11:17:54 AM »
I think you are using the wrong technology . . . for those requirements, you'd be better with sonar or a sharp IR.

 


Get Your Ad Here