Shop OBEX P1 Docs P2 Docs Learn Events
Ping blinds my Penguin? — Parallax Forums

Ping blinds my Penguin?

skynuggetskynugget Posts: 172
edited 2011-04-11 09:57 in Robotics
So i have a new RevB penguin, and when i plug a ping sensor into the front expansion port it renders the Right (looking him in the face) IR emitter inoperable.

I have tried two pings with the same results.
I have tried using the rear expansion port, and the emitters work fine.
I have tried plugging a PIR in the pront expansion port, and oddly enough the emitters work fine.
I have also tried placing the ping just behind the expansion port without plugging it (thinking it may be reflecting or something) and the emitters still work fine.

Any ideas? Thanks in advance!

P.S. I'm using this code to test.
IrInput        PIN     4

REmitter       CON     2
LEmitter       CON     3

LeftIr         VAR     Bit
RightIr        VAR     Bit
time           VAR     Word


DEBUG CLS                                    ' Prepare debug screen
DEBUG "Infrared sensor status:", CR,
      "Left:", CRSRXY, 15, 1,"Right:", CR
DO
  GOSUB ReadIr
  GOSUB READPING                               ' Update debug screen with
  DEBUG CRSRXY, 6, 1, DEC LeftIr             ' status of IR sensors
  DEBUG CRSRXY, 22, 1, DEC RightIr
  DEBUG CR, "Distance  = ", DEC4 time, " cm",CR    ' centimeter display
  PAUSE 150
LOOP

ReadIr:
  FREQOUT LEmitter,1,6300                    ' Modulate emitters at 38KHz
  LeftIr = ~IrInput                          ' and check for reflections
  FREQOUT REmitter,1,6300
  RightIr = ~IrInput
RETURN


ReadPing:
  PULSOUT 5, 5                                   ' start pulse
  PULSIN 5, 1, time                 ' store ping echo round trip time
  time = time ** 2080/2
RETURN

Comments

  • HumanoidoHumanoido Posts: 5,770
    edited 2011-03-30 20:23
    Does the Ping work ok in the front position?
  • skynuggetskynugget Posts: 172
    edited 2011-03-30 20:35
    yes the ping does work in the front port, which is really baffling.
  • HumanoidoHumanoido Posts: 5,770
    edited 2011-03-30 20:38
    I tried the program on my Penguin REVB using a PING. I used fully recharged batteries and kept the USB cable plugged in for maximum power. Both IRs perform nearly identical out to a range of about 2 feet or around 55cm. The PING also works perfect and was reaching the wall limit at 328cm. I don't see any problem with the code. Remember if you want to use the PING on the rear port, make a program change from port 5. I think the batteries in your Penguin may need replacement.
  • skynuggetskynugget Posts: 172
    edited 2011-03-30 20:42
    i thought so as well, but i have the same problem when i clip him into a regulated power supply... sorry i just realized i didn't mention that.
    i also think that if it where a battery problem, port 2 would also blind the penguin, but it doesn't.
  • HumanoidoHumanoido Posts: 5,770
    edited 2011-03-30 23:46
    Have you tried two Penguins?
  • HumanoidoHumanoido Posts: 5,770
    edited 2011-03-30 23:50
    You may also want to describe in detail what you see with the IR values and Ping values at various distances so the problem is understood better. These IR devices merely give a 0 or a 1 for IR detection within its range. To get actual ranging values of target distance, which is possible, another program is needed.
  • skynuggetskynugget Posts: 172
    edited 2011-03-31 06:20
    i only have one penguin to try :(
    when i plug the ping in only the right emitter will goto 1 when i wave my hand in front of it (about 4 cm away).

    As soon as i pull the ping, both the left and the right emitters will goto 1 when i wave my hand in front of it.

    the range of the ping seems to be correct, when i put my hand at 10 cm, it finds it at 10 cm.

    when i put the ping in the rear port both emitters will goto 1 and the ping reports the proper range.
  • HumanoidoHumanoido Posts: 5,770
    edited 2011-03-31 06:59
    There's a simple demo test for the IR only. Keep the PING plugged in the front and run the demo for IR only. Does the left emitter cause a 0 when you wave your hand in front of it? Then try it without the PING. This is beginning to sound like the classic case of PING putting some pressure on the tiny board's port and causing an open circuit to happen with the IR circuit. While testing the IR, you could very gently move/flex the PING a little to see if that induces the anomaly.

    PenguinCode-v1.3 (.zip)
    ' Parallax Penguin Robot
    ' Penguin-IRTest.bpx
    
    ' {$STAMP BS2px}
    ' {$PBASIC 2.5}
    
    IrInput        PIN     4
    
    REmitter       CON     2
    LEmitter       CON     3
    
    LeftIr         VAR     Bit
    RightIr        VAR     Bit
    
    DEBUG CLS                                    ' Prepare debug screen
    DEBUG "Infrared sensor status:", CR,
          "Left:", CRSRXY, 15, 1,"Right:"
    DO
      GOSUB ReadIr                               ' Update debug screen with
      DEBUG CRSRXY, 6, 1, DEC LeftIr             ' status of IR sensors
      DEBUG CRSRXY, 22, 1, DEC RightIr
      PAUSE 150
    LOOP
    
    ReadIr:
      FREQOUT LEmitter,1,6300                    ' Modulate emitters at 38KHz
      LeftIr = ~IrInput                          ' and check for reflections
      FREQOUT REmitter,1,6300
      RightIr = ~IrInput
    RETURN
    
  • skynuggetskynugget Posts: 172
    edited 2011-03-31 08:19
    thanks for all the personal attention humanoido, i really appreciate the troubleshooting tips.

    using the just ir demo, i get the same results. if the ping is in, no left IR.

    gently wiggling doesn't seem to have an effect.

    i also tried plugginng in a few 2 pin devices, with just the IR test code running.

    PIR - both emitters work fine
    2 line serial LCD - has the same effect as the ping.

    so both the PING and the LCD cause this problem to happen, but not the PIR. it seems that the higher current draw of the PING and LCD maybe causing the problem?
  • skynuggetskynugget Posts: 172
    edited 2011-03-31 08:48
    i also just tried setting both emitters high so they where on full brightness with no modulation. i then looked at them with my cell phone camera and can see that they are on full brightness weather the ping is plugged in or not, so i don't think the port is actually opening the emitter. odd...
  • HumanoidoHumanoido Posts: 5,770
    edited 2011-03-31 09:26
    I believe this is a power problem. It's happening when more heavy current drawing sensors are connected and not happening at the lower 3ma level. This indicates something going on with the power supply/circuit. I suggest buying new batteries, just to solve this problem.

    But wait - you didn't say if this is a fixed Penguin. Unless you or someone personally modified the Penguin board to install the repair parts, it will not operate with the usb cable detached.
  • skynuggetskynugget Posts: 172
    edited 2011-03-31 09:50
    i have him clipped into my bench supply, with the IR test code running, he pulls 120ma without the ping, 140 ma with the ping (at 6.3v ,servos unplugged). also the when i use the rear port, it doesn't bother the IR. i would think that would rule out a power problem.

    i did do the rework, however i did not test him with the ping before i did it. i did calibrate, and have him walking tethered before i did the rework, and he migrates north quite well unteatherd, after the rework.
  • HumanoidoHumanoido Posts: 5,770
    edited 2011-03-31 16:36
    How did you get only one Penguin REVB? This is not from the charity special through Parallax? It could be a problem with the board and related to port 5 and the current draw in that circuit. Try complete inspection with a magnifier. You may also want to double check the work around the modification install, as those parts are very small and easy to overheat. Apparently port 11 is fine, which is a long distance away from P5 and the IR ports. You could also take some microscope images to inspect the board - this may work a lot better than any unaided visual inspection. Attached chart shows the Penguin pinout details. The schematic is found here. PenguinDoc-v1.4 (.pdf)

    attachment.php?attachmentid=79747&d=1301614234
    470 x 307 - 43K
  • skynuggetskynugget Posts: 172
    edited 2011-03-31 18:12
    a friend of mine got two, he gave me one for doing the rework on his since i have a nice pace station :) unfortunately i already shipped his halfway across the earth. ill pick at him a bit and see what i come up with. thanks again.
  • skynuggetskynugget Posts: 172
    edited 2011-04-01 08:19
    i spent some time poking and prodding components and didn't turn anything up. all the solders look good, and the resistors and traces all check out good.

    i have been sitting here watching the output of the IR test code (without the ping), with the penguin head looking at a wall and i have noticed the right eye holds "1" constantly, but the left slips to "0" off and on quite a bit. maybe the problem is with the emitter it self that gets exacerbated by extra current draw on the bus?

    I'm guessing he uses the emitter that parallax sells correct?
  • HumanoidoHumanoido Posts: 5,770
    edited 2011-04-01 17:19
    skynugget wrote: »
    i have been sitting here watching the output of the IR test code (without the ping), with the penguin head looking at a wall and i have noticed the right eye holds "1" constantly, but the left slips to "0" off and on quite a bit. maybe the problem is with the emitter it self that gets exacerbated by extra current draw on the bus? I'm guessing he uses the emitter that parallax sells correct?
    If the range is at the limit (you didn't say the distance to the wall), one IR over the other will switch off. They are not exact. This is normal. Yes, this is a Parallax product. If you have a Boe-Bot, the IR could be borrowed for testing on the Penguin.
  • skynuggetskynugget Posts: 172
    edited 2011-04-01 17:22
    sorry, range about 2 cm.
  • HumanoidoHumanoido Posts: 5,770
    edited 2011-04-02 16:53
    skynugget wrote: »
    sorry, range about 2 cm.
    The range should be over ten times farther. The typical IR range on Penguin is 32 cm, which is the point at which a 1 switches to a 0 representing loss of detection.
  • skynuggetskynugget Posts: 172
    edited 2011-04-02 19:49
    bang on... ill parts on Monday and report back
  • skynuggetskynugget Posts: 172
    edited 2011-04-11 09:57
    The new ir emitter didn't solve my problem, or a new set of cr123's for that matter. Smile in a hat!
Sign In or Register to comment.