Shop OBEX P1 Docs P2 Docs Learn Events
Sonar — Parallax Forums

Sonar

Hi,
I have a Parallax acoustical distance measuring module that works fine for measuring short distances. My application requires detecting an object that is positioned anywhere from about 2 feet to 70 feet. I am wondering if it is possible or has it already be done to write code that can make the device act as an active sonar unit. It would generate a ping sound that would bounce back to the detector when an object is in the path. I was thinking of generating the ping then read the sensor for the response just after the ping leaves the sender. It is not necessary to know the distance. I use a BS2.

sincerely,

Discovery

Comments

  • What size and shape is the object you want to detect? Is it in an open space free of other "distractions?"

    -Phil
  • The object is a one-eight scale railroad train that can be a single car six feet long, 15 inches wide, and can vary from an engine height of about 20 inches to flat cars about 6 inches high. The idea is to place the ping device about 4 inches above the rail head looking down the track of about 70 feet.

    Sincerely,

    Discovery
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2020-06-05 02:22
    The Ping))) has an effective range of 2 cm. to 3 m. Without help, it'll never work at a 70 ft. (22 m.). Here's a very far-fetched scheme that might work. You will need two Ping)))s and a parabolic reflector. One Ping))) will be the transmitter; the other, the receiver. The transmit unit and the receive unit should have their active elements placed as close to the reflector's focal point as possible and pointed backwards into the dish. The receiver Ping))) must have a vinyl cup secured over its transmit transducer to block the signal and its immediate reflection from the dish.

    In operation, the transmit Ping))) will send a single ping. Shortly after that (>150 us.), the receive unit will send a ping. If it doesn't hear anything after, say, 18.5 ms. (the time for a ping to go out and back for 10 ft.), it will ping again -- up to about eight times, until it hears a response. Now, it's possible that a response could come back during the receive Ping)))'s dead time. So it will be necessary to vary the time between pings to avoid that possibility. IOW, it might take several cycles of a transmit ping, followed by eight or more receive pings to detect any reflection.

    The distance to the object will be proportional to the time elapsed between the transmit unit's single ping its reception by the receive unit.

    This is all predicated upon the supposition that the parabolic reflector will provide enough gain and focus to allow an echo from 70 ft. away to be detected. I have no idea how big such a reflector would have to be or even whether such a scheme can work reliably. Might be worth a try, though. There are plenty of junk Dish and DirecTV antennas lying about that you could salvage. If those aren't big enough, a snow saucer might work.

    Good luck!

    -Phil
  • I'm glad Phil discussed the possibility of using multiple Ping sensors working together. This had crossed my mind but I was sure Phil would be able to explain it better than I could.

    Here's a post from Phil back in 2010 discussing multiple Ping sensors to triangulate position. I think some of the principles from his earlier post apply here. I often think of Phil's earlier discussion of using multiple Ping sensors. I think his approach has a lot of possible applications.

    Would it be practical to put reflective tape on the train cars? It might be possible to use some sort of IR detection by using retro-reflector safety tape. The specialty reflecting tape can greatly increase the return signal from IR type distance sensors. Of course IR sensors have a hard time in direct (and even indirect) sunlight.

    There are certainly more expensive laser (IR laser) rangefinders which would likely work for the application you described. Unfortunately the laser range finders aren't in the same price bracket as Ping sensors.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2020-06-05 04:18
    One possible deal killer to my scheme is this: every time the receive unit sends another ping, its receive-gain profile starts all over. If the echo returns during a low-gain period, it probably won't be picked up.

    Perhaps a better strategy would be for the receive unit to send one ping, but delayed by increasing amounts over several transmit/receive trials. That way the sensitive part of the gain setting could be "positioned" at various distances until an echo is detected.

    Also, over that distance, the effects of a crosswind may not be negligible. Sound is carried by air molecules, and if the air molecules get blown aside, the ping might actually be blown off-target.

    -Phil
  • History. At the railroad track there is a condition for a runaway railroad car to exit the railroad yard, travel across a trestle and approach a diversion switch. Currently, I have a switch controller that requires the engineer to stop his/her train at a capture post. While at the capture post the wheels and axles place a short circuit across the two rails that form an insulated section of track that the controller monitors for a detection circuit. So, when the train is detected at the capture post and the engineer presses a button to pass through the switch a motor driven valve moves the switch points to allow the train to pass onto the main line. If on the other hand, a run away car approaches the switch the controller will detect a car in the block but since the capture button was not pressed the switch will not change position and the car will be diverted from entering the main line. If allowed to pass through the switch it picks up great speed and could do serious damage if it hits a person working on the track or hits another train. This configuration worked perfectly through the summer but when the May showers fell, the high impedance of the 60 ties in parallel brought the impedance down to about 15 k ohms and the controller would not release the switch thinking that there was another train or car in the detection block. So, rain defeats the process. I thought of using a light beam but every so often there is heavy fog at the track which would defeat the process. Whatever the mechanization is it must be very small and reside next to the track where, if there is a derailment, the mechanization is not damaged. Pressure switches were investigated but they require constant adjustment...not good. I am thinking of using proximity detectors or maybe trip micro switches to set then reset when cars pass. I need something that is fool proof and weather tolerant.

    Sincerely,

    Discovery
  • The simplest solution to your problem is to go back to the rail-to-rail detection, but increase the current which must flow for detection to occur. I believe the similar sensor schemes used by full size railroads require enough current to actuate a solenoid. Install a mechanical relay or opto-isolator so that the coil or LED must be powered on through the current that flows between the tracks, then use its output to trigger the computer. That will stop the rain problem cold.
  • I solved the problem by manufacturing switches that detect wheels at the front end of the detection track and at the trailing end of the detection track. The pulses coming from these switches are processed by the BS2 program to control the switch points. QED

    Discovery
  • Late to the idea party again! But poosible to use a hall effect sensor and magnet that can sense the presence of a steel wheel. Good coat of coating for weatherproofing. Or use a coil in the trackbed similar to traffic light car sensors. Work all weather.
  • Thanks Frank,

    I thought of using a metal detector concept with the sending and receiving coils wound on a plastic sheet and three of these metal detectors mounted on three ties at the appropriate locations. I may ultimately do that but it takes some design and testing in the shop before I am confident it will work. The Hall effect devices also pose a good solution. I plan on building a test fixture that I can take to the track and perform on site testing.

    Thanks Frank,

    Discovery
  • The wheels on the axles range in diameters from 4" to 10" and about 3/4" wide. The wheels run on aluminum rail heads of about 1/2" wide with a base of 1" and height of 1" where the rail is screwed to the ties. The axles are made of steel ranging from 1/2" up to 1 1/4" diameter. Some cars are made with lots of steel and others are made mostly of wood...just depends on the builder. Measurement time must be rather quick since a runaway car can reach a speed of about 15 mph by the time it reaches the detection block.

    Discovery
  • This caught my eye because it reminded me of a project a friend did in the late 70s. Seems there was an issue at NIT coal terminal where the cars would go two at a time up a ramp and onto the dumper. The cars would then be released down the exit ramp, up another ramp and a switch selected the exit track and the cars roll on out. Until they didn't. The exit process was gravity driven and if the cars decoupled, one would have had enough of a head start that it would be heading down the ramp about the time the second car would be arriving at the ramp. Time to call the crane to pick up the pieces. Solution was decoupling detection to lock the second car at the dumper exit until first car cleared the switch. Then release second car. He used a RS CoCo computer for the project.
  • That is interesting.

    The electrical contact switches that I made were cast molded to the shape of the rail web as an engineering plastic and bolted to the aluminum rail. then a brass strip was bolted to the insulating plastic spaced very close to the aluminum rail at a position where the wheel flange (no matter what diameter wheel) will make contact with both the rail head and the brass strip. When the flange touches both the rail and the brass strip, this sends a contact closure signal to the BS2. Just to make certain that rain will not cause a problem with this implementation, I tested the resistance of tap water and found that it is around 500 meg ohms. If water puddles between the rail and the brass...which it shouldn't since the brass strip is mounted on the vertical surface of the insulator...the circuit will continue to work fine.

    Discovery
Sign In or Register to comment.