
In a recent class, I used an ultrasonic sensor in conjunction with the ESP32 IoT development board to conduct an extended experiment based on the textbook, which involved using the sensor and a computer to measure displacement.

Under the camera of the smart blackboard system, I detailed the working principle of the ultrasonic sensor and measured the displacement between the ultrasonic sensor and a cardboard box in real-time. As the position of the cardboard box changed, the displacement-time graph was dynamically drawn on the smartphone screen, which was projected onto a large screen by the camera, allowing the students to see it clearly.

I measured the actual distance between the ultrasonic sensor and the cardboard box using a tape measure on-site and found that the two were very close, indicating that the ultrasonic sensor’s measurement of displacement is quite reliable.

Wiring Diagram
Based on my purchasing experience, an ESP32 costs about 24 yuan, an ultrasonic sensor costs about 5 yuan, and a smartphone can be used from home. For less than 30 yuan, I built a displacement sensor that can dynamically draw displacement-time graphs, velocity-time graphs, and acceleration-time graphs, achieving results comparable to commercial sensors that cost tens of thousands.
When you do it yourself, anything is possible…