Shop OBEX P1 Docs P2 Docs Learn Events
Different ranges with IR... — Parallax Forums

Different ranges with IR...

JiVeeMaNJiVeeMaN Posts: 7
edited 2007-05-31 01:40 in BASIC Stamp
Hello, I'm totally new to this so excuse my incompetence [noparse]:)[/noparse]

I'm trying to learn this with robotics and I'm currently experimenting with IR range detection.
I've got two problems:

1. The range of my IR emitting diods is extremly unequal. One of the diods (I've got two) is emitting IR at a range of approx. 10 CM longer than the other one. This is pretty anoying because my boe-bot keeps turning left all the time (because the right sensor never detects anything, it's too far away)

2. What I understand by the book that comes along is that I should be able to adjust the range at which the detector detects IR by adjusting the frequency... I tried to emit IR with a frequency of 41000 Hz and compared it to 38500 Hz and the difference in detection was like 5 or ten centimeters...
Should it be like this, or is anything wrong?

Answers are very appreciated!

Thanks in advance,

Fredric

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-05-30 22:20
    1) This is not normal if the diodes are the same model and the series resistors (and associated circuitry) are the same and the program for each is essentially the same. Also make sure that there's nothing blocking the light from the LED (or the IR detector).

    2) If you look at the datasheet for the IR detector (downloadable from Parallax's webstore page for the detector), you'll see that the sensitivity of the detector varies based on frequency and there's a graph of this in the datasheet. The center frequency is 38KHz for the devices that Parallax sells and that's their point of maximum sensitivity.
  • JiVeeMaNJiVeeMaN Posts: 7
    edited 2007-05-30 22:34
    1. They are exactly the same models. They are the ones that came along with my kit. Both my program and the resistors connected to the LED are exactly the same. I can mention too that they're on long range flickering between value 1 and 0. Maybe it should be like that, but it's worth mentioning.

    What could possibly be blocking the LEDs? I've checked that now and nothing was in the way.

    2. Sorry if you didn't understand the question, my english is not that good. But I was trying to say that I know about the range differense on different frequencies, but the problem is that there are almost no differense in detection between what should be 5 CM detection and what should be 40...

    /Fredric
  • Mike GreenMike Green Posts: 23,101
    edited 2007-05-30 22:49
    If all is the same between the two IR emitters / detectors, than the range should be pretty close (10cm is too far). It is theoretically possible for the emitter or detector to be defective, but it's very unlikely. It's much more likely that there is something different between the two pairs of devices and the associated circuitry.

    If the LEDs are very "bright", the IR detector may require a wider range of frequencies to see a significant difference. I'm using a Propeller as the controller and that has helped (from 38KHz to 43KHz for the range).
  • JiVeeMaNJiVeeMaN Posts: 7
    edited 2007-05-30 23:01
    One thing I've noticed about them is that it looks like they oppose each other. Because when one of them is detected and I move an obstacle in the range of the other one too, the other obstacle sometimes need to be like 10 cm away to be detected.

    Well, the problem is that I've tried up to 50000 Hz, and there I'm starting to see any difference (10- 20 cm). But the funny thing is that i also tried 4000 Hz, and that was also detected on 10 cm range, even thought it's a very low value.

    When an obstacle comes too close to the led (four centimeters) it gives no response att all, while the other one does... This is so strange, nothing seem to be comprehensable..
    Now when I try them again, one of them is maybe detecting obstacle at 30 CM range but maybe not on 25 CM, and maybe at 20 CM. I don't understand this...

    Post Edited (JiVeeMaN) : 5/30/2007 11:16:43 PM GMT
  • edited 2007-05-30 23:13
    Fredric,

    Almost every time I have seen this problem, there has been an error in either the circuit or code. However, I did see this happen with one of the Boe-Bot robots at a BASIC Stamp Educators Course last week and verified that both the circuit and code were correct.

    Please let me know whether you are using a Boe-Bot, SumoBot, or Scribbler robot, and I will attach some test code for you to try.

    If it turns out that your code and circuit are correct and you have a Boe-Bot robot, I would recommend using a larger resistor in series with the IR LED that sees too far.

    For example, if the Boe-Bot robot's right IR LED sees an object 20 cm away, while the left sees an object 40 cm away, try doubling the resistance between the I/O pin and the left IR LED. This will make the left infrared "flashlight" dimmer, and the detector will not detect objects so far out. 15 to 20 cm is a good detection distance. Any more than that, and it's hard to tell why the Boe-Bot turns when it's avoiding objects.

    Regards, Andy

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andy Lindsay

    Education Department
    Parallax, Inc.
  • JiVeeMaNJiVeeMaN Posts: 7
    edited 2007-05-30 23:20
    I'm using a Boe-Bot and I've checked the circuit twice and it seems to be correct. Do you want me to send a photo of it?

    I'm attaching my program code to this post.

    But what i also don't understand is that it works when I'm trying a frequency like 3000 or 4000. It shouldn't ? but it works.
  • edited 2007-05-30 23:21
    I see now that you are using a Boe-Bot robot.· Make sure you are using the schematic + wiring diagram on pages·238-239 of Robotics with the Boe-Bot v2.2.

    The test code is attached.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andy Lindsay

    Education Department
    Parallax, Inc.
  • JiVeeMaNJiVeeMaN Posts: 7
    edited 2007-05-30 23:28
    The only difference between the wiring on that page and my wiring is that i've got two red LEDs emitting light every time an obstacle is detected. They are connected in the same way on both sides and with the same resistor (220 ohm)
  • edited 2007-05-30 23:30
    Oh, sorry, yeah, like page 243.

    Does TestIrPairsAndIndicators.bs2 still give you the discrepancy in distance measurements?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andy Lindsay

    Education Department
    Parallax, Inc.
  • JiVeeMaNJiVeeMaN Posts: 7
    edited 2007-05-30 23:36
    Yes it does. On some objects (probably more reflecting) one of the detectors detects the object at a distance of one meter. While the other one detects it on 60 CM. It really is very strange... I still don't understand why it works down on 4000 hz, should it work there?

    Regards,

    Fredric
  • edited 2007-05-30 23:42
    Yeah, the 4 kHz is a little weird, and so is the fact that your IR detectors are seeing objects that are so far away. You are using the clear LEDs inside the little black tubes, right?

    Also, check the resistor color codes. The resistor that connects P8 to the left IR LED anode should be 1 k (brown-black-red). The same resistor value (brown-black-red = 1 k) should be in series between P2 and the right IR LED anode.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andy Lindsay

    Education Department
    Parallax, Inc.
  • JiVeeMaNJiVeeMaN Posts: 7
    edited 2007-05-31 00:01
    Why they can see things on such long distance was because i tried a 220 ohm resistor for them also so that the difference between the detectors would be visually larger (not propotionally). I'm using the clear tubes and now a 1k resistor for each LED and they are quite synchronized when i have 4.5 kHz in difference between them. I think that will work, but it's anoying that they're not fuctioning proper.

    Now when they are pretty synchronized and i'm using them to navigate, I've got another problem. When it runs into a 90 degree corner of a wall it starts turning in one direction, but as fast as it turns enough for the other sensor to also "see" the wall, it cannot decide which way to turn so it keeps turning in different directions like crazy! What shell i do?

    / By the way, thank you for all help Andy and Mike, it's really appreciated!

    Post Edited (JiVeeMaN) : 5/31/2007 12:18:28 AM GMT
  • edited 2007-05-31 00:17
    Yeah, I'd like to send you some replacement parts to test. Please contact me directly using the email button to the left of my posts.

    Corners and mazes are pretty doable. I would recommend trying out the various code examples in Robotics with the Boe-Bot (through chapter 8) first.

    Also, here is a link to a better circuit for distance detection, and it should also work better for maze navigation: Better Boe-Bot IR Distance Measurements (Circuit + Programs).

    This is one of the articles in the Stamps in Class "Mini Projects" thread on the Stamps in Class forum.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andy Lindsay

    Education Department
    Parallax, Inc.

    Post Edited (Andy Lindsay (Parallax)) : 5/31/2007 12:22:11 AM GMT
  • edited 2007-05-31 01:40
    BTW, some tests to isolate the culprit:

    1) Note which side has the longer range.

    2) Swap IR LEDs. Does the same side still have the longer range?

    3) Swap IR detectors. Does the same side still have the longer range?

    4) Swap series resistors. After what we've gone covered earlier, this shouldn't have any effect. It's still better to make sure.

    If the side switched with item 2, one of the IR LEDs is too bright (or maybe the other is too dim). If it switched with item 3, one of the receivers is too sensitive (or the other is not sensitive enough). If it switched with item 4, check the resistors with an ohmmeter and compare the results to the markings. If the side with the long range never switched, one of the BASIC Stamp I/O pins might have a damaged buffer.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andy Lindsay

    Education Department
    Parallax, Inc.
Sign In or Register to comment.