I would like to send a signal from one HC-SR04 and receive it on a second HC-SR04. I tried to write this program but it always prints 0 cm. The code is the same as we would use for an echo ping. The only difference is that I trigger the trigger pin on the first HC-SR04 and listen on the echo pin on the second HC-SR04.
I think that this might be the problem:
RiGonz:
... it seems to me that the receiver needs the activation done by the emitter sending the ping, on the same module: ...
There was a suitcase tracking thing, where the first micro triggered its ultrasonic to send, AND using xbee or something, wirelessly triggered the other end to listen.
Article is dated january 14. I buy some units on Ebay (1$/€ per unit) Feb 2015 there is always the same "cut and paste" : filter is always centered to 20 kHz.
I have not succeeded to discover the micro program, I do not know what he does.
Micro does not directly manage the length of the burst. The burst is not controlled by timers but by powering on/off the Max232.
This can not work properly: the charge pumps that generates the + 10V and -10V can not be activate in a such short "ON" time.
I checked with an oscilloscope: the output level of the Max232 is effectively only 0 / + 5V -> it is useless.
If we add the loss of gain due of the filter mis-centered at 20kHz and the output level of 0 / + 5V instead of -10V/-10V, total loss of gain is about 40 20 dB , in pure number attenuation of 100 10 !
The amplifier used has an average Ft of only 700kHz . With a gain of 10, bandwidth will be only 70 kHz. Do not forget that the bandwidth is defined as the frequency which corresponds to a gain divided by 2!
With 4 cascaded amplifiers, bandwidth of the whole chain is less than 40 kHz !
As the LM324 is not rail-to-rail, last stage of LM324 associated with transistor Q1 is used to make a pseudo open collector comparator.
The schematic is very unstable and enter too easily into self-oscillation .
Nevertheless,we must recognize that this moduleworks. But change nothing, otherwise nothing will work.
If doing some electronics do not put you off, you would have interest to make a board with an atmega328 (like nano or mini-pro), amplifiers with 3 Mhz Ft like TL082N (10 for few $/€ on Ebay) and use a real comparator (like LM393) to interface with the micro.
US microphone can be directly controlled with an ATmega328P.
Here a link to do a burst à 40 38 kHz:
Modulating a 38 kHz carrier with a 500 Hz signal