I would like to implement auto-calibration measuring the time of flight to a known distance. For example using a calibration tube of a fixed known length to produce an echo when the sound goes out of the tube. I need to know the time of the first and second echo not only the first as many sensors do. Also it would be interesting to try to detect the echo from the biggest object.
Have anybody tried or know if it is possible to change the firmware of the cheap ultrasnonic sensors (SRF04, HY-SRF05)?
These simple sensors don't have any firmware they are just the hardware necessary to send and receive ultrasonic signals. If you want to calibrate these, just do it in your Arduino sketch.
Some of the SRF04 modules seem to have such a PIC but they are not prepared for an operation like to exchange the firmware. If you want to do that you're probably better helped in a PIC forum.
This conversation has stimulated my hacking instinct. So I went to the closet, fetched and dusted off my official hacker benie (top propeller included).
Here are my preliminary findings:
The PIC firmware does 3 things.
(1) generate 40KHz ping - no change needed
(2) setup return detection - no change needed
(3) report leading edge of 1st return ONLY - we would like to see other returns
My conclusion is not to change the PIC but rather to breakout the raw return echo. This turns out to be quite simple. Please examine the file 'HY-SRF05-Sonar-Annotated.jpg'. Note that the raw echo return is taken off the Collector of Q2. In 'HC-SR04-PingAtNPN-xtraWire.JPG' I have soldered to Q2. The SR04 and SRF05 have nearly identical circuits.
Next we examine the oscilloscope traces of the Q2 signal 'HC-SR04-PingAtNPN-1target.JPG' and
'HC-SR04-PingAtNPN-2targets.JPG' When 2 objects are present we can easily see both echos. The PIC firmware simply ignores everything after the 1st echo.
By feeding the raw output to my Arduino, I should be able to see both objects. Note that existing code & libraries will not work. They use either pulseIn() or Timer2. Both are bad ideas. I connect the return to pin 2 (Uno) and use attachInterrupt(). The micros() value converts to the distance. I should be able to extend this to 2 or more targets.
I tried to attach the code but the forum only allows uploading 4 files. I invite additional comments and criticism.
The Devantech devices are usually controlled by PICs.
Gerald Coe, the designer, used to publish the assembler sources, so with these useful Google search terms, you may get lucky.
I realise that the last replies have been posted 6 years ago but i'm going to be hopeful that someone replies, as this is excatly what i am trying to achieve.
@joemcder could you explain to me, or point me to some resources that would, how you knew that the raw echo signal could been fed off Q2? Also would this signal be the same as for example the analog voltage signal seen in the maxbotic MB1300: MB1300 XL-MaxSonar-AE0 – MaxBotix ?
How would i know looking at the 'sfr08schematic.gif' where to feed off, to get the same raw echo signal data?