Shop OBEX P1 Docs P2 Docs Learn Events
Problem with IR — Parallax Forums

Problem with IR

MovieMakerMovieMaker Posts: 502
edited 2008-09-08 01:59 in Propeller 1
OK, my pinouts are:
0.········ Left Wheel Servo (1k)
1.········ Right Wheel Servo (1k)
2.········ PING Servo (1k)
3.········ IR Detect (table top edge) (NOTHING)
4.········ IR EMIT· (table top edge) (NOTHING)
5.········ PING DATA (1K)
6.········ LED (YELLOW) (100 ohm)
7.········ LED (RED)(100 ohm)
8.········ SD –D0
9.········ SD - CLOCK
10.······ SD - DI
11.······ SD -CS
12.······ bootTX (reserved)
13.······ bootRX (reserved)
14.······ LED (GREEN) (100 ohm)
15.······ Sound Pal
16.······ IR Detect· (may not use this) REAR (NOTHING)
17.······ IR Emit (100 ohm) (NOTHING)
18.······ Heartbeat Monitor (100 ohm)
19.······ SPEAKER
20.······ IRemitter (White) (100 ohm)
21.······ IRdetect (GREEN) (1k)
22.······ IRemitter (BLACK) (100 ohm)
23.······ IRdetect (RED)(1k)

and I have changed the IR to totally new pins. I have changed the IRdetectors to totally new detectors. With my video camera, I can see that the IRemitters are emitting. Now, they are only showing up as a dim purple light when I turn them on and off. Should this light be very bright instead of dim?

You can see the resistors I am using on each port. They are on pins 20 through 23.

I have tested the port by putting an LED and turning it on and off. They seem to be wired according to the way Mike Green told me to.

I am using the Program BoeBot.BAS in boebotbasic. This program checks the PING and IR and runs the machine 45 degrees in each direction then forward and back.· The PING values come back correctly, but the IR values remain at 9. They are at 9 wether on not I hook up the ditectors.

As you can see on the pinouts, I have changed ports 3 times and changed IRs two times.

I am very puzzeled.· I cannot figure out WHY they are not working. I have done one I/O at a time and this is the last one.

I am sure it is something I am not seeing and overlooking. But, I have checked,checked and double checked everything.


????????

Please help.
«1

Comments

  • MovieMakerMovieMaker Posts: 502
    edited 2008-09-06 18:12
    OK, I took EVERYTHING apart for the fourth time. I put IR stuff on different ports. I loaded up Boebasic and then Boebasic.bas. I rebuilt every circuit on a breadboard so I could get to things away from the boebot. I can see the IR signal with my camcorder shining a light pink. So, I jumped across the resistor going to the emitter. I went 220 ohms, 100 ohms and then zero ohms. It got brighter and brighter. I left it bright. When I run the program or do IRZONE it always comes back with the number 9. This has been bugging me for a week. The Detector just won't detect. I have wired and rewired it according the manual and the way Mike Green says. Am I in the twightlight zone????

    Any input would be nice. But, if you guys have run out of answers, I understand.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-09-06 18:52
    Don't do that! The resistor in series with the IR emitter is there for a purpose. It prevents the Propeller I/O pin circuitry from melting.

    It's obvious that your IR detector isn't detecting properly. It's probably your wiring since you've tried several IR detectors and you know the IR emitter is emitting IR. How do you have the detector connected? Maybe you have the pins mixed up. It's easy to get things confused and the IR detector turned around in your mind so that the pins get connected wrong. I've done it.

    Here's the link for the IR detector's datasheet: www.parallax.com/Portals/0/Downloads/docs/prod/audiovis/PNA4601M.pdf
    You can also look at pages 164-166 of "IR Remote for the BoeBot" for diagrams.

    Vcc should be connected to +5V, GND (the center pin) should be connected to ground (Vss), and Vout should be connected to one end of a 1K resistor with the other end of the 1K resistor connected to a Propeller pin.

    All I can say is that if the IR emitter and detector are wired correctly, the IRZONE statement in BoeBotBasic will work as documented.
  • TimmooreTimmoore Posts: 1,031
    edited 2008-09-06 18:59
    A suggestion, disconnect the 1K resistor from the ir detector and connect it to +3.3V and then Gnd (1 at a time). See if irzone is detecting that. If that is not working then your pin configuration is wrong (or the prop pin is dead). If that is working then the ir detector is not working - dead or wired wrong.
  • MovieMakerMovieMaker Posts: 502
    edited 2008-09-06 19:02
    Thanks, guys. I have it wired correctly that I know of.

    TIm, I will try your suggestion. If it works you will hear me yelling from here. I will be so glad to solve this mystery.
  • parts-man73parts-man73 Posts: 830
    edited 2008-09-06 19:03
    You've tested the IR LEDs.... how bout testing the detectors

    obex.parallax.com/objects/37/

    if you have a SONY TV remote control, or a universal remote that can be set up to operate a SONY TV.

    The code should be easily modified to send data by serial back to a Terminal program instead of TVTerminal....If you can't figure out how, I'd be glad to modify it and send it to you.

    I also have some code to drive a BoeBot with a SONY remote... pushing 2 to go forward, 8 to back up, 2 to turn left, 6 to turn right. I used some of the objects in the above referenced repository, and well as a Servo object.

    That's what I love about the Propeller, all these Objects exist to do all sorts of cool things, you just have to get them to work together.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Brian

    uController.com - home of SpinStudio - the modular Development system for the Propeller

    PropNIC - Add ethernet ability to your Propeller! PropJoy - Plug in a joystick and play some games!

    SD card Adapter - mass storage for the masses Audio/Video adapter add composite video and sound to your Proto Board
  • MovieMakerMovieMaker Posts: 502
    edited 2008-09-06 19:03
    Now, the way I am reading if you face the bubble away from you, the Left pin is 5vdc and the middle pin is ground. It leaves only the signal pin to the right. Am I correct???
  • MovieMakerMovieMaker Posts: 502
    edited 2008-09-06 19:05
    Also, I have tried four different Detector. One I hooked backwards and it burned up.

    I still have 3 left that are brand new and running cool.

    I switched to 3 or 4 different ports so I know the port is not blown. Also, I tried them on an LED and it worked fine.
  • MovieMakerMovieMaker Posts: 502
    edited 2008-09-06 21:10
    OK, Tim.

    I would have got back sooner, but today being Sat, the wife had some "Honeydo"s for me to do. Sorry.

    I ran the test and when I put the resistor to the 3.3vdc, I got -1 for the first time. I ALWAYS get a 9. So, according to what you have told me, the detector is not working or is dead. But, I have tried Four brand new detectors. Wow! I have always tried to wire them correctly. As the bubble is facing away from you and you are looking down on the detector, the Left pin is 5vdc and the right is Signal going to the prop through a 1k resistor. The middle is Ground. How else could it be wired? I have done this 10 times at least.

    ?? Where do I go from here?
  • parts-man73parts-man73 Posts: 830
    edited 2008-09-06 21:15
    MovieMaker said...
    Now, the way I am reading if you face the bubble away from you, the Left pin is 5vdc and the middle pin is ground. It leaves only the signal pin to the right. Am I correct???

    Yes, that's correct

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Brian

    uController.com - home of SpinStudio - the modular Development system for the Propeller

    PropNIC - Add ethernet ability to your Propeller! PropJoy - Plug in a joystick and play some games!

    SD card Adapter - mass storage for the masses Audio/Video adapter add composite video and sound to your Proto Board
  • MovieMakerMovieMaker Posts: 502
    edited 2008-09-06 21:46
    I soldered a new circuit and I saw the emitter emitting with my camera. I got only 9 9 9 9 9 from the irdetector. So I swapped the wires going to the detector and I got -1 -1 -1 -1 -1. But, no matter where I put the book in front of the unit I get those readings.

    hmm????
  • Mike GreenMike Green Posts: 23,101
    edited 2008-09-06 21:54
    From your previous thread about QTI tracking:

    How about using just a single IRZONE statement and see what you get? Like:

    100 print irzone [noparse][[/noparse] 38000, 10, 500 ]

    Every time you run this you should get a number from -1 to 9. If you have the IR emitter and IR
    detector aimed in the same general direction and use a book or piece of wood or something as a test
    surface, you should be able to get different zone values with different distances from the emitter / detector.

    If you get -1 all the time, then either the IR emitter isn't working or the IR detector is always giving <---
    a high (+5V) value. If you get 9 all the time, then the IR detector is always giving a low (0V) value. <---
    Check your wiring. The IR detector should have a supply of +5V, ground, and the output lead should <---
    be connected to the proper Propeller I/O pin through a 1K resistor.
  • Bob Lawrence (VE1RLL)Bob Lawrence (VE1RLL) Posts: 1,720
    edited 2008-09-06 21:55
    Take a picture and post it. Maybe someone can spot an error. Use a multi-meter and check resistor value, voltage levels. post your source code. Etc.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Aka: CosmicBob
  • MovieMakerMovieMaker Posts: 502
    edited 2008-09-06 21:59
    I have it wired up a third IRdetector according to the picture on page 253 of the Robotics with the boebot student manual. And I get 9 9 9 9 9. I am ready to throw the whole thing in the trash can!
  • MovieMakerMovieMaker Posts: 502
    edited 2008-09-06 22:00
    I did the voltage measurements. It was 5 vdc. Is this where I am wrong? Is it supposed to go to 3.3v? maybe that is my mistake.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-09-06 22:08
    Some kind of short circuit in the wiring can cause this. Use a multimeter to trace through the wiring. A 9 value for IRZONE all the time can be caused by the detector I/O pin being shorted to ground. What happens is that the IRZONE tries zone 9 first (the furthest zone). If the IR detector sees an IR signal there, IRZONE stops and returns a 9. If the IR detector is shorted to ground, the IRZONE routine also returns a 9. If the IR detector is shorted to +5V so the Propeller sees a +3.3V signal through the 1K resistor, the IRZONE routine tries all the zones and never sees an IR signal, so it returns a -1 all the time.
  • MovieMakerMovieMaker Posts: 502
    edited 2008-09-06 22:10
    I tried to take a picture, but everything close up enough for you to get detail is blurry. Sorry.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2008-09-06 22:16
    Post Edit -- I'd better keep out, too many cooks spoil the soup.

    Post Edited (PJ Allen) : 9/6/2008 10:42:38 PM GMT
  • MovieMakerMovieMaker Posts: 502
    edited 2008-09-06 22:16
    Mike, I have moved it to a breadboard where NOTHING can touch each other. I looked at the schematic and it looks like the IRdect is facing us. If it is then the signal is on the left, ground in the middle and +5 on the right. I have wired it exactly like the student manual page 253 says. I still haven't found out if I should use 5vdc or 3.3. I have it set to 5volts. I know that you are getting tired of this. I am sorry.
  • MovieMakerMovieMaker Posts: 502
    edited 2008-09-06 22:18
    PJ! I don't have the resistor across the two pins, I have it in series to the i/o pin. If it goes across the two pins, maybe THAT is my problem. Also, I need to move it to 3.3 volts. I have it on 5vdc.
  • parts-man73parts-man73 Posts: 830
    edited 2008-09-06 22:29
    I use 5 volts, and no pullup resistor between VCC and signal. Just a 10k resistor between the signal pin on the detector and the Propeller pin. (1k works fine too)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Brian

    uController.com - home of SpinStudio - the modular Development system for the Propeller

    PropNIC - Add ethernet ability to your Propeller! PropJoy - Plug in a joystick and play some games!

    SD card Adapter - mass storage for the masses Audio/Video adapter add composite video and sound to your Proto Board
  • MovieMakerMovieMaker Posts: 502
    edited 2008-09-06 22:57
    partsman, that is the way I have it. I re-wired everything for the 10th time. I had it for 3.3volts and the resistor across the IRdetector. Nothing worked, so I put it back to 5. Now my emitters are working again, but either the detector shows 9 or -1 if I wire it backwards. But, that is it. I have been in Electronics since 1970. I have NEVER in my life seen such a difficult situation. Maybe I am just getting to old for this.
  • MovieMakerMovieMaker Posts: 502
    edited 2008-09-06 23:03
    If I print irzone[noparse][[/noparse]38000,10,500] I get 9
  • parts-man73parts-man73 Posts: 830
    edited 2008-09-06 23:09
    Do you have a Sony remote to try to test the detector with?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Brian

    uController.com - home of SpinStudio - the modular Development system for the Propeller

    PropNIC - Add ethernet ability to your Propeller! PropJoy - Plug in a joystick and play some games!

    SD card Adapter - mass storage for the masses Audio/Video adapter add composite video and sound to your Proto Board
  • parts-man73parts-man73 Posts: 830
    edited 2008-09-06 23:14
    This may be a stupid question, but sometimes the most obvious is overlooked. Did you change the irDetect and irEmit in the CON section of the BoeBotBasic code to the correct pins?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Brian

    uController.com - home of SpinStudio - the modular Development system for the Propeller

    PropNIC - Add ethernet ability to your Propeller! PropJoy - Plug in a joystick and play some games!

    SD card Adapter - mass storage for the masses Audio/Video adapter add composite video and sound to your Proto Board
  • MovieMakerMovieMaker Posts: 502
    edited 2008-09-06 23:31
    I did change the pins. But, I have about a zillion boebotbasic programs. I have tried to compile a special one for me with the BS2 functions. But, when I load it into eprom, it doesn't come back and say "ok". But, I have used the direct commands to check the pins exactly. I am going to look for my sony remote. I am sure I have one here somewhere. The reason I did not get real big on recieving an IR signal from the remote is because I am turned off by robots that are controlled by remotes. I want the robot to be autonomous.

    I'll be back in a little bit. Thanks for hanging in there with me. I have been at this for 9 hours straight.
  • MovieMakerMovieMaker Posts: 502
    edited 2008-09-06 23:45
    I tested everything earlier with an LED and it got the signal, etc. Seemed to work fine. i have changed ports about 4 times since then just to make sure. I have wired and rewired 10 times. I have used 4 different detectors. I have seen the emitters emitting except when there was only 3.3 volts and then they did not. I have phillips, rcs, sanyo, cannon,jvc and I don't know where the sony remote is. I tried several going in with a direct command and all I got back was 9 9 9 9 9.
  • MovieMakerMovieMaker Posts: 502
    edited 2008-09-06 23:46
    Oh, I forgot to tell you, there is no such thing as a Stupid Question. It may be a simple question, but not stupid.

    Thanks for your help.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-09-07 00:42
    When you say something like "I tested everything earlier with an LED", it's absolutely useless. I have no idea what you tested, how things came out, how things are connected, etc.

    What you described for the connections of the IR detector sound correct as long as you use +5V. I'm very thrown off by your descriptions of what sounds like wild trial and error. That's a very easy way to destroy things. To debug these things successfully, you usually have to be methodical and thoughtful, ask questions before doing, whether of yourself or of others, so you know what it is that you're trying to demonstrate.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-09-07 00:53
    At this point, I'd want to know whether the IR detector is working. That may be what you mean by "with an LED".

    What I mean is to wire up one of the IR detectors on the breadboard with Vdd connected to +5V and GND connected to ground (Vss).
    Vout should be connected to a 1K resistor with the other end of the resistor connected to the base of a 2N2222 or PN2222 or similar NPN switching transistor. The emitter of the transistor should be connected to ground. The collector should be connected to the cathode of a visible LED. The anode of the LED should be connected to a 330 Ohm resistor and the other end of the resistor to +5V (Vdd). When the IR detector is not detecting anything, the LED will be on. When the IR detector detects something, the LED will turn off.

    When you do an IRZONE statement, that should cause the IR emitter to produce a couple of pulses of IR light at frequencies that the IR detector will respond to. The LED should flash off briefly or flicker when an IRZONE statement is executed. If you increase the number of zones (the 2nd parameter) and decrease the frequency width of the zone (the 3rd parameter), you'll get longer periods of IR energy emitted. You could try

    IRZONE 38000,20,250 or IRZONE 38000,50,100
  • MovieMakerMovieMaker Posts: 502
    edited 2008-09-07 01:14
    OK, Mike, in aswer to your first question. I took a resistor and an LED and put the other end to ground. I placed it one at a time on all pins to all ports and gave it an outa and the LED lit. That tells me the port is good. I guess.

    I took an ohm meter and checked everywhere for continuity. Then I turned on the protoboard and measured 5 volts and 3.3 where they were supposed to be.

    I understand about the wild way I have been troubleshooting. I saw that PJ or who ever he was posted that he had a 4.7k resistor across signal and voltage instead of series with the pin. He also had 3.3volts instead of 5 volts. I did that number, but it did not work.

    No, the Detector never did work, only the ports which I hooked it to. I did have an accident and one of the Detectors burned up. That was the time that I checked everything else to see if it still worked. After the LED test, I checked the speaker, the SoundPal, the SDcard, the Ping and servos left and right. All other stuff worked fine except the IR. I changed the ports 4 times already. After that, I got a breadboard and did it all on the breadboard. I mean the IR stuff. I got two Brand new IRdetectors from Parallax and wired them up. I checked the emitters by using my camcorder and they glowed faint pink. When I shorted the resistors out, they glowed Bright pink or purple. You told me not to do this, so I stopped. I found a remote control (actually about 8 of them.) I pressed the remotes while running the irzone program continuously getting only 9s. I looked to see if when I pressed the remotes that the number would change. I reversed the leads on the IRdetectors in hopes that I had wired them backwards(doubleful). When I did that,l got a -1 instead of a 9. So, I put them back.

    Actually the Emitter LED never flashed just stayed on until I turned it off.

    My statement was PRINT IRZONE[noparse][[/noparse]38000,10,500] I believe.

    The above is the results of 9 hours working straight. new ports, new detectors, new circuitry, new ideas.

    Mike, thanks for listening. You are a good teacher. I love the way your mind works.
Sign In or Register to comment.