Shop OBEX P1 Docs P2 Docs Learn Events
problems with SRF04 ultrasonic sensors — Parallax Forums

problems with SRF04 ultrasonic sensors

ArchiverArchiver Posts: 46,084
edited 2002-06-17 16:00 in General Discussion
Hey, first off I am pretty new to this software. I am building a
self guided robot. I have a BS2 and am controling 4 rc motors with
the stamp. I am using four SRF04 sensors to guide it. One sensor
for each motor. Simple right? Well first using the pulsin pulsout
commands, I only got two of the four sensors to work. The third did
nothing, the fourth locked on high and kept its motor goin
constant. So then I switched the pulsin with rctime like it said in
the sensor booklet. That got the thrid one workin. Now I have
three sensors working without a problem. As soon as I hook up the
fourth it locks its motor on high. I have tried a bunch of things
like switching pins on the stamp and software, adding delays still
nothing. I have limited knowledge about this and was hoping someone
could help. Thanks

Ray

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-06-15 09:21
    >From: "jive_star" <jive_star_1999@y...>
    >Reply-To: basicstamps@yahoogroups.com
    >To: basicstamps@yahoogroups.com
    >Subject: [noparse][[/noparse]basicstamps] problems with SRF04 ultrasonic sensors
    >Date: Sat, 15 Jun 2002 05:43:13 -0000
    >
    >Hey, first off I am pretty new to this software. I am building a
    >self guided robot. I have a BS2 and am controling 4 rc motors with
    >the stamp. I am using four SRF04 sensors to guide it. One sensor
    >for each motor. Simple right? Well first using the pulsin pulsout
    >commands, I only got two of the four sensors to work. The third did
    >nothing, the fourth locked on high and kept its motor goin
    >constant. So then I switched the pulsin with rctime like it said in
    >the sensor booklet. That got the thrid one workin. Now I have
    >three sensors working without a problem. As soon as I hook up the
    >fourth it locks its motor on high. I have tried a bunch of things
    >like switching pins on the stamp and software, adding delays still
    >nothing. I have limited knowledge about this and was hoping someone
    >could help. Thanks
    >
    >Ray
    >
    >

    I obviously don't know the exact setup you're working on. But since you can
    get the other sensors to work, how about taking one of the working sensors
    out of the ciorcuit and swapping it with the sensor which doesn't work? That
    way you can test to see if the sensor working ok, or if it's somewhere else
    down the line. Also recheck all other circuitry and connections many times
    over. If your like me you can sometimes make the silliest little obvious
    mistakes and miss them on first inspection.

    Paul Lugger


    _________________________________________________________________
    MSN Photos is the easiest way to share and print your photos:
    http://photos.msn.com/support/worldwide.aspx
  • ArchiverArchiver Posts: 46,084
    edited 2002-06-17 14:53
    --- In basicstamps@y..., "P L" <plugger02@h...> wrote:
    >
    >
    >
    > >From: "jive_star" <jive_star_1999@y...>
    > >Reply-To: basicstamps@y...
    > >To: basicstamps@y...
    > >Subject: [noparse][[/noparse]basicstamps] problems with SRF04 ultrasonic sensors
    > >Date: Sat, 15 Jun 2002 05:43:13 -0000
    > >
    > >Hey, first off I am pretty new to this software. I am building a
    > >self guided robot. I have a BS2 and am controling 4 rc motors with
    > >the stamp. I am using four SRF04 sensors to guide it. One sensor
    > >for each motor. Simple right? Well first using the pulsin pulsout
    > >commands, I only got two of the four sensors to work. The third
    did
    > >nothing, the fourth locked on high and kept its motor goin
    > >constant. So then I switched the pulsin with rctime like it said
    in
    > >the sensor booklet. That got the thrid one workin. Now I have
    > >three sensors working without a problem. As soon as I hook up the
    > >fourth it locks its motor on high. I have tried a bunch of things
    > >like switching pins on the stamp and software, adding delays still
    > >nothing. I have limited knowledge about this and was hoping
    someone
    > >could help. Thanks
    > >
    > >Ray
    > >
    > >
    >
    > I obviously don't know the exact setup you're working on. But since
    you can
    > get the other sensors to work, how about taking one of the working
    sensors
    > out of the ciorcuit and swapping it with the sensor which doesn't
    work? That
    > way you can test to see if the sensor working ok, or if it's
    somewhere else
    > down the line. Also recheck all other circuitry and connections
    many times
    > over. If your like me you can sometimes make the silliest little
    obvious
    > mistakes and miss them on first inspection.
    >
    > Paul Lugger
    >
    > Hey thanks for the help, but I am still having a problem. All the
    sensors function when hooked up individually. The circuit has been
    checked over. The system works perfect when 3 sensors are hooked
    up. As soon as the fourth sensor is connected it screws up. It
    sends a constant high to the motor. I am wondering if it might be a
    timing issue. Here is the code. I hope someone can help me out, its
    driving me crazy.

    '{$STAMP BS2}
    dr8 VAR DIR8
    dr9 VAR DIR9
    dr10 VAR DIR10
    dr11 VAR DIR11

    dr8=1
    dr9=1
    dr10=1
    dr11=1

    MotorA VAR OUT8
    MotorB VAR OUT9
    MotorC VAR OUT10
    MotorD VAR OUT11

    ADist var word
    BDist var word
    CDist var word
    DDist var word

    SonarAInit con 0
    SonarAEcho con 1
    SonarBInit con 2
    SonarBEcho con 3
    SonarCInit con 4
    SonarCEcho con 5
    SonarDInit con 6
    SonarDEcho con 7

    convfac con 74
    MinDist con 6

    CheckSonar:

    OneSonar:
    pulsout SonarAInit,5
    output SonarAInit
    rctime SonarAEcho,1,ADist
    ADist=ADist/convfac
    pause 10

    TwoSonar:
    pulsout SonarBInit,5
    output SonarBInit
    rctime SonarBEcho,1,BDist
    BDist=BDist/convfac
    pause 10

    ThreeSonar:
    pulsout SonarCInit,5
    output SonarCInit
    rctime SonarCEcho,1,CDist
    CDist=CDist/convfac
    pause 10
    FourSonar:
    pulsout SonarDInit,5
    output SonarDInit
    rctime SonarDEcho,1,DDist
    DDist=DDist/convfac
    pause 10


    IF ADist<MinDist THEN BackOne
    IF BDist<MinDist THEN BackTwo
    IF CDist<MinDist THEN BackThree
    IF DDist<MinDist THEN BackFour



    BackOne:
    MotorA=1
    MotorB=0
    MotorC=0
    MotorD=0
    GOTO CheckSonar


    BackTwo:
    MotorA=0
    MotorB=1
    MotorC=0
    MotorD=0
    GOTO CheckSonar
    BackThree:
    MotorA=0
    MotorB=0
    MotorC=1
    MotorD=0
    GOTO CheckSonar

    BackFour:
    MotorA=0
    MotorB=0
    MotorC=0
    MotorD=1
    GOTO CheckSonar





    > _________________________________________________________________
    > MSN Photos is the easiest way to share and print your photos:
    > http://photos.msn.com/support/worldwide.aspx
  • ArchiverArchiver Posts: 46,084
    edited 2002-06-17 15:27
    A long shot here. Do you have enough amperage to run all of the 4 sensors
    and the motors?
    -kerry

    At 01:53 PM 6/17/02 -0000, you wrote:
    >--- In basicstamps@y..., "P L" <plugger02@h...> wrote:
    >>
    >>
    >>
    >> >From: "jive_star" <jive_star_1999@y...>
    >> >Reply-To: basicstamps@y...
    >> >To: basicstamps@y...
    >> >Subject: [noparse][[/noparse]basicstamps] problems with SRF04 ultrasonic sensors
    >> >Date: Sat, 15 Jun 2002 05:43:13 -0000
    >> >
    >> >Hey, first off I am pretty new to this software. I am building a
    >> >self guided robot. I have a BS2 and am controling 4 rc motors with
    >> >the stamp. I am using four SRF04 sensors to guide it. One sensor
    >> >for each motor. Simple right? Well first using the pulsin pulsout
    >> >commands, I only got two of the four sensors to work. The third
    >did
    >> >nothing, the fourth locked on high and kept its motor goin
    >> >constant. So then I switched the pulsin with rctime like it said
    >in
    >> >the sensor booklet. That got the thrid one workin. Now I have
    >> >three sensors working without a problem. As soon as I hook up the
    >> >fourth it locks its motor on high. I have tried a bunch of things
    >> >like switching pins on the stamp and software, adding delays still
    >> >nothing. I have limited knowledge about this and was hoping
    >someone
    >> >could help. Thanks
    >> >
    >> >Ray
    >> >
    >> >
    >>
    >> I obviously don't know the exact setup you're working on. But since
    >you can
    >> get the other sensors to work, how about taking one of the working
    >sensors
    >> out of the ciorcuit and swapping it with the sensor which doesn't
    >work? That
    >> way you can test to see if the sensor working ok, or if it's
    >somewhere else
    >> down the line. Also recheck all other circuitry and connections
    >many times
    >> over. If your like me you can sometimes make the silliest little
    >obvious
    >> mistakes and miss them on first inspection.
    >>
    >> Paul Lugger
    >>
    >> Hey thanks for the help, but I am still having a problem. All the
    >sensors function when hooked up individually. The circuit has been
    >checked over. The system works perfect when 3 sensors are hooked
    >up. As soon as the fourth sensor is connected it screws up. It
    >sends a constant high to the motor. I am wondering if it might be a
    >timing issue. Here is the code. I hope someone can help me out, its
    >driving me crazy.
    >
    >'{$STAMP BS2}
    >dr8 VAR DIR8
    >dr9 VAR DIR9
    >dr10 VAR DIR10
    >dr11 VAR DIR11
    >
    >dr8=1
    >dr9=1
    >dr10=1
    >dr11=1
    >
    >MotorA VAR OUT8
    >MotorB VAR OUT9
    >MotorC VAR OUT10
    >MotorD VAR OUT11
    >
    >ADist var word
    >BDist var word
    >CDist var word
    >DDist var word
    >
    >SonarAInit con 0
    >SonarAEcho con 1
    >SonarBInit con 2
    >SonarBEcho con 3
    >SonarCInit con 4
    >SonarCEcho con 5
    >SonarDInit con 6
    >SonarDEcho con 7
    >
    >convfac con 74
    >MinDist con 6
    >
    >CheckSonar:
    >
    >OneSonar:
    > pulsout SonarAInit,5
    > output SonarAInit
    > rctime SonarAEcho,1,ADist
    > ADist=ADist/convfac
    > pause 10
    >
    >TwoSonar:
    > pulsout SonarBInit,5
    > output SonarBInit
    > rctime SonarBEcho,1,BDist
    > BDist=BDist/convfac
    > pause 10
    >
    >ThreeSonar:
    > pulsout SonarCInit,5
    > output SonarCInit
    > rctime SonarCEcho,1,CDist
    > CDist=CDist/convfac
    > pause 10
    >FourSonar:
    > pulsout SonarDInit,5
    > output SonarDInit
    > rctime SonarDEcho,1,DDist
    > DDist=DDist/convfac
    > pause 10
    >
    >
    > IF ADist<MinDist THEN BackOne
    > IF BDist<MinDist THEN BackTwo
    > IF CDist<MinDist THEN BackThree
    > IF DDist<MinDist THEN BackFour
    >
    >
    >
    >BackOne:
    > MotorA=1
    > MotorB=0
    > MotorC=0
    > MotorD=0
    > GOTO CheckSonar
    >
    >
    >BackTwo:
    > MotorA=0
    > MotorB=1
    > MotorC=0
    > MotorD=0
    > GOTO CheckSonar
    >BackThree:
    > MotorA=0
    > MotorB=0
    > MotorC=1
    > MotorD=0
    > GOTO CheckSonar
    >
    >BackFour:
    > MotorA=0
    > MotorB=0
    > MotorC=0
    > MotorD=1
    > GOTO CheckSonar
    >
    >
    >
    >
    >
    >> _________________________________________________________________
    >> MSN Photos is the easiest way to share and print your photos:
    >> http://photos.msn.com/support/worldwide.aspx
    >
    >
    >To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    >from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    >Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >

    Very respectfully, your obedient servant.
    Kerry
    Admin@M...
    WWW server hosting [url=Http://mntnweb.com]Http://mntnweb.com[/url]
    Kerry Barlow
    p.o. box 21
    kirkwood ny
    13795
    607-775-1132
  • ArchiverArchiver Posts: 46,084
    edited 2002-06-17 16:00
    Yes for the sensors I am using a 5v regulator. For the motors I am
    using four mosfet drivers.
    --- In basicstamps@y..., Kerry Barlow <admin@m...> wrote:
    > A long shot here. Do you have enough amperage to run all of the 4
    sensors
    > and the motors?
    > -kerry
    >
    > At 01:53 PM 6/17/02 -0000, you wrote:
    > >--- In basicstamps@y..., "P L" <plugger02@h...> wrote:
    > >>
    > >>
    > >>
    > >> >From: "jive_star" <jive_star_1999@y...>
    > >> >Reply-To: basicstamps@y...
    > >> >To: basicstamps@y...
    > >> >Subject: [noparse][[/noparse]basicstamps] problems with SRF04 ultrasonic sensors
    > >> >Date: Sat, 15 Jun 2002 05:43:13 -0000
    > >> >
    > >> >Hey, first off I am pretty new to this software. I am building
    a
    > >> >self guided robot. I have a BS2 and am controling 4 rc motors
    with
    > >> >the stamp. I am using four SRF04 sensors to guide it. One
    sensor
    > >> >for each motor. Simple right? Well first using the pulsin
    pulsout
    > >> >commands, I only got two of the four sensors to work. The
    third
    > >did
    > >> >nothing, the fourth locked on high and kept its motor goin
    > >> >constant. So then I switched the pulsin with rctime like it
    said
    > >in
    > >> >the sensor booklet. That got the thrid one workin. Now I have
    > >> >three sensors working without a problem. As soon as I hook up
    the
    > >> >fourth it locks its motor on high. I have tried a bunch of
    things
    > >> >like switching pins on the stamp and software, adding delays
    still
    > >> >nothing. I have limited knowledge about this and was hoping
    > >someone
    > >> >could help. Thanks
    > >> >
    > >> >Ray
    > >> >
    > >> >
    > >>
    > >> I obviously don't know the exact setup you're working on. But
    since
    > >you can
    > >> get the other sensors to work, how about taking one of the
    working
    > >sensors
    > >> out of the ciorcuit and swapping it with the sensor which
    doesn't
    > >work? That
    > >> way you can test to see if the sensor working ok, or if it's
    > >somewhere else
    > >> down the line. Also recheck all other circuitry and connections
    > >many times
    > >> over. If your like me you can sometimes make the silliest little
    > >obvious
    > >> mistakes and miss them on first inspection.
    > >>
    > >> Paul Lugger
    > >>
    > >> Hey thanks for the help, but I am still having a problem. All
    the
    > >sensors function when hooked up individually. The circuit has
    been
    > >checked over. The system works perfect when 3 sensors are hooked
    > >up. As soon as the fourth sensor is connected it screws up. It
    > >sends a constant high to the motor. I am wondering if it might be
    a
    > >timing issue. Here is the code. I hope someone can help me out,
    its
    > >driving me crazy.
    > >
    > >'{$STAMP BS2}
    > >dr8 VAR DIR8
    > >dr9 VAR DIR9
    > >dr10 VAR DIR10
    > >dr11 VAR DIR11
    > >
    > >dr8=1
    > >dr9=1
    > >dr10=1
    > >dr11=1
    > >
    > >MotorA VAR OUT8
    > >MotorB VAR OUT9
    > >MotorC VAR OUT10
    > >MotorD VAR OUT11
    > >
    > >ADist var word
    > >BDist var word
    > >CDist var word
    > >DDist var word
    > >
    > >SonarAInit con 0
    > >SonarAEcho con 1
    > >SonarBInit con 2
    > >SonarBEcho con 3
    > >SonarCInit con 4
    > >SonarCEcho con 5
    > >SonarDInit con 6
    > >SonarDEcho con 7
    > >
    > >convfac con 74
    > >MinDist con 6
    > >
    > >CheckSonar:
    > >
    > >OneSonar:
    > > pulsout SonarAInit,5
    > > output SonarAInit
    > > rctime SonarAEcho,1,ADist
    > > ADist=ADist/convfac
    > > pause 10
    > >
    > >TwoSonar:
    > > pulsout SonarBInit,5
    > > output SonarBInit
    > > rctime SonarBEcho,1,BDist
    > > BDist=BDist/convfac
    > > pause 10
    > >
    > >ThreeSonar:
    > > pulsout SonarCInit,5
    > > output SonarCInit
    > > rctime SonarCEcho,1,CDist
    > > CDist=CDist/convfac
    > > pause 10
    > >FourSonar:
    > > pulsout SonarDInit,5
    > > output SonarDInit
    > > rctime SonarDEcho,1,DDist
    > > DDist=DDist/convfac
    > > pause 10
    > >
    > >
    > > IF ADist<MinDist THEN BackOne
    > > IF BDist<MinDist THEN BackTwo
    > > IF CDist<MinDist THEN BackThree
    > > IF DDist<MinDist THEN BackFour
    > >
    > >
    > >
    > >BackOne:
    > > MotorA=1
    > > MotorB=0
    > > MotorC=0
    > > MotorD=0
    > > GOTO CheckSonar
    > >
    > >
    > >BackTwo:
    > > MotorA=0
    > > MotorB=1
    > > MotorC=0
    > > MotorD=0
    > > GOTO CheckSonar
    > >BackThree:
    > > MotorA=0
    > > MotorB=0
    > > MotorC=1
    > > MotorD=0
    > > GOTO CheckSonar
    > >
    > >BackFour:
    > > MotorA=0
    > > MotorB=0
    > > MotorC=0
    > > MotorD=1
    > > GOTO CheckSonar
    > >
    > >
    > >
    > >
    > >
    > >> _________________________________________________________________
    > >> MSN Photos is the easiest way to share and print your photos:
    > >> http://photos.msn.com/support/worldwide.aspx
    > >
    > >
    > >To UNSUBSCRIBE, just send mail to:
    > > basicstamps-unsubscribe@y...
    > >from the same email address that you subscribed. Text in the
    Subject and
    > Body of the message will be ignored.
    > >
    > >
    > >Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/
    > >
    > >
    > >
    >
    > Very respectfully, your obedient servant.
    > Kerry
    > Admin@M...
    > WWW server hosting [url=Http://mntnweb.com]Http://mntnweb.com[/url]
    > Kerry Barlow
    > p.o. box 21
    > kirkwood ny
    > 13795
    > 607-775-1132
Sign In or Register to comment.