Communication Between Two Ping Sensors
stone
Posts: 3
Hello All,
I'm new to the forum, here with a question about the Ping ultrasonic sensors. I'm attempting to make a prototype for an ultrasonic pager of sorts. The device will broadcast a simple ultrasonic signal after a button press. When not broadcasting, it will listen for incoming signals and produce light and vibration when a signal is received.
As a cheap proof-of-concept model, I've been attempting to coerce two ultrasonic rangefinder modules to talk to each other. In planning it seems to be a relatively simple operation, as the units are both transmitters and receivers and I expected those separate functions to be individually accessible. I began with HC-SR04 modules and couldn't elicit the behavior I anticipated, so I also acquired some Ping sensors and attempted the same procedure.
My tests with both sensor models began with simply taking the rangefinder code and disabling the transmission element of the loop. I uploaded this to one unit (Unit 1 for nomenclature's sake). I then utilized a second sensor (Unit 2) running the full rangefinder code and pointed it directly at Unit 1. I anticipated that I would see some sort of distances being calculated on the receiving unit, but I consistently get a "0in, 0cm" reading from the standard code. Since this correlates to a duration using pulsein and subsequently a high on the control pin (pin 7 in this case), I simplified the code to manually poll the pin status with digitalRead and still found no response from Unit 1. It seems that no matter how I try to find observable transmission, I see no pin high on the control pin of Unit 1.
I'm learning as I go along here, so at first I investigated the potential of frequency mismatch due to tolerances within the transducers, but I ruled that out as literature seems to allude to acceptably wide bands of frequency response for this sort of transducer.
Another potential pitfall I considered is the timing of the signal and echo pulses, but according to the Ping datasheet the signal pulse is 200us and the minimum echo pulse is 115us, which should work out.
The biggest question I have is how the Ping's onboard timing circuit functions, as I don't know much about how a circuit like that would work. The datasheet spec's a 750us echo delay time, which maybe alludes to my problem, but I believe that in theory if Unit 1 is constantly polling the control pin it should read a high regardless of delay timing. Could it be the case that the Ping sensor isn't prepared to read an echo without first transmitting a signal? That would seem to be a potential cause, one that may be solved by circumventing the use of the pre-made ping sensor and going straight to a custom circuit controlling transducers.
Does anyone have any thoughts on the question in bold above or any way to make Ping sensors communicate with one another? I'm preparing to move on to a more specifically designed solution but it would be nice to have this proof-of-concept model function just for demonstrations sake. I can provide code if necessary but it is for the most part so simple I figured I would omit it for now.
Just as a note, I've done a great deal of searching online for similar projects but found little that actually outlined functional solutions. I've also search forums, including this one, and didn't come up with much, but if anyone has prior art in mind I'd be very happy to give it a read.
Many thanks in advance for any advice! I also apologize for any blatant ignorance, I'm coming from the world of mechanical engineering and I still have ample learning to do in this discipline.
I'm new to the forum, here with a question about the Ping ultrasonic sensors. I'm attempting to make a prototype for an ultrasonic pager of sorts. The device will broadcast a simple ultrasonic signal after a button press. When not broadcasting, it will listen for incoming signals and produce light and vibration when a signal is received.
As a cheap proof-of-concept model, I've been attempting to coerce two ultrasonic rangefinder modules to talk to each other. In planning it seems to be a relatively simple operation, as the units are both transmitters and receivers and I expected those separate functions to be individually accessible. I began with HC-SR04 modules and couldn't elicit the behavior I anticipated, so I also acquired some Ping sensors and attempted the same procedure.
My tests with both sensor models began with simply taking the rangefinder code and disabling the transmission element of the loop. I uploaded this to one unit (Unit 1 for nomenclature's sake). I then utilized a second sensor (Unit 2) running the full rangefinder code and pointed it directly at Unit 1. I anticipated that I would see some sort of distances being calculated on the receiving unit, but I consistently get a "0in, 0cm" reading from the standard code. Since this correlates to a duration using pulsein and subsequently a high on the control pin (pin 7 in this case), I simplified the code to manually poll the pin status with digitalRead and still found no response from Unit 1. It seems that no matter how I try to find observable transmission, I see no pin high on the control pin of Unit 1.
I'm learning as I go along here, so at first I investigated the potential of frequency mismatch due to tolerances within the transducers, but I ruled that out as literature seems to allude to acceptably wide bands of frequency response for this sort of transducer.
Another potential pitfall I considered is the timing of the signal and echo pulses, but according to the Ping datasheet the signal pulse is 200us and the minimum echo pulse is 115us, which should work out.
The biggest question I have is how the Ping's onboard timing circuit functions, as I don't know much about how a circuit like that would work. The datasheet spec's a 750us echo delay time, which maybe alludes to my problem, but I believe that in theory if Unit 1 is constantly polling the control pin it should read a high regardless of delay timing. Could it be the case that the Ping sensor isn't prepared to read an echo without first transmitting a signal? That would seem to be a potential cause, one that may be solved by circumventing the use of the pre-made ping sensor and going straight to a custom circuit controlling transducers.
Does anyone have any thoughts on the question in bold above or any way to make Ping sensors communicate with one another? I'm preparing to move on to a more specifically designed solution but it would be nice to have this proof-of-concept model function just for demonstrations sake. I can provide code if necessary but it is for the most part so simple I figured I would omit it for now.
Just as a note, I've done a great deal of searching online for similar projects but found little that actually outlined functional solutions. I've also search forums, including this one, and didn't come up with much, but if anyone has prior art in mind I'd be very happy to give it a read.
Many thanks in advance for any advice! I also apologize for any blatant ignorance, I'm coming from the world of mechanical engineering and I still have ample learning to do in this discipline.
Comments
As far as I can tell, there is nothing in the code that acts as a time out. This is the code I'm using as a foundation:
I've disabled the section of code that triggers the Ping module, so the loop is just looking for pin 7 to get pulled high and then counting the duration. I've also polled the pin directly and constantly looking for a high and found none, so there should be no issue with timing out in the code. This seems to allude to the fact that the ping module itself is not returning a high value when it receives a signal from other unit, and goes back to my suspicion that it only listens once it has emitted a signal.
I think I may have just confirmed this by covering the transmitting transducer on one Ping module while pointing it directly at another module with rangefinder code operating on both. I can get both modules to read a similar distance with that transducer covered up, so it seems that the Ping will receive the signal of its counterpart only after sending its own signal (which is now conveniently blocked by my finger).
I'm picking up transducers to build my own control circuit that I can operate via arduino. I'll update as I go along if anyone is interested.
This is exactly the case. The PING))) doesn't become ready to receive until it has been triggered and sent its own pulse out. I believe I did read a post here some time ago from someone who hacked two PING))) sensors to remove the transmit tranducer from one and the receive transducer from the other in order to do something similar, but remember the PING))) also times out without a window corresponding to the maximum echo time it can receive.
a) Make blanking caps to cover one of the PING ultrasonic sensors. I used a 19mm irrigation end cap filled with cotton wool.
b) For the transmit PING cover the left-hand (looking at the sensors) transmitter sensor.
c) For the receiving PINGs cover the right hand (looking at the sensor) receiver sensor.
c) Pulse all the PINGs. Only the transmit PING will send out a signal - the receive PINGs are blanked. However, the receive PINGs will start their receive cycle.
d) Read all the receive PINGs and you will have the distance for each receive PING from the transmit PING.
e) In this way you can triangulate the position of the transmit PING if you know the co-ordinates of the receive PINGs.
Phil did a good write up on this technique a couple of years ago.:
http://forums.parallax.com/showthread.php/134899-Triangulation-with-a-Ping)))-Array?highlight=Ping
The SR04 has a separate send and receive lines.
There is a driver for the SR04 in the propforth download
http://propforth.googlecode.com/files/PropForth-V5.5-20130317.zip
in the extesnsions subdirectory at
Propforth/V5.5/CurrentRelease/Extensions / SR04.f
that looks like one could simply comment out the send section, and it would listen. You might have to set the reviece line high (instead of sending and setting it high).
I haven't tried this yet, but I do have a Ping and many SR04; it might be time to give this a shot.
This is in FORTH, but it should be straight forward enough to glean whats going on.