Shop OBEX P1 Docs P2 Docs Learn Events
Multiple PING)) Sensors — Parallax Forums

Multiple PING)) Sensors

bgulbgul Posts: 6
edited 2007-05-31 01:22 in BASIC Stamp
In my project, I'm using 6 PING)) directed NW-NE-W-E-SW-SE. After a while I realized that they somehow stop receiving signals. When I connect them to power, the lights on top of them still work, but I only get furthest distance.

The possibilities that I thought of are;
1 - Too much power: my source gives 5V all the time, so I don't think that's the case... Also the last one stopped working while it was connected to 5V-out of BS2.
2 - They jam each other: I don't know if this is possible...
3 - Something got wrong with the receivers or signals: I don't know how to check that...

So what could it be? Any of the reasons that I thought of or something else? Also is it possible to fix them somehow?

PS: This is getting costly since I've trashed 7 sensors up until now...

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-05-29 17:10
    1) If your power source is reasonable stable at 5V, there's no notion of "too much power".
    If you connect them to a higher voltage (much above 6V), it's possible to burn them out.

    2) If you pulse more than one at a time, they can interfere with each other. Usually that would cause a false "close" reading.

    3) They're pretty reliable. How do you have them connected?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-05-29 18:01
    bgul,

    I’ve never heard of anyone damaging the PING))) Sensor except for when connecting too much voltage to them (usually using VIN for power). Which BASIC Stamp and development board are you using?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • bgulbgul Posts: 6
    edited 2007-05-29 18:04
    1 - I'm positive on stable 5V, so this cannot be the case.

    2 -·Can that cause a permanent damage? Now even if I try them one by one, all I get is
    Time (uS)......9751
    Inches ........132

    which is supposed to be
    Time (uS)......1207
    Inches ........16

    3 - What do you mean by how I connected them? They are soldered to the board on a line, and the 5V is applied to the line. I checked if they all get 5V and I'm positive on that too.

    BS2 for sensors right now.
    Switched to another BS2 to check if the problem was with the stamp, it's all the same.

    I'm running the single working one throught the 5V-out of the stamp, right now, and there seems to be no problem (scared to plug the other ones, but I'll plug them one by one... Hope they'll be fine...)

    Post Edited (bgul) : 5/29/2007 6:10:37 PM GMT
  • allanlane5allanlane5 Posts: 3,815
    edited 2007-05-29 19:03
    Without a schematic, and without code, we're shooting in the dark.

    Each one has a three-pin connector. That's +5 DC, Ground, and Signal. You can connect the Grounds together, and the +5 together. But each 'Signal' pin has to go to a separate pin of the BS2. And the 'Ground' of the Pings MUST be tied to the ground of the BS2. The +5 of the PINGs does not have to be tied to the BS2. Putting a 10 to 100 uF capacitor between Ground and +5 is also a good idea to filter out noise.

    You then use "PULSOUT" followed by a "PULSIN" for each one -- you can't interleave these, or the sound from one Ping will be recieved from another Ping, and your distances won't be accurate.

    You can't power the Ping from a BS2 I/O pin -- I hope that's not what you're doing.
  • bgulbgul Posts: 6
    edited 2007-05-29 19:35
    "And the 'Ground' of the Pings MUST be tied to the ground of the BS2."
    I think that was the problem with first 4. But it still happened after I tied all the grounds together.
    About the schematic... For signals I had different cable for each. I just draw the first sonar. Think it as there were 6 of them... (Everything is pretty basic.)

    I think the code is straight forward.
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    ' {$PORT COM1}
    'Set Pins to input
    i VAR Byte
    DIR0 = 1
    DIR1 = 1
    DIR2 = 1
    DIR3 = 1
    DIR4 = 1
    DIR5 = 1
    DIR6 = 1
    DIR7 = 1
    Sonar1  PIN 2             'Front right
    Sonar2  PIN 3             'Front left
    Sonar3  PIN 4             'Back right
    Sonar4  PIN 5             'Back left
    Sonar5  PIN 6             'Back left
    Sonar6  PIN 7             'Back left
    Trigger  CON 5            'trigger pulse = 10 uS
    Scale    CON $200         'raw x 2.00 = uS
    RawToIn  CON 889          '1 / 73.746 (with **)
    RawToCm  CON 2257         '1 / 29.034 (with **)
    IsHigh  CON 1             'for PULSOUT
    IsLow   CON 0
    rawDist1  VAR Word        'raw measurement of the front right sonar
    rawDist2  VAR Word        'raw measurement of the front left sonar
    rawDist3  VAR Word        'raw measurement of the back right sonar
    rawDist4  VAR Word        'raw measurement of the back left sonar
    rawDist5  VAR Word        'raw measurement of the back left sonar
    rawDist6  VAR Word        'raw measurement of the back left sonar
    First_inches   VAR Word   'distance in inches of the front right sonar
    Second_inches  VAR Word   'distance in inches of the front left sonar
    Third_inches   VAR Word   'distance in inches of the back right sonar
    Forth_inches   VAR Word   'distance in inches of the back left sonar
    Fifth_inches   VAR Word   'distance in inches of the back left sonar
    Sixth_inches   VAR Word   'distance in inches of the back left sonar
    Reset:
    DEBUG CLS,
          "Parallax PING))) Sonar", CR, ' setup report screen
          "======================", CR,
          CR,
          "Time (uS)...... ", CR,
          "Sonar1 ........ ", CR,
          "Sonar2......... ", CR,
          "Sonar3 ........ ", CR,
          "Sonar4......... ", CR,
          "Sonar5......... ", CR,
          "Sonar6......... ", CR
    MAIN:
          GOSUB Get_Sonar1    'new     'running
          PAUSE 50
          'GOSUB Get_Sonar2    'new     'running
          PAUSE 50
          'GOSUB Get_Sonar3    'old     'not working
          PAUSE 50
          'GOSUB Get_Sonar4    'old     'not working
          PAUSE 50
          'GOSUB Get_Sonar5    'new     'not working
          PAUSE 50
          'GOSUB Get_Sonar6    'new     'running
          PAUSE 50
          First_inches = rawDist1 ** RawToIn    ' convert to inches
          Second_inches = rawDist2 ** RawToIn   'convert to inches
          Third_inches = rawDist3 ** RawToIn    ' convert to inches
          Forth_inches = rawDist4 ** RawToIn    'convert to inches
          Fifth_inches = rawDist5 ** RawToIn    'convert to inches
          Sixth_inches = rawDist6 ** RawToIn    'convert to inches
          DEBUG CRSRXY, 15, 3,                  ' update report screen
          DEC rawDist1, CLREOL,
          DEC rawDist2, CLREOL,
          DEC rawDist3, CLREOL,
          DEC rawDist4, CLREOL,
          DEC rawDist5, CLREOL,
          DEC rawDist6, CLREOL,
          CRSRXY, 15, 4,
          DEC First_inches, CLREOL,
          CRSRXY, 15, 5,
          DEC Second_inches, CLREOL,
          CRSRXY, 15, 6,
          DEC Third_inches, CLREOL,
          CRSRXY, 15, 7,
          DEC Forth_inches, CLREOL,
          CRSRXY, 15, 8,
          DEC Fifth_inches, CLREOL,
          CRSRXY, 15, 9,
          DEC Sixth_inches, CLREOL
    GOTO MAIN
    START:
        PAUSE 100
        IF IN0 = 1 AND IN1 = 1 THEN BOTHDETECT
        IF IN0 = 1 THEN LEFTDETECT
        IF IN1 = 1 THEN RIGHTDETECT
        IF rawDist1<25 THEN RUN90LEFT
        IF rawDist2<25 THEN RUN90RIGHT
        IF rawDist3<25 THEN RUNLEFT
        IF rawDist4<25 THEN RUNRIGHT
    GOTO START
    'BA98
    '0000 CLEAR (GO STRAIGHT)
    '0001 LEFT DETECT (OBSTICLE)
    '0010 RIGHT DETECT (OBSTICLE)
    '0011 BOTH DETECT (OBSTICLE)
    '****************************
    '0100 RUN 90 LEFT (PREDATOR RIGHT)
    '0101 RUN 90 RIGHT (PREDATOR LEFT)
    '0110 RUN LEFT (PREDATOR BACK RIGHT)
    '0111 RUN RIGHT (PREDATOR BACK LEFT)
    CLEAR:
        DEBUG "STRAIGHT", CR
        LOW 8
        LOW 9
        LOW 10
    '    LOW 11
        PAUSE 25
    GOTO START
    LEFTDETECT:
        DEBUG "LEFT DETECT", CR
        HIGH 8
        LOW 9
        LOW 10
    '    LOW 11
        PAUSE 25
    GOTO START
    RIGHTDETECT:
        DEBUG "RIGHT DETECT", CR
        LOW 8
        HIGH 9
        LOW 10
    '    LOW 11
        PAUSE 25
    GOTO START
    BOTHDETECT:
        DEBUG "BOTH DETECT", CR
        HIGH 8
        HIGH 9
        LOW 10
    '    LOW 11
        PAUSE 25
    GOTO START
    RUN90LEFT:
        DEBUG "RUN 90 LEFT", CR
        LOW 8
        LOW 9
        HIGH 10
    '    LOW 11
        PAUSE 25
    GOTO START
    RUN90RIGHT:
        DEBUG "RUN 90 RIGHT", CR
        HIGH 8
        LOW 9
        HIGH 10
        LOW 11
        PAUSE 25
    GOTO START
    RUNLEFT:
        DEBUG "RUN LEFT", CR
        LOW 8
        HIGH 9
        HIGH 10
    '    LOW 11
        PAUSE 25
    GOTO START
    RUNRIGHT:
        DEBUG "RUN RIGHT", CR
        HIGH 8
        HIGH 9
        HIGH 10
    '    LOW 11
        PAUSE 25
    GOTO START
    'SUB FUCTIONS
    Get_Sonar1:
        Sonar1 = IsLow ' make trigger 0-1-0
        PULSOUT Sonar1, Trigger ' activate sensor
        PULSIN Sonar1, IsHigh, rawDist1 ' measure echo pulse
        rawDist1 = rawDist1 */ Scale ' convert to uS
        rawDist1 = rawDist1 / 2 ' remove return trip
        'rotate 90 left
    RETURN
    Get_Sonar2:
        Sonar2 = IsLow ' make trigger 0-1-0
        PULSOUT Sonar2, Trigger ' activate sensor
        PULSIN Sonar2, IsHigh, rawDist2 ' measure echo pulse
        rawDist2 = rawDist2 */ Scale ' convert to uS
        rawDist2 = rawDist2 / 2 ' remove return trip
        'rotate 90 right
    RETURN
    Get_Sonar3:
        Sonar3 = IsLow ' make trigger 0-1-0
        PULSOUT Sonar3, Trigger ' activate sensor
        PULSIN Sonar3, IsHigh, rawDist3 ' measure echo pulse
        rawDist3 = rawDist3 */ Scale ' convert to uS
        rawDist3 = rawDist3 / 2 ' remove return trip
        'make left
    RETURN
    Get_Sonar4:
        Sonar4 = IsLow ' make trigger 0-1-0
        PULSOUT Sonar4, Trigger ' activate sensor
        PULSIN Sonar4, IsHigh, rawDist4 ' measure echo pulse
        rawDist4 = rawDist4 */ Scale ' convert to uS
        rawDist4 = rawDist4 / 2 ' remove return trip
        'make right
    RETURN
    Get_Sonar5:
        Sonar5 = IsLow ' make trigger 0-1-0
        PULSOUT Sonar5, Trigger ' activate sensor
        PULSIN Sonar5, IsHigh, rawDist5 ' measure echo pulse
        rawDist5 = rawDist5 */ Scale ' convert to uS
        rawDist5 = rawDist5 / 2 ' remove return trip
        'make right
    RETURN
    Get_Sonar6:
        Sonar6 = IsLow ' make trigger 0-1-0
        PULSOUT Sonar6, Trigger ' activate sensor
        PULSIN Sonar6, IsHigh, rawDist6 ' measure echo pulse
        rawDist6 = rawDist6 */ Scale ' convert to uS
        rawDist6 = rawDist6 / 2 ' remove return trip
        'make right
    RETURN
    
    168 x 140 - 2K
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-05-29 20:42
    Your code doesn’t match your schematics. The schematic shows a single PING))) sensor, but where are the others connected? Assuming they are plugged into individual I/O pins that you’re not showing as being connected you have a bigger problem. It appears you’re driving these all from the BASIC Stamp VDD pin, which cannot provide enough current for all these PING))) Modules.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • bgulbgul Posts: 6
    edited 2007-05-29 22:00
    Sensors were connected to pins 2 3 4 5 6 7. I only draw the first one...

    I updated the file with labels, it's better this way. Anyways, I connected 5 together on the breadboard and they are working fine right now. They get the power from +5V of the BS2. I checked them all and they are getting enough power (4.94 average).

    I guess the problem was not connecting them to the ground of BS2 (the last one is still a mystery though).

    Thanks to everyone that helped me to figure it out.
    168 x 140 - 2K
  • Mike GreenMike Green Posts: 23,101
    edited 2007-05-30 03:31
    You cannot provide power to the PING)))s from the Stamp's +5V (Vdd) pin. The Stamp simply cannot provide enough current. It may work for a few minutes, but the voltage regulator on the Stamp itself will overheat and shutdown to protect itself. If you are powering the Stamp from an external +5V regulator (and leaving Vin unconnected), that's a different story. It might work, but you really need adequate +5V supply filtering since the PING)))s draw a substantial amount of current when they're activated and that might cause the Stamp to reset as the +5V supply sags under the load. You need at least a 100uF 6-10V electrolytic capacitor across the PING)))s to help with this.
  • allanlane5allanlane5 Posts: 3,815
    edited 2007-05-30 14:51
    If the BS2 is the only +5 volt regulator in your application, then yes, you've got power problems. The BS2 regulator will provide about 50 mA -- 5 of those mA are for the BS2 itself. This is not enough to power an 'active' Ping. If you pull too much current from the on-BS2 regulator for too long (a second or two), as Chris has said, it will go into thermal shutdown.

    It's also possible for the Ping sensor to 'brown-out' the BS2 briefly (for a millisecond or so), by briefly pulling too much current and 'drawing down' the output voltage. There's a voltage comparator on the BS2 which will reset the BS2 in that case.· Note you can't measure this 'brown-out' voltage with a multi-meter, it would take an oscilloscope to see it.

    If this is true, it's very simple (and inexpensive) to add an additional LM7805 linear regulator (the TO220 package will provide 1.0 amps) for the Ping sensors, with one input and one output capacitor (as called out in the LM7805 documentation).
  • bgulbgul Posts: 6
    edited 2007-05-30 17:30
    Thanks for help
    I don't really understand this type of stuff, so I have no idea about "100uF 6-10V electrolytic capacitor" or "LM7805 linear regulator." As a quick solution I connected PING)))s to 4AA bateries now, putting out 5.1V. They share the same ground with everything else. Might that cause a problem too, or do I really need to read some about capacitors and regulators?

    My problem is not with the BS2 btw. The biggest problem is I have 7 not working PING)))s. And by not working I mean they are not measuring anything. I didn't want to believe that they were completely dead since I can see the light on top of them blinking, but apparently they are dead...
  • allanlane5allanlane5 Posts: 3,815
    edited 2007-05-30 17:52
    Well, if it's 4 AA 'rechargeable' batteries, at 1.2 volts each those put out 4.8 volts, so you might be ok. If you used alkalines at 1.5 volts each, that would be 4 x 1.5 == 6 volts, and you might burn out the Pings.

    You actually must have the common ground (Vss), if things are going to work. You must NOT have 'common Vdd', or the BS2 is not going to work right.

    And a battery makes a wonderful power source, so you probably don't need additional capacitance for that.

    The 7 dead Pings are a symptom of something you're doing wrong. We're trying to help you fix what you're doing that's killing Pings, before you kill 7 more. Maybe Parallax can help you with the 7 dead ones.

    Oh, and "I don't know too much" about stuff is why Google is around.· Google for LM7805, and read the manual.· As I see it, you have a choice.· You can learn by reading, or you can learn by blowing stuff up.· Either way, there's stuff you'll learn.· One way is cheaper.· So far, if you've really 'killed' those PING's, at $30 each you've spent $210 on your education.
  • Mike GreenMike Green Posts: 23,101
    edited 2007-05-30 18:22
    Please keep in mind that most digital circuitry is designed to run off a particular voltage with maybe a 10%, sometimes a 20% slop factor. If you exceed that voltage, you might burn out the circuit. If your supply voltage is too low, the circuit won't work. If you power the circuit with the right voltage, but connect a higher voltage (like 6V with a 5V part) to some signal pin (like the PING)))'s data pin) you will likely burn out the part of the chip connected to the pin and maybe the whole chip. There are some exceptions. There are some parts that can work over a wide range of voltages, but these parts are specifically designed for that and their datasheets are very clear about what works and what does not. These days, more and more digital (and analog) chips are even more sensitive and may run at power supply voltages as low as 1.8V and will "smoke" if connected to more than maybe 2.1V. As allanlane5 said, you can learn by reading or by blowing stuff up. There is all kinds of information in the Wikipedia. For example, try "electrolytic capacitor wiki" in Google.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-05-30 20:20
    Can you confirm where the battery power goes to as well? Your last posts indicate you’re running the PING))) Sensors from the BASIC Stamp VDD but the replies indicate you’re running 6V into the BASIC Stamp VDD and your PING))) Sensors. My original thought was the 6V was going to VIN and the 5V output was going to the PING))) sensors. Can you confirm?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • bgulbgul Posts: 6
    edited 2007-05-31 01:22
    I changed the schematic. Right now I'm using 9V battery for BS2. It's connected to PWR. And also I'm using 4x1.5V (1.3V) rechargable AA batteries to powerup PING)))s. They have common GND. I'm not using +5V of the BS2 anymore as you have suggested.

    Sorry for the confusion.

    And thanks again for suggestions.
Sign In or Register to comment.