Bird
0
0
Arduinoprogramming~5 mins

Ultrasonic distance sensor (HC-SR04) in Arduino - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of the HC-SR04 ultrasonic distance sensor?
The HC-SR04 sensor measures the distance to an object by sending ultrasonic sound waves and calculating the time it takes for the echo to return.
Click to reveal answer
beginner
Which two pins on the HC-SR04 sensor are used to trigger and receive the ultrasonic pulse?
The 'Trig' pin sends the ultrasonic pulse, and the 'Echo' pin receives the reflected pulse to measure distance.
Click to reveal answer
intermediate
How do you calculate distance from the duration of the echo pulse in Arduino code?
Distance (cm) = (duration of echo pulse in microseconds) / 58. This formula converts the time into centimeters.
Click to reveal answer
beginner
What Arduino function is used to measure the duration of the echo pulse?
The function 'pulseIn()' measures the time in microseconds that the echo pin stays HIGH, representing the echo duration.
Click to reveal answer
intermediate
Why do we need to set the Trig pin LOW before sending a HIGH pulse?
Setting the Trig pin LOW first ensures a clean HIGH pulse of 10 microseconds, which triggers the sensor correctly without noise.
Click to reveal answer
What is the typical duration of the HIGH pulse sent to the Trig pin to start a measurement?
A10 microseconds
B1 millisecond
C100 microseconds
D1 second
Which Arduino function reads the time the Echo pin stays HIGH?
ApulseIn()
BdigitalRead()
CanalogRead()
Ddelay()
If the echo duration is 1160 microseconds, what is the approximate distance in centimeters?
A100 cm
B58 cm
C10 cm
D20 cm
What does the Echo pin output when no object is detected within range?
AConstant HIGH
BRandom HIGH and LOW
CConstant LOW
DPulses at 1 kHz
Why is it important to wait some milliseconds between measurements?
ATo avoid sensor overheating
BTo allow the echo pulse to finish and avoid interference
CTo save battery power
DTo reset the Arduino
Explain how the HC-SR04 sensor measures distance step-by-step.
Think about sending a sound wave and timing its return.
You got /5 concepts.
    Describe how you would connect and program the HC-SR04 sensor with an Arduino to measure distance.
    Focus on wiring and the main code steps.
    You got /5 concepts.