Jump to content
Electronics-Lab.com Community

Ultrasonic Distance Measurement Using Arduino

Recommended Posts

An ultrasonic range finder is a useful tool in a variety of real-life and robotic applications, such as in obstacle avoidance and distance measurement systems. The ultrasonic range finder measures the distance by emitting a 40KHz pulse of ultrasonic sound that travels through the air until it hits an object, then it measures the delay of the reflected signal and sends proper commands to other units.

I used an SRF05 ultrasonic sensor and an ATTiny85 microcontroller. The distance data is displayed on a 128*64 OLED screen, both in centimeters and inches. Also, a horizontal bar graph provides a visual estimation of the distance. The MCU code was developed using the Arduino IDE.

To design the schematic and PCB, I used Altium Designer 22 and SamacSys component libraries (Altium plugin). To get high-quality PCB boards, I sent the Gerbers to PCBWay and purchased original components using componentsearchengine.com. To examine the current consumption of the circuit, I used the Siglent SDM3045X multimeter.

Isn’t cool?! So let’s get started.


Input Voltage: 6-24VDC

Current Consumption: 24mA

Detection Range: 2-400cm (see text)

Distance Data: Centimeters, Inches, Bar Graph

Display: 128*64-Yellow Blue OLED





Ref: https://www.pcbway.com/blog/technology/An_Ultrasonic_Range_Finder_Using_an_SRF05_and_an_ATTiny85_cff7c5cf.html

Tool: Altium Designer + Legal License (Free): https://www.altium.com/yt/myvanitar

[1]: TS2937CW50 datasheet: https://www.taiwansemi.com/assets/uploads/datasheet/TS2937_E15.pdf

[2]: ATTiny85 datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-2586-AVR-8-bit-Microcontroller-ATtiny25-ATtiny45-ATtiny85_Datasheet.pdf

[3]: TS2937 schematic symbol, PCB footprint, 3D model: https://componentsearchengine.com/part-view/TS2937CW-5.0%20RP/Taiwan%20Semiconductor

[4]: ATTiny85 schematic symbol, PCB footprint, 3D model: https://componentsearchengine.com/part-view/ATTINY85-20SUR/Microchip

[5]: Electronic designing CAD software plugins: https://www.samacsys.com/library-loader-help

[6]: Altium Designer plugin: https://www.samacsys.com/altium-designer-library-instructions

[7]: ATTinyCore Arduino Board Manager: https://github.com/SpenceKonde/ATTinyCore

[8]: Arduino New Ping library: https://bitbucket.org/teckel12/arduino-new-ping/wiki/Home

[9]: Arduino Tiny4KOLED library: https://www.arduino.cc/reference/en/libraries/tiny4koled

[10]: Siglent SDM3045X multimeter: https://siglentna.com/digital-multimeters/sdm3045x-digital-multimeter/

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...