Arduino Module: Ultrasonic Module

Arduino Module: Ultrasonic ModuleArduino Module: Ultrasonic ModuleArduino Sensor: HS-S01A Infrared SensorArduino Sensor: HS-S02P Infrared Sensor (Obstacle Avoidance)Arduino Sensor: HS-S03P Ultraviolet SensorArduino Sensor: HS-S05P Sound SensorArduino Sensor: HS-F07P Active BuzzerArduino Sensor: HS-S08P Flame SensorArduino Sensor: HS-S09LB Raindrop SensorArduino Sensor: HS-S09PC Soil Moisture Sensor

Arduino Sensor: HS-S10P Mist Sensor

Arduino Sensor: HS-S11-L Gas Sensor

Arduino Sensor: HS-S20P Ambient Light Sensor

Arduino Sensor: HS-S21P Tilt SensorArduino Sensor: HS-S22P Grayscale SensorArduino Sensor: HS-S24P Digital Temperature SensorArduino Sensor: HS-S26A Temperature and Humidity SensorArduino Sensor: HS-S28P Potentiometer

Arduino Sensor: HS-S31P Touch Sensor

Arduino Sensor: HS-S37PS Water Level Sensor

Arduino Sensor: HS-S38P Human Sensor

Arduino Sensor: HS-S40P Hall Magnetic Sensor

Arduino Sensor: HS-S45P Barometric Pressure Sensor

Arduino Sensor: HS-S46P Weighing Sensor

Arduino Sensor: HS-S59P Slot Photoelectric Sensor

Arduino Sensor: HS-S70P Heart Rate and Blood Oxygen Sensor

Arduino Sensor: Infrared Receiver Module

Arduino Sensor: Infrared Transmitter Module

Arduino Sensor: Clock Module

Arduino Sensor: Rotary Encoder Module

Arduino Sensor: Dual-axis Joystick Module

Arduino Sensor: Gyroscope Module

Arduino Sensor: Voice Broadcast Module

Arduino Sensor: Voice Recognition Control Module

Arduino Communication Module: Bluetooth Module

Arduino Power Module: Motor Driver Module

Arduino Control Module: Self-locking Button ModuleArduino Storage Module: SD Card Module

Arduino Control Module: Conductive Switch Module

Arduino Execution Module: Electromagnet Module

01Basic KnowledgeArduino Module: Ultrasonic ModuleModel:HS-SR04PName:Ultrasonic ModuleSeries:Distance Detection ModuleDescription:This is a non-contact distance measurement module based on the principle of ultrasonic reflection, integrating an ultrasonic transmitter, receiver, and signal processing circuit. By emitting high-frequency sound waves and calculating the propagation time of the reflected echo, it achieves precise measurement of the distance to an object in front, outputting a digital signal for microcontroller processing. It features a wide measurement range, rapid response, and is unaffected by lighting, making it a core component for obstacle avoidance, distance measurement, and liquid level detection.Usage Scenarios:Smart car obstacle avoidance system (detects obstacles ahead and automatically steers); liquid level monitoring device (measures the liquid depth in tanks); security sensing switch (triggers an alarm or lights when someone approaches); industrial automation assembly line (detects whether objects are in place); primary and secondary school science experiments (exploring the relationship between sound wave propagation speed and distance), in line with the “Guidelines for Artificial Intelligence General Education in Primary and Secondary Schools (2025 Edition)” practical requirements; assistive walking devices designed for visually impaired individuals (real-time reporting of the distance to obstacles ahead).Disciplinary Integration:Physics, MathematicsEngineeringInformation TechnologyEthical Education:Ultrasonic distance measurement data (e.g., range of human activity) may involve privacy, requiring clear application boundaries; measurement errors (e.g., environmental temperature affecting sound speed) may lead to judgment deviations, necessitating calibration awareness; sensing devices in public places should avoid excessive sensitivity (e.g., frequently triggered automatic doors), reflecting humanistic care; recycling and disposal of piezoelectric components in electronic waste should focus on environmental responsibility; over-reliance on automatic distance measurement may reduce spatial awareness, requiring a balance between technological tools and natural observation..Note: Images are sourced from the internet, and products are based on actual purchases.

02Technical Parameters

Working Principle:

When the module is working, a high-level trigger signal of more than 10μs is sent from the Trig pin. The internal circuit receives the signal and emits 8 ultrasonic pulses at 40kHz; simultaneously, the Echo pin transitions from low to high, starting the timing. When the ultrasonic waves encounter an obstacle and are reflected back, they are received by the receiver, and the Echo pin transitions from high to low, ending the timing. By calculating the duration of the high level on the Echo pin (t) and using the formula “Distance = (Speed of Sound × Time) / 2” (the speed of sound is approximately 343m/s, divided by 2 because the sound wave travels to the obstacle and back), the distance from the module to the obstacle can be obtained.

Parameter Analysis:

GGND: Power input negative/groundV(VCC): Power input positive/levelTrig: Trigger signal input (for starting distance measurement)Echo: Echo signal output (for calculating time)Measurement range: 2cm-400cm (optimal range 20cm-300cm)Measurement accuracy: ±3mmTrigger signal: High-level pulse of more than 10μsWorking frequency: 40kHz (ultrasonic frequency)Blind zone: ≤2cm (cannot measure accurately below this distance)03Code ExampleArduino Module: Ultrasonic Module

Connect pins as follows: Trig:D2\Echo:D3.

04Safety Measures

1. Power off before wiring, ensure VCC is 5V (do not connect to 3.3V, as it will weaken the output signal); reversing the positive and negative connections will burn the module;

2. Avoid using in environments with strong electromagnetic interference (e.g., near motors, transformers) to prevent interference with trigger or echo signals;

3. Do not touch the ultrasonic transmitter/receiver (components inside the metal mesh protective cover) with hard objects to prevent physical damage;

4. If used in humid environments, seal the module, as moisture can affect ultrasonic propagation and component lifespan;

5. Ensure there are no obstructions (e.g., wires, fingers) in front during measurement to avoid misreading;

6. When not in use for a long time, store in a dry environment to prevent pin oxidation;

7. If data fluctuates significantly during debugging, check if the power supply is stable (it is recommended to use an external 5V power supply to avoid insufficient USB power).

05Extensions

Students can try the following:

1. Create an “Obstacle Avoidance Car”: work with the HS-F04P Motor Driver Module, when the ultrasonic detects an obstacle (<30cm), control the car to automatically steer away;2. Build a “Smart Hand Sanitizer”: combine with the HS-F17P Relay module, when a hand approaches the module (5-15cm), the relay triggers the motor to dispense hand sanitizer;3. Design a “Liquid Level Monitor”: install the module at the top of a tank to measure water level in real-time, and when below a threshold, trigger an alarm using the HS-F02P Buzzer;4. Develop an “Interactive Distance Sensing Light”: in conjunction with the HS-F01P RGB LED Module, the closer the distance, the brighter the light; the farther the distance, the dimmer the light, demonstrating the relationship between distance and brightness.

Arduino Module: Ultrasonic Module

Arduino Module: Ultrasonic Module— Previous Recommendations —Arduino Module: Ultrasonic ModuleArduino Module: Ultrasonic ModuleArduino Module: Ultrasonic ModuleArduino Module: Ultrasonic ModuleArduino Module: Ultrasonic Module

Leave a Comment