Go Down

Topic: Change firmware of ultrasonic sensors (Read 1 time) previous topic - next topic

huliduino

Hello,

Have anybody tried or know if it is possible to change the firmware of the cheap ultrasnonic sensors (SRF04, HY-SRF05)?

I've found the SRF04 technical information http://www.robot-electronics.co.uk/htm/srf04tech.htm

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.

thank you.

joe mcd

I have this company's products which report multiple returns.  They are significantly more expensive.

http://www.maxbotix.com/

pylon

Quote
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.

huliduino


Maxbotix sensors are probably great but too expensive, I could replace cheap sensor 50 times instead of buying the expensive ones.

The sensors HAVE FIRMWARE! they use the  PIC12C508 chip, old firmware source code:

http://www.robot-electronics.co.uk/files/srf1.asm

and the PIC12C508 datasheet with programming details:

http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en010102



pylon

Quote
The sensors HAVE FIRMWARE! they use the  PIC12C508 chip, old firmware source code:


Take a look at the schematics of a HY-SRF05: http://patagoniatecnology.com.ar/images/HY-SRF05-SCHEMATIC.JPG

Which component is the PIC there?

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.

Maybe this article may be what you want: http://www.robot-electronics.co.uk/htm/srf04tech.htm

joe mcd

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.

Joe





AWOL

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.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Go Up