Shop OBEX P1 Docs P2 Docs Learn Events
Sending Signals for bot-to-bot talk — Parallax Forums

Sending Signals for bot-to-bot talk

morris4019morris4019 Posts: 145
edited 2009-05-17 01:32 in Robotics
I have just finished my boe-bot-esque project, pretty much the same thing. Anyway, I have it using IR navigation and it strolls about just fine. I am having a tough time figuring out how to create a stationary beacon that will transmit a certain signal that can be picked up by my bot. The whole point is to have my bot stroll around until it senses the signal, then head toward it. Is there a way to modulate a standard IR Detector (like the ones sold as pairs at radio shack) so that it knows the difference between one signal and another?

Up to this point i have used IR as navigation, bouncing back IR light at a 38Hz detector. I understand that as the signal gets higher or lower, on this detector, than 38Hz the range drops off. I guess what i'm wondering is how to send signals back and forth, or how to tell the difference between signals.

Any help would be great. Thanks
-Mike

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
======

······ I'll try everything once [noparse]:)[/noparse]
640 x 480 - 57K
640 x 480 - 57K

Comments

  • ZootZoot Posts: 2,227
    edited 2009-05-11 02:16
    Yes. Check out the text www.parallax.com/Portals/0/Downloads/docs/prod/sic/WebIR-%20v1.1.pdf about sending/receiving IR codes for the Boe-bot.

    You can build a small beacon that broadcasts a given "number", say %0101. If your bot "reads" that number in the IR transmission, it sees the beacon.

    But then there's a few tricky things to think about --

    - direction? Which way is the beacon. An easy way to handle that is to build a long vane or tube around the detector(s) so that they have a limited angle of view. I've done some 'bots using two detectors for beacon identification with a long vane between the two. It is pretty much impossible for *both* detectors to read the number unless the bot is aimed dead on at the beacon. If it's turned to one side or the other, only one detector can pick up the number

    - using the same detectors for obstacle avoidance. Can be done, but again, it gets tricky. Basically you want to check for IR reception BEFORE activating your IR leds for detection -- that way you know if what you are receiving is spurious (from the beacon) or from yourself. One way to handle the problem (you can't "listen" and "see" at the same time) is to have the 'bot stop if it picks up spurious IR and either head towards the beacon or turn around 180 so you can use the IR detectors for obstacles. Another way is to have separate detectors, but you still need to have the obstacle detectors check for IR reception before checking the 'bots own LED reflections (i.e., you wait for the detector to be high -- if it's low, then it's picking up IR from somewhere else -- then freqout the LED, then check the detector for a "hit").

    Some folks make beacons that just pulse on and off -- this is fine but your 'bot will may also pick up more spurious signals (remotes, other 'bots, etc). Plus with actual numeric RX/TX you can send useful messages back and forth beyond simple beacon ID. In my own projects, I use SXes to handle continuous RX/TX of messages between 'bots and beacons since they are much cheaper than Stamps.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • Mike GreenMike Green Posts: 23,101
    edited 2009-05-11 02:28
    You can't change the center frequency (tuning) of the IR detector used by the BoeBot (or any remote control detector). You can buy different models designed for different frequencies, but the tuning isn't sharp and there will be some crossover. You could design your own detector for a very different frequency. What might work better is a scheme where you use ultrasound (like a PING) for obstacle detection and distance ranging and IR for locating beacons. The beacons would use modulated 38KHz signals with some kind of identification code modulating the IR 38KHz carrier. If you do this with a cheap microcontroller like a PIC or AVR, it could put out a short burst of codes, then turn off for a random interval on the order of a half a second. That way another beacon might be seen if they're both in a similar direction from the BoeBot.
  • morris4019morris4019 Posts: 145
    edited 2009-05-12 19:42
    I downloaded a copy of the IR Remote for the BOE-Bot, and am going through it now. The problem i see now is that I will need to operate at a different frequency than the object detectors, no matter what. Because even when sending a information inside a 38hz carrier the bot will see it as an object. I have been looking around and cannot seem to find where everyone is getting Modulated IR detectors in anything but 38-40 hz. anyone know online where i can obtain any other frequencies? Also, i have been toying around with creating a small beacon, like was said, that basically turns off and on. Is there a way to create modulation, without a microcontroller to a simple non-modulated IR Detector? With this I could maybe use a pot on both sides (IR Detector and emmitter of beacon) to tune them to each other. This should eliminate the problem with the object detectors on the bot thinking that there is always an object in front of it when the beacon is straight ahead.

    -Mike

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ======

    ······ I'll try everything once [noparse]:)[/noparse]
  • ZootZoot Posts: 2,227
    edited 2009-05-12 20:49
    You have to have modulated IR of some kind (independently of whether or not the IR modulation is "pulsed" for things like "on/off bits"), otherwise you'll have interference from everything that generates IR -- sunlight, electric light, all kinds of stuff.
    said...
    This should eliminate the problem with the object detectors on the bot thinking that there is always an object in front of it when the beacon is straight ahead.

    But that's only true if the 'bot fails to check for IR reception before doing obstacle avoidance. Then it's a question of a bit of timing and communication, for example:

    
    check for IR detection
    ir?
      no, check obstacle
      yes,
           check for start bit on (e.g.) 4 bit "message"
           start bit?
               no, check obstacle
               yes,
                    get message
    ' now if you use 3ms start + 3 bit message, the longest TX time would be about 12ms
    ' so even if all that is yes, you still have time before the next servo pulse, or
    ' to check for an obstacle
    ' secondly, presume that the 'bot and the beacon both "rest" between message txes
    ' at least 50ms or so -- this gives plenty of quiet time
    
    check for obstacle, 1 ms IR emitter pulse
        obstacle?
            yes, check once or twice more to be sure (loop)
            no, back to beginning
    
    ' now lets say once your bot "acquires" the beacon, you can have it SEND a 
    ' message telling the beacon it's "listening" and the beacon could space out
    ' it's TXes more -- basically the 'bot can wait for the last bit of the last message
    ' and then "know" that it has 20 or 50 or 100ms of time to check obstacles, etc
    
    



    Yes, it works, and I use something very similar, but I let a peripheral micro handle all the IR work so it's stable and easy (the host Stamp can just grab a byte that represents that last valid message received, and the sender's ID). My particular implementation actually has all the addressed 'bots/beacons/etc on a "rolling" TX rest -- each one has a different rest length, so within the space of 2 or 3 seconds, even if *all* the 'bots are TXing at once, the messages come through. I used a 12 bit message + 1 start bit, where the first (MSBFIRST) 4 bits of the message are the sender's ID, the next 4 bits are the intended recipient's ID, and the last (LSB) 4 bits are the message itself. So a 'bot searching for "home" actually sends out a message to that beacon ID asking the beacon to "turn on". The beacon then sends a continous message to the 'bot with it's own ID -- this is what the 'bot homes in on. Once it's connected to the charger, it sends a final message to the beacon telling it to shut the heck up.

    However, if you want to use IR for obstacle detection and IR for RX/TX as separate units, you might want to think about using an analog IR ranger (like the Sharps) for obstacle detection and use the IR emitter/detector pair for the beacon and what not. They don't interfere with each other, especially if the ranger is aimed for floor/wall and the emitter detector are pointed out and up. Certainly on the beacon side you could just use a 556 timer set up to send out 1ms (or so) 38500hz bursts on a LED and not need a micro. Again, if you have the 1ms pulse come every 50ms, the 'bot can check for any IR detector right before pulsing it's own emitter. Even better is if it *does* see the beacon, because your program can presume at least 50ms of "dead air" immediately *following* the last pulse received.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php


    Post Edited (Zoot) : 5/12/2009 8:54:22 PM GMT
  • morris4019morris4019 Posts: 145
    edited 2009-05-12 21:45
    Ok, that makes sense now, thanks for the breakdown. Now i was reading up on the SX's, because i've never used them before. More specifically, the SX28AC/DP-G. Am i right in assuming that, when it says the in-ic ee/flash memory that I can actually use the dev board (for the sx) and the key to program it, then take the chip off and socket it somewhere else and the programming would stay on the chip itself? And how comperable to the stamp is it, because for that cheap I think i would stray to use the SX's over the stamp.

    -Mike

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ======

    ······ I'll try everything once [noparse]:)[/noparse]
  • Mike GreenMike Green Posts: 23,101
    edited 2009-05-12 22:43
    Often what you describe is what is done. The SX (or other chip) is programmed on a development board and moved to another board for testing and operation. The program is recorded in the chip's flash memory and stays with the chip. The major disadvantage of this scheme is that you occasionally break a chip physically moving it from one socket to another. It helps to have a zero- or low-insertion force socket on both boards.

    The SX is used to make the Stamps except for the BS1 and BS2 which use PICs. It's not as easy to program the SX (or PICs) as it is to use PBasic. The Basic compiler for the SX helps a lot, but there's still a lot of detail about the SX that you have to know and use, even in Basic.
  • morris4019morris4019 Posts: 145
    edited 2009-05-13 01:26
    Scavenging an old mouse for IR emitters and detectors and am having some difficulty figuring out the pinout of the detector for my beacon. This detector has 4 pins not 3, I've searched google for pinouts and diagrams and such and can't seem to find what i am looking for. There is no number or marks on it so it's hard to say what kind it is.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ======

    ······ I'll try everything once [noparse]:)[/noparse]
  • ZootZoot Posts: 2,227
    edited 2009-05-13 20:46
    Post a picture if you can.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • morris4019morris4019 Posts: 145
    edited 2009-05-15 03:54
    I've tried with many different cameras and it's just too small (about 1/8"x1/8")·It always ends up really blurry and you can't even tell what it is. I've drawn a picture·(in paint) below.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ======

    ······ I'll try everything once [noparse]:)[/noparse]
    562 x 436 - 14K
  • ZootZoot Posts: 2,227
    edited 2009-05-16 01:28
    It's probably an IR emitter and phototransistor in one package. Two leads are prob. anode/cathode of the IR led, the other two are emitter and collector of the transistor (the "base" is the IR light received). It may not be modulated detection, btw.

    You can probably figure out what leads are what by hooking two 1k or so resistors to gnd and +5v and apply them the leads (there would be 16 possible combination). One of those should dimly light the IR led (use a video camera with nightshot to see it, or many digital still cameras). The the other two leads are the transistor.

    Obviously I'm just guessing -- there are some combined packages that feature a modulator for the IR led and then 4 leads could be +5v, GND, enable (for the emitter modulator) and signal out for the detector smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • morris4019morris4019 Posts: 145
    edited 2009-05-16 02:16
    Well i was kind of thinking that and actually I have already tried applying power and grnd through it in all the combonations. I am guessing too, but when i took out the component it was paired WITH an IR Emitter. It was the same shape, smokey-clear, with only 2 leads. I already confirmed it is an emitter that is why i figured that the other was the detector, but just have never used one with 4 leads...

    I also checked to see if all the leads where actually hooked up on the circuit board, and they are, all to different wires actually. Weird. The only reason i wanted to use them was because i am planning out my next project still and it will be very small, these emitter/detectors would be perfect because they are also very very small.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ======

    ······ I'll try everything once [noparse]:)[/noparse]
  • UghaUgha Posts: 543
    edited 2009-05-16 02:49
    You've got to remember that a mouse doesn't use a single IR signal to monitor the movement of a wheel. It uses two IR signals to calculate the direction of
    wheel movement... IE: If detector 1 sees the signal before detector 2, it's moving left.
    This is called quadrature encoding.

    The detector you've got there is most likely a set of two detectors combined together.
    From what I can remember, one lead is supply, one is ground and one is for each detector.

    I'm sure you can google the info fairly easily if you search for something like: ir encoder mouse
  • morris4019morris4019 Posts: 145
    edited 2009-05-17 01:32
    ok that does make sense, because there would be no way for 1 detector to figure out what direction the wheel was going. Thanks everyone.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ======

    ······ I'll try everything once [noparse]:)[/noparse]
Sign In or Register to comment.