Shop OBEX P1 Docs P2 Docs Learn Events
Boe-Bot - IR sensor only returning 0 - need help please :) — Parallax Forums

Boe-Bot - IR sensor only returning 0 - need help please :)

cwaugh19cwaugh19 Posts: 11
edited 2010-04-14 20:06 in Robotics
Hi everyone!

I am doing a Boe-Bot for a district scholarship project. I have made it to chapter 8 however I am having a serious problem..... for some reason I can't get the IR sensor to work since one fried. Yeah, I fried one and got them both replaced (the transmitter/reciever) and it still won't work. What happens: When I run "TestLeftIRPair" from the manual, I am always getting a value of 0 regardless of whether an object is detected. I tried it in a dark and light room and no difference. I have checked and redone my circuity numerous times and no luck. When I run "FollowingBoeBot" the Boe-Bot moves forward but none of the sensors are picking up on anything. It just keeps driving straight when it should be turning and doing manouvers. I am in a time crunch here to get this done and I have no idea what is going on.·Let me know if you need a copy of the code- I don't have it on this computer but·I copied the code exactly from·"TestLeftIRPair"·and "FollowingBoeBot" from the manual as well as all the circuits however they are fairly basic. I have tried all the resisters possible. Any help would be wonderful.
Thanks everyone [noparse]:)[/noparse]

-Chris

Comments

  • JReedJReed Posts: 4
    edited 2010-04-12 19:11
    Just out of curiosity, what pin are you using to read the data?
  • cwaugh19cwaugh19 Posts: 11
    edited 2010-04-12 19:19
    Hi JReed!

    I am trying to read out of PIN 0 and 2 for the right sensor and 8 and 9 for the left. I tried different pins too no difference. Also, the pins flash the LED's so I assume the pins are still okay. Any other ideas?

    -Chris
  • FranklinFranklin Posts: 4,747
    edited 2010-04-12 19:31
    Start by using the "post reply" button and the "attachment manager" to attach the .bs2 file to your next post along with a detailed description of your connections and what you get from the debug screen (along with what you expected to get)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • cwaugh19cwaugh19 Posts: 11
    edited 2010-04-12 20:00
    I have attached the code- The circuit is on page 252 in the following link. Let me know if you need anything else.

    http://www.parallax.com/Portals/0/Downloads/docs/books/edu/Roboticsv2_2.pdf

    -Chris
  • ercoerco Posts: 20,256
    edited 2010-04-12 20:22
    We're talking about a 3-pin rectangular 38 kHz IR receiver module, correct? As you know, their normal output is high, so they should read 1 to the BASIC Stamp without receiving any signal. If you have a multimeter, disconnect everything except +5V and ground, and verify that you measure 5V on the module's output pin, relative to ground. Without that, all is lost.

    Assuming that checks out, you can connect the module's output pin to any stamp pin through a 220-ohm resistor. Make sure the pin is set to be an input, and test it with a simple program to DEBUG the pin status, like:
    a[noparse]:D[/noparse]EBUG DEC IN3:goto a
    which should give you all ones under no-signal conditions. And the module's output pin should still measure 5V when hooked up to the Stamp.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • cwaugh19cwaugh19 Posts: 11
    edited 2010-04-12 20:29
    Yes you are correct- we are talking about a 3-pin rectangular 38 kHz IR receiver module. Yeah, I know I should read 1 when no object is detected but I get 0 no matter what. Sadly I don't have a multimeter.... I am going to get one eventually. I did connect it using a 220-ohm resister and it was set to be an input. Any other ideas? I have attatched the "FollowingBoeBot" code so let me know if you see a reason why it wont work with my circuit [noparse]:)[/noparse]

    -Chris
  • ercoerco Posts: 20,256
    edited 2010-04-12 22:57
    Harbor Freight "CenTech" multimeters are $5... or borrow one...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • Martin_HMartin_H Posts: 4,051
    edited 2010-04-12 23:55
    After a hot melt glue gun, a multimeter was the best money I ever spent. Mine is over 22 years old and I find tons of uses for it. Continuity testing circuits and ensure voltages are as expected is invaluable. The new ones look pretty sweet because they auto-range which my antique doesn't do.
  • GWJaxGWJax Posts: 267
    edited 2010-04-13 03:06
    I made a few changes to your program. try it out and see what zone the IR's are picking up in or if the sensors are working at all. Let me know what happens.

    Jax

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    If a robot has a screw then it must be romoved and hacked into..
  • cwaugh19cwaugh19 Posts: 11
    edited 2010-04-13 03:46
    Hey GWJax!

    Thanks for the help however it still didn't work. All that happened is that the Boe-Bot got stuck in the loop which was supposed to turn the robot if irDetectLeft = 0.... but since it always = 0 for some reason, it had no way of escaping. In other words, its acting like an object is sensed when its not... any other ideas?

    Oh yeah the DEBUG showed that an object was sensed- again it shouldn't of because an object wasn't sensed....

    -Chris
  • ercoerco Posts: 20,256
    edited 2010-04-13 04:20
    Remove the sensor. Connect the Stamp pin you were using directly to Vdd (+5V) and make sure you read 100% ones off the pin every time. Then connect the pin to Vss (ground) and make sure you get nothing but zeroes all the time.

    Are you sure your resistor is 220 ohm (red red brown)?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • cwaugh19cwaugh19 Posts: 11
    edited 2010-04-13 06:36
    Okay I will try it tomorrow. I did however try removing the sensors and connecting an led to the pin and using a simple code to flash the led and that did work so I assume the pins are good....

    -Chris
  • ercoerco Posts: 20,256
    edited 2010-04-13 06:59
    It's possible to have a damaged pin that works as an output but not input, and also vice-versa. So your LED test doesn't absolutely prove a pin still works as an input.

    BTW, if you have two IR sensors, you should try them both on a few different pins, in case one is damaged. You said you fried one, so lightning could strike twice: either the input pin or new modules could be zapped and/or hooked up incorrectly. Not all modules are 100% interchangeable. Did you verify the pinouts on your new sensors are the same as your original recipe, deep-fried units?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • cwaugh19cwaugh19 Posts: 11
    edited 2010-04-13 07:02
    Yeah the new IR transmitter receivers were directly from parallax and I tried both sensors and both of them each on numerous pins and got the same result.... any other ideas?
  • ercoerco Posts: 20,256
    edited 2010-04-13 07:16
    Borrow a multimeter and do all these tests!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • cwaugh19cwaugh19 Posts: 11
    edited 2010-04-13 17:48
    Hey Erco, i ran both of your tests..... the ouput pin on the reciever is reading 0 from the multimeter that yes I borrowed. When I connected the pin to Vdd I got 1 and to Vss I got 0--- that test passed but the voltage one failed... any other ideas?

    -chris
  • ercoerco Posts: 20,256
    edited 2010-04-13 20:05
    Stamp's OK, sensor sounds messed up. Sensor output should be high, or 1, measuring +5V with no IR signal present. One possibility is that it requires a pullup resistor. Add a 10K resistor from +5V to the sensor's output pin and retest.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • cwaugh19cwaugh19 Posts: 11
    edited 2010-04-13 20:12
    Hey Erco, which one is the output pin again? and the sensors are brand new so I assume i must need the resister... i will try it. thanks [noparse]:)[/noparse]
  • ercoerco Posts: 20,256
    edited 2010-04-13 23:06
    You may have damaged·one or all of your·sensors by hooking them up incorrectly if you don't know which pin is the output. You said you're using the Parallax part, which is a Panasonic unit, info at http://www.parallax.com/Portals/0/Downloads/docs/prod/audiovis/PNA4601M.pdf

    Suggest you use the BoeBot Book for every step, it has excellent illustrations, even shows how to assemble the sensors & breadboard. It's a free download at http://www.parallax.com/Portals/0/Downloads/docs/books/edu/Roboticsv2_2.pdf

    There's a very good·chance·your sensors are (or were) fine, but hooked up wrong. In that case, the 10K pullup resistor won't make any difference. Remove everything from your prototyping area, and hook up one sensor per the text above. Don't go any further until your Stamp·starts reading ones out of the sensor. Point a remote control at it and you should see a mixture of ones & zeroes. If you can't get that going with any of your sensors, then they are all damaged and you need new ones. You'll get it, this is how everybody starts. You're nobody until you fry a few components!

    Come back·after·you get that working properly.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • ercoerco Posts: 20,256
    edited 2010-04-13 23:13
    Chris: Pardon me for restating the obvious, but protect your Stamp. Your initial post said "I have no idea what is going on" and we all want to help you. In hooking up your wires to Vdd (+5V), STAY CLEAR of Vin, which is 9 volts, and will fry your Stamp and sensors. It would be an easy mistake to make, but it would explain the problems you're having.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • GWJaxGWJax Posts: 267
    edited 2010-04-14 11:12
    Chris, Also if you can post a photo of your board with the wiring this may also help us out to see what went wrong.

    @ erco, Good advise about staying clear of the Vin. There are many people that are new to the Stamp that just don't understand completely on what this pin really does. Thanks for pointing this out for Chris and others that are new to the Basic Stamps and this applies to any MCU that one should have.

    Jax

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    If a robot has a screw then it must be romoved and hacked into..
  • cwaugh19cwaugh19 Posts: 11
    edited 2010-04-14 14:48
    Hi Erco,

    I know which is the ouput pin - always did I was just confused for a second about what you were talking about. It's okay.... and don't worry I know not to use Vin. I am not 100 % "new" to the stamp.

    -chris
  • ercoerco Posts: 20,256
    edited 2010-04-14 15:46
    XLNT. So how'd we do?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • cwaugh19cwaugh19 Posts: 11
    edited 2010-04-14 17:12
    Hi erco,

    Bad news. It goes terrible... I think my circuit board fried...... it suddenly won't detect my STAMP and I tried two Bs2 chips... one of which I know works.... any ideas? how can I test the board quickly? can I use a multimeter? I borrowed one lol

    -Chris
  • ercoerco Posts: 20,256
    edited 2010-04-14 20:06
    Not sure how to help you further, Chris. Clearly, if your sensors, board, or Stamps are "frying", then you are getting a very expensive education the hard way. In my experience, the boards, sensors & Stamps are very robust, so something is amiss here. Could be a simple fix like new batteries, or any number of things that would take forever to solve online here. It's often one small detail easily overlooked by new guys that a more experienced user can spot pretty quickly. I think you need to find some local help from someone who can personally take a look at what you're doing. Ask your friends or teacher for help, or tell us what city you live near and see if anyone on the Forum is close enough to help.


    Again, the Parallax robotics book has pictorials which provide excellent visual reference. They show exactly which pins plug into which holes on the breadboard socket. Literally thousands of people have used it successfully without trouble. I know you are in a rush to get results, but IMHO you may benefit from slowing down, starting at the beginning, and working methodically through the entire book. Hope this helps get you going.

    Eric

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
Sign In or Register to comment.