# Arduino HCSR04 Crack Measuring

Joined Dec 18, 2014
84
Hi all,
I used to detect the small crack on wall using HCSR04 Ultrasound sensor,
But i cant sense the crack , i only getting the Distance, how can i sense the crack separately

Regards,

#### DickCappels

Joined Aug 21, 2008
6,532
Not sure I understand exactly what you mean by "crack" (Crack in what material and what item, dimensions, etc.) and by "detect".

If you are finding the distance from the transducers to the crack, isn't that sensing it? <== Clearly, I don't understand the setup.

Joined Dec 18, 2014
84
Not sure I understand exactly what you mean by "crack" (Crack in what material and what item, dimensions, etc.) and by "detect".

If you are finding the distance from the transducers to the crack, isn't that sensing it? <== Clearly, I don't understand the setup.
Hi Sir,
Actually am doing a Rail Ultrasonic Flaw Detection System, but the flaw is not traced by the sensor, only the actual distance is getting....

#### Alec_t

Joined Sep 17, 2013
11,504
What 'distance' are you talking about?
Post a sketch of your setup, to clarify what you're doing.

Joined Dec 18, 2014
84
What 'distance' are you talking about?
Post a sketch of your setup, to clarify what you're doing.

#### ScottWang

Joined Aug 23, 2012
6,926
You could try this first, if it doesn't work then you have to turn the direction of transmitters and receiver as cone

Source of picture.

#### spinnaker

Joined Oct 29, 2009
7,835
If I had to guess, the HCSR04 does not have the sensitivity to detect such a narrow change in distance.

#### ScottWang

Joined Aug 23, 2012
6,926
If I had to guess, the HCSR04 does not have the sensitivity to detect such a narrow change in distance.
HC-SR04 Ultrasonic Module:
The Ultrasonic module detects the distance of the closest object in front of the sensor (from 2 cm up to 400cm).

Since the TS has such request, so he got to rty it.

#### ErnieM

Joined Apr 24, 2011
8,053
It is doubtful that sensor can find a small crack in a wall. First you need to ping with a wavelength short enough to see the crack. Then the receiver mus be able to see that return echo as you now need to see two echos, fist from the start of the crack, and the next from the end of the crack. That receiver can only sense one return ping for each burst so it is unsuitable without modification.

If you have an oscilloscope you can probe the analog receive signal to see if there is anything you could possibly capture to detect the crack. You may have multiple echos as the signal bounces off the crack several times.

#### jpanhalt

Joined Jan 18, 2008
10,068
My guess is the author wants to detect the discontinuity in the metal rail. Ultrasonic testing is used for such purposes in non-destructive (maybe pre-destruction?) testing of aircraft and other things. Here's a general description: https://en.wikipedia.org/wiki/Ultrasonic_testing

Don't know if the particular device the OP has will do that type of testing though.

John

#### Alec_t

Joined Sep 17, 2013
11,504
The wavelength of the 40kHz ultrasound is ~0.85cm in air, so I doubt such a low frequency would be able to detect a crack unless its width were about that distance. A cracked rail would be highly dangerous long before the crack reached that size. Even to sense a crack 0.85cm wide, I think you would need the transducer(s) in contact with the rail, not >2cm from it. Also, I think you might have to sense the phase of an echo signal, which the HCSR04 may or may not do.

#### John P

Joined Oct 14, 2008
1,816
This seems like a woeful misapplication of technology. An ultrasonic rangefinder operates at 40 KHz or so, but ultrasonic testing of solids uses frequencies into the megaHertz range, and requires contact with the material being tested. The WIkipedia article says "In most common UT [Ultrasonic Testing] applications, very short ultrasonic pulse-waves with center frequencies ranging from 0.1-15 MHz, and occasionally up to 50 MHz, are transmitted into materials to detect internal flaws or to characterize materials." A rangefinder will tell you how far it is from the sample, and that's all.

Joined Dec 18, 2014
84
Yesterday i tried the testing as the image shows ,
i placed the end very close to the track and found that a high value (am measuring the distance in cm), when the Flaw found.
Is this correct.....

#### ScottWang

Joined Aug 23, 2012
6,926
You have to comparing the values of flat wall and flaw wall, if the flaw is too small, I don't think it will works properly, because the distance of two components are too far.

Joined Dec 18, 2014
84
You have to comparing the values of flat wall and flaw wall, if the flaw is too small, I don't think it will works properly, because the distance of two components are too far.

View attachment 100805
Ok sir,

is this will miss behave because of this cone shape ?
i will try it and revert back to u sir

#### mkbutan

Joined Sep 30, 2008
277
Hi dear all,
The Ultrasonic ranging module HC - SR04 provides 2cm - 400cm non-contact measurement function, the ranging accuracy can reach to 3mm (i.e. 0.3 cm)
Using IO trigger for at least 10us high level signal,
The Module automatically sends eight 40 kHz and detect whether there is a pulse signal back...
Electric Parameter
Working Voltage-----------------------DC 5 V
Working Current-----------------------15mA
Working Frequency-------------------40Hz

Max Range------------------------------4m
Min Range------------------------------2cm
Measuring Angle----------------------15 degree
Trigger Input Signal------------------10uS TTL pulse

Echo Output Signal Input-----------TTL lever signal and the range in proportion
the main thing is your Moving Speed the Stationary parameters is (as per the datasheet) is 10μs ( Trigger Input Signal------------------10uS TTL pulse ) and that to at an Angel of 15°
so now you have to adjust your Speed to DETECT the CRACK in the RAIL
I thing that should solve the problem

Last edited:

#### ScottWang

Joined Aug 23, 2012
6,926
Ok sir,

is this will miss behave because of this cone shape ?
i will try it and revert back to u sir
If this method didn't works then you have to adjust the angles of two pipes, when you try it at many angles, but it still didn't works as your wish then you need to take the transmitter and receiver away from the pcb and put their direction as cone, you have to make sure they have a small angles maybe 10~20° between them, you need to adjust the angle to check which angle has the best effective.

Joined Dec 18, 2014
84
I will check this sir

Joined Dec 18, 2014
84
Hi dear all,
The Ultrasonic ranging module HC - SR04 provides 2cm - 400cm non-contact measurement function, the ranging accuracy can reach to 3mm (i.e. 0.3 cm)
Using IO trigger for at least 10us high level signal,
The Module automatically sends eight 40 kHz and detect whether there is a pulse signal back...

the main thing is your Moving Speed the Stationary parameters is (as per the datasheet) is 10μs ( Trigger Input Signal------------------10uS TTL pulse ) and that to at an Angel of 15°
so now you have to adjust your Speed to DETECT the CRACK in the RAIL

I thing that should solve the problem
Sir,
This is the code actually am using

C:
/*
HC-SR04 Ping distance sensor]
VCC to arduino 5v GND to arduino GND
Echo to Arduino pin 13 Trig to Arduino pin 12
Red POS to Arduino pin 11
Green POS to Arduino pin 10
560 ohm resistor to both LED NEG and GRD power rail
Original code improvements to the Ping sketch sourced from Trollmaker.com
Some code and wiring inspired by [URL]http://en.wikiversity.org/wiki/User:Dstaub/robotcar[/URL]
*/

#define trigPin 13
#define echoPin 12
#define led 11
#define led2 10

void setup() {
Serial.begin (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(led, OUTPUT);
pinMode(led2, OUTPUT);
}

void loop() {
long duration, distance;
digitalWrite(trigPin, LOW);  // Added this line
digitalWrite(trigPin, HIGH);
//  delayMicroseconds(1000); - Removed this line
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;
if (distance < 4) {  // This is where the LED On/Off happens
digitalWrite(led,HIGH); // When the Red condition is met, the Green LED should turn off
digitalWrite(led2,LOW);
}
else {
digitalWrite(led,LOW);
digitalWrite(led2,HIGH);
}
if (distance >= 200 || distance <= 0){
Serial.println("Out of range");
}
else {
Serial.print(distance);
Serial.println(" cm");
}
delay(500);
}
Mod edit: Please use CODE tags - available on the post edit toolbar as Insert->Code Tags

Last edited by a moderator: