Pages: [1]   Go Down
Author Topic: Change firmware of ultrasonic sensors  (Read 699 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Sr. Member
****
Karma: 6
Posts: 383
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

http://www.maxbotix.com/
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 96
Posts: 4702
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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


Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 96
Posts: 4702
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Sr. Member
****
Karma: 6
Posts: 383
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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






* HC-SR04-PingAtNPN-1target.JPG (84.44 KB, 600x494 - viewed 24 times.)

* HC-SR04-PingAtNPN-2targets.JPG (84.86 KB, 521x518 - viewed 37 times.)

* HC-SR04-PingAtNPN-xtraWire.JPG (307.41 KB, 1394x1046 - viewed 60 times.)

* HY-SRF05-Sonar-Annotated.jpg (144.2 KB, 762x755 - viewed 98 times.)
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 239
Posts: 24371
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

Pages: [1]   Go Up
Jump to: