Shop OBEX P1 Docs P2 Docs Learn Events
Inconsistent readings with devantech SRF04 ultrasonic rangefinder — Parallax Forums

Inconsistent readings with devantech SRF04 ultrasonic rangefinder

WhelzornWhelzorn Posts: 256
edited 2004-09-06 00:51 in BASIC Stamp
I am using a devantech SRF04 ultrasonic rangefinderwith a BS2 and using the source code found on the products page ( http://www.parallax.com/detail.asp?product_id=28015 ) and am getting very inconsistent readings. I will aim the sensor at my wall, and first get 34.4, which is correct, but when the next cycle is performed, the reading is 59.6, and it will go back to 34.4 on the next reading then to 29.3 (these are inches BTW). Anyway, I was wondering if anyone else has had the same problem, or knows what I can try to fix it.
Thanks,
Justin

Comments

  • NewzedNewzed Posts: 2,503
    edited 2004-08-12 15:43
    Try elevating the range finder.· I had the same problem with it picking upechoes from the desk. I suspend it in midair and the readings are consistent.· The solution - put a PVC pipe around the receiver element so only receives from dead-ahead.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    USB-powered Stamp Board

    http://hometown.aol.com/newzed/index.html
    ·
  • WhelzornWhelzorn Posts: 256
    edited 2004-08-13 02:18
    well, I tried lifting it off the desk, no use. I will try and get some PVC so I can try the second idea, but I did try using a cardboard tube, but I think it was picking up echoes from inside the tube. Thanks for the suggestions
  • cabojoecabojoe Posts: 72
    edited 2004-08-13 03:19
    I use two SRF08 rangefinders on my bot,same as the 04 but I2C interface, never had to put anything around them. You have to realize that they·sense in·a cone shape pattern, not just straight ahead. Think of how your car's headlights look on the road in front of you...same deal. The lights spread out more the further they are away from you. I'd have to look it up, but I think it's like a 30 degree cone in all directions. My 08's are 6 inches off the deck, with a very slight tilt down, and works like a charm, with no tubes, but I am only interested in anything that gets closer than 10 inches. To test, I found the best thing to do is point it straight up to the ceiling.·I suppose if you are trying to range a spot on a wall over two feet or more away then the pvc could help. Good luck.

    Post Edited (cabojoe) : 8/13/2004 3:26:32 AM GMT
  • Dave_hDave_h Posts: 4
    edited 2004-08-13 04:05
    I had a very similiar problem on my SRF04. One of the mounting holes, in the PCB, was to close to the aluminum shroud around the sensors. When I mounted it, the screw would come in contact with that shroud and mess up the readings. Once I removed that screw the readings all came out accurate. I've since reamed that hole in the PCB slightly and haven't had any problems with it.
  • WhelzornWhelzorn Posts: 256
    edited 2004-08-13 04:10
    I may have got it... there is a bad solder joint further down in the circuit... I'll fix it tomorrow and then try...
  • Gwyan RhabytGwyan Rhabyt Posts: 4
    edited 2004-09-05 05:14
    I'm also have erratic readings from my SRF04. But mine was working fine for a while and then when I rearranged the circuit it reads 0 for the distance. I've checked the signals to the SRF04 board but not on the board. I went back to the original circuit (the one from the parallax pdf) but it still doesn't work. Could I have fried some part of it?

    Thanks,

    - Gwyan
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-09-05 15:12
    It's not likely, but it could have happened. I've found that it's best to use P0 (echo in) and P1 (trigger) with the SRF-04 when using a stock BS2, BS2e, or BS2pe; using other pins don't always give the best results because these modules take a bit longer to setup for PULSIN and the echo may arrive before it's ready. This problem doesn't show up with the BS2sx or BS2p because they're much faster.

    I prefer the SRF-08 I2C version. It takes a bit more code, but still just uses two pins that can be shared with other I2C devices (including more SRF-08 sensors).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • Gwyan RhabytGwyan Rhabyt Posts: 4
    edited 2004-09-05 17:53
    I found the problem.
    Following a lead on a European microcontroller formum that said that "not all I/O channels are created equal" on the BS2, I tried a variety of pins. 0 and 1 didn't work, 3 and 4 didn't work but 15 and 16 did work, as did 13 and 14. I haven't had time to do a systematic test but I did confirm that pins 0 to 4 can still turn an LED on and off and get readings from a digital thermometer, so the pins are OK for most stuff, they just can't talk to the SRF04 in the right way.
    I also am interested in the SRF08, though Erik Wood at Parallax said they weren't planning on carrying it.
    Thanks
    - Gwyan
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-09-06 00:51
    You can get the SRF-08 from our friends at Acroname (http://www.acroname.com). That's where I bought mine.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
Sign In or Register to comment.