Trying to get IR sensors to work on sumo bot
Hello everybody....
I have a rather basic newbie question:
I'm trying to get IR sensors working on a sumobot (a few days old...) and am having serious difficulty with range. Not sure what to try next, so I thought I'd ask for suggestions.
I have two standard setup IR emitters/detectors at the front, running simple code and with two LEDs hooked up on the breadboard to give a "detect" indication for each of the sensors.
Everything kind of works, except that the range is limited to about 5 to 10 cm. No matter what I try, I can't detect anything further out than that. Any ideas? Has anybody run into this before?
Many thanks in advance for any suggestions
Regards
Duncan
I have a rather basic newbie question:
I'm trying to get IR sensors working on a sumobot (a few days old...) and am having serious difficulty with range. Not sure what to try next, so I thought I'd ask for suggestions.
I have two standard setup IR emitters/detectors at the front, running simple code and with two LEDs hooked up on the breadboard to give a "detect" indication for each of the sensors.
Everything kind of works, except that the range is limited to about 5 to 10 cm. No matter what I try, I can't detect anything further out than that. Any ideas? Has anybody run into this before?
Many thanks in advance for any suggestions
Regards
Duncan
Comments
thanks - I'll go and find the tutorial and see if I can work something out.
In the meantime, I've been experimenting with a few setups...
The LED is actually driven via a 220 ohm SM resistor on the board, but I've been using the breadboard to try out a few alternate configurations. I tried going lower than 220, and then tried driving indirectly using an NPN transistor with a 1k base resistor and various combinations of current limiting resistors (including none).
In the brightest setup, I get intermittent reflections off extraneous objects a long distance away, but I don't get much reflection from a target object (such as another sumobot...). I guess this is going to require a lot of tinkering to get right.
Regards
Duncan
When you say "the brightest setup" it makes me just wonder if you are possibly using visible-light red LEDS or the IR LEDs, not likely but I had to ask!
Are you using the SumoBot Competition Kit?· If not, you might want to check out "Applied Robotics with the SumoBot" Chapter 3 on sensor management, which covers testing and tuning the IR detectors.· You can download it here:
http://www.parallax.com/detail.asp?product_id=27403
Try tuning your detectors against white paper or a wall first.·Since the resistor values are fixed when using the front sockets, tuning means·pulsing the IR LED at different frequencies - adjusting the FREQOUT command's freq1 argument -·until you find the frequency at which the IR receiver is most sensitive.· If you are also using a second set on the sides, you can tune the circuits by adjusting both the IRLED frequency and the resistor value.·
Even when you know you have the IR detection working well in the range you want with white paper, the SumoBots will still be hard to see - they are designed that way, and·that is part of what makes the matches challenging and unpredictable.
(IR Remote for the Boe-Bot is a different topic - it details how to use a BS2 and IR reciever on a Boe-Bot·to decode a universal remote with Sony protocol, so you can remotely drive the Boe-Bot via the keypad or switch program modes.· Just for fun, you can set up a SumoBot this way, and try to manually beat a SumoBot with autonomous programming.)
Let us know how it goes,
-Stephanie Lindsay
Editor, Parallax Inc.
thanks for the follow up.
Just to be clear, yes, I'm using IR LEDs. I wasn't intending to imply that I could actually see the output when I referred to "brightness", I'm just inferring the brightness from the power I'm dumping into it using various setups [noparse];)[/noparse]
And yes, I am using the Sumo competition kit. I did try doing a frequency tuning using a short program I wrote for the purpose. I'm posting from work right now so I don't have the code to hand, but I'll clean it up and post it this evening. Basically what it does is run a test using a single detector for a few seconds at a time, stepping through a sequence of frequencies. One LED is driven to indicate detection, and the other flashes briefly to indicate each stepping point. I can then use a white index card as a target and find the range limit at each step. It works ok, but needs a little refinement...
As I said, I'll post later when I'm back at home
Regards
Duncan
The "high power" setup is driving the LED via a transistor hanging off the port, whereas the "normal configuration" is just plugged into the socket at the front. Doesn't seem to make much difference.
Looking at the waveforms on an oscilloscope, I'm thinking that at 38kHz or so, the capabilities of the "FREQOUT" routine are being exceeded, and that may be an important factor here (I'm pretty sure it explains the shape of the graph). As a result, I was contemplating using a 555 timer to generate the 38kHz signal instead.
Before I do that, though, I wanted to know if what I'm seeing is actually typical or is there something wrong with my setup? Maximum detection range I've seen for a 4x6 white index card is about 23cm.
Many thanks in advance for any suggestions...
Regards
Duncan
I didn't have a 555 lying around, but I did have a 741 which I used to build a relaxation oscillator at around 38kHz (with a trimpot for tuning). After a tune up, I can now detect with that setup a 4x6 index card at ~30cm. Another sumobot at maybe ~20cm or so, heavily dependent on which way it's facing. It looks like there's definitely some mileage in using an external oscillator
Regards
Duncan
Sorry for the recent silence on your thread -··Andy Lindsay is really the best person to go into this·depth on the subject.· He is away teaching a Parallax Educators course for a couple days, but I will give him a heads-up when·he returns.
Typically you can get reliable distance detection of a white wall with the typical setup with a max range of about 30-45 cm, less if you are trying to spot a SumoBot.
If you want to try an alternative setup, you might read this thread from the Stamps in Class Mini-Projects sticky.· It might not increase your range but it will improve resolution, and it might give some insight for alternative designs:
http://forums.parallax.com/showthread.php?p=561496
-Stephanie Lindsay
Editor, Parallax Inc.
thanks for the info - that helps. With the standard setup, I can detect a mirror from over half a meter away, and a white 4x6 index card from max 23cm. That may well translate into detecting a white wall at 35cm or so (I don't happen to have such an item available ).
I just bought a couple of 556 dual timers which I'm planning to use to generate cleaner squarewaves to see if I can extend the range a bit more. I'll also look at the power modulation as explained in the article you referenced. Right now, though, the main issue seems to be increasing detection range, so I'll stick to working on that first
Regards
Duncan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andy Lindsay
Education Department
Parallax, Inc.
thanks for the suggestions. I had realized that I needed to only power one LED at a time, but the method of using the digital outputs on each of the cathodes and making the anodes common hadn't occurred to me. That works really well.
Anyway, another hour or so of tinkering...
I got the 555 oscillator working, and managed to get another 50% range just about. I also had lots of issues with spurious triggering, which I found to be due to EM coupling from the oscillator circuit itself. It turns out to be important to use a decoupling capacitor across the supply. I guess that since I'm generating a full depth square wave I should have expected that.
One more thing I found useful is to make the detection stateful, since at the edge of range detection is intermittent. I'm observing it with an LED to indicate the output. This is what I used to test it, and it seems to make a substantial difference:
(this is just testing one sensor, with the LED powered continuously)