In the photography is the "Ultrasonic HC-SR04 distance measuring transducer sensor".
"HC-SR04 consists of ultrasonic transmitter, receiver, and control circuit. When triggered it sends out a series of 40KHz ultrasonic pulses and receives echo from an object. Power supply: 5V DC; quiescent current: less than 2mA; effectual angle: less than 15°; distance: 2cm - 500cm."
The sensor is 1.75 inches/ 4.45 cm by 0.75 inches/ 1.9 cm. The IC on the bottom left is an LM324 quad op amp. The two on the right are not marked.

// The sensor is triggered by a HIGH pulse of 10 or more microseconds. Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
// Read the signal from the sensor: a HIGH pulse whose duration is the time (in microseconds) from the sending of the ping to the reception of its echo off of an object.
The photography shows the trigger pulse in blue and the signal from the sensor in yellow bracketed by the white cursors. In the lower right is the width of the pulse: 24.4 ms from a object at 16 inches/ 40.6 cm from the sensor.

// Convert the time into a distance - long way for clarity
So for 2440 us/2 = 1220/74 = 16.48 inches or 1220/29.1 = 41.9 cm

"HC-SR04 consists of ultrasonic transmitter, receiver, and control circuit. When triggered it sends out a series of 40KHz ultrasonic pulses and receives echo from an object. Power supply: 5V DC; quiescent current: less than 2mA; effectual angle: less than 15°; distance: 2cm - 500cm."
The sensor is 1.75 inches/ 4.45 cm by 0.75 inches/ 1.9 cm. The IC on the bottom left is an LM324 quad op amp. The two on the right are not marked.

// The sensor is triggered by a HIGH pulse of 10 or more microseconds. Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
- digitalWrite(iTrigPin, LOW); //pin 12 Out
- delayMicroseconds(5);
- digitalWrite(iTrigPin, HIGH);
- delayMicroseconds(12);
- digitalWrite(iTrigPin, LOW);
// Read the signal from the sensor: a HIGH pulse whose duration is the time (in microseconds) from the sending of the ping to the reception of its echo off of an object.
- pinMode(iEchoPin, INPUT); //pin 13 In
- lDuration = pulseIn(iEchoPin, HIGH);
The photography shows the trigger pulse in blue and the signal from the sensor in yellow bracketed by the white cursors. In the lower right is the width of the pulse: 24.4 ms from a object at 16 inches/ 40.6 cm from the sensor.

// Convert the time into a distance - long way for clarity
- lCM = (lDuration/2) / 29.1; // Divide by 29.1 or multiply by 0.0343
- lInches = (lDuration/2) / 74; // Divide by 74 or multiply by 0.0135
So for 2440 us/2 = 1220/74 = 16.48 inches or 1220/29.1 = 41.9 cm

Last edited by a moderator:
