[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-689902-105":3,"detail-sidebar-cat-0-en-105":80,"doc-detail-689902-en":130,"doc-similar-689902":153},{"code":4,"msg":5,"data":6},0,"ok",{"site_id":7,"language":8,"slug":9,"title":10,"keywords":11,"description":12,"schema_data":13,"social_meta":73,"head_meta":75,"extra_data":77,"updated_unix":79},105,"en","ultrasonic-sonar-distance-sensors","Ultrasonic Sonar Distance Sensors","","Practical guide to using HC-SR04 and US-100 ultrasonic sonar distance sensors for robotics, automation, interactive art, and motion sensing. Explains operating range (about 2cm to 400cm, with 10cm–250cm suggested for best results), key electrical requirements (5V logic for HC-SR04 echo and 3–5V support for US-100), and how timing of the Echo signal enables distance calculation. Covers pinouts and wiring for common microcontroller boards plus Raspberry Pi, then shows how to interface from Python and CircuitPython using the appropriate library and wiring for each mode.",{"@graph":14,"@context":72},[15,34,55],{"@type":16,"itemListElement":17},"BreadcrumbList",[18,23,27,31],{"item":19,"name":20,"@type":21,"position":22},"https://docshare.wps.com","Home","ListItem",1,{"item":24,"name":25,"@type":21,"position":26},"https://docshare.wps.com/document/","Document",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/document/technology/","Technology",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/document/ultrasonic-sonar-distance-sensors/689902/",4,{"url":32,"name":10,"@type":35,"image":36,"author":41,"headline":10,"publisher":44,"fileFormat":47,"inLanguage":8,"description":12,"dateModified":48,"datePublished":49,"encodingFormat":47,"isAccessibleForFree":50,"interactionStatistic":51},"DigitalDocument",{"url":37,"@type":38,"width":39,"height":40},"https://docshare.wps.com/thumbnails/ultrasonic-sonar-distance-sensors/689902.png","ImageObject",300,407,{"name":42,"@type":43},"Stanford","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-11-11","2026-11-08",true,{"@type":52,"interactionType":53,"userInteractionCount":30},"InteractionCounter",{"@type":54},"ViewAction",{"@type":56,"mainEntity":57},"FAQPage",[58,64,68],{"name":59,"@type":60,"acceptedAnswer":61},"What are the main differences between the HC-SR04 and the US-100 distance sensors?","Question",{"text":62,"@type":63},"The HC-SR04 is fast, low cost, and uses a 5V echo logic level, so it needs a voltage divider for 3V devices. The US-100 is similar but can run from 3–5V and supports both HC-SR04 compatibility mode (trigger/echo) and Serial UART mode.","Answer",{"name":65,"@type":60,"acceptedAnswer":66},"How does the sensor measure distance using the Echo signal?",{"text":67,"@type":63},"The Echo pin goes high when the ultrasonic burst is transmitted in response to the Trig signal, and it stays high until an echo is received. Measuring how long Echo remains high allows distance to be computed.",{"name":69,"@type":60,"acceptedAnswer":70},"What wiring considerations are needed when using HC-SR04 with a 3V microcontroller?",{"text":71,"@type":63},"HC-SR04 echo uses 5V logic, so two 10k resistors are included as a divider to convert it to a safe 2.5V level for 3V devices. VCC should be connected to 5V for best results, while Trig can be 3V or 5V.","https://schema.org",{"og:url":32,"og:type":74,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":76,"canonical":32},"index,follow",{"doc_id":78,"site_id":7},689902,1794133611,{"code":4,"msg":81,"data":82},"success",[83,87,91,95,100,104,109,114,119,122,126],{"id":22,"doc_module":4,"doc_module_name":25,"category_name":84,"show_sort_weight":85,"slug":86},"Story & Novel",90,"story-novel",{"id":26,"doc_module":4,"doc_module_name":25,"category_name":88,"show_sort_weight":89,"slug":90},"Literature",80,"literature",{"id":33,"doc_module":4,"doc_module_name":25,"category_name":92,"show_sort_weight":93,"slug":94},"Exam",70,"exam",{"id":96,"doc_module":4,"doc_module_name":25,"category_name":97,"show_sort_weight":98,"slug":99},5,"Comic",60,"comic",{"id":101,"doc_module":4,"doc_module_name":25,"category_name":29,"show_sort_weight":102,"slug":103},6,50,"technology",{"id":105,"doc_module":4,"doc_module_name":25,"category_name":106,"show_sort_weight":107,"slug":108},7,"Healthcare",40,"healthcare",{"id":110,"doc_module":4,"doc_module_name":25,"category_name":111,"show_sort_weight":112,"slug":113},8,"Research & Report",30,"research-report",{"id":115,"doc_module":4,"doc_module_name":25,"category_name":116,"show_sort_weight":117,"slug":118},9,"Religion & Spirituality",20,"religion-spirituality",{"id":117,"doc_module":4,"doc_module_name":25,"category_name":120,"show_sort_weight":117,"slug":121},"World Cup","world-cup",{"id":123,"doc_module":4,"doc_module_name":25,"category_name":124,"show_sort_weight":123,"slug":125},10,"Lifestyle","lifestyle",{"id":127,"doc_module":4,"doc_module_name":25,"category_name":128,"show_sort_weight":96,"slug":129},19,"General","general",{"code":4,"msg":81,"data":131},{"doc_id":78,"user_id":132,"nickname":42,"user_avatar":133,"doc_module":4,"category_id":101,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":30,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":139,"language":140,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":141,"faqs":142,"seo_title":143,"seo_description":12,"update_tm":79,"read_time":107,"preview_page_count":26,"preview_urls":144},2336477552062,"https://ap-avatar.wpscdn.com/davatar_994ba38a5ba835b3df7d355c54d3ed8d","Ultrasonic Sonar Distance Sensors  \nCreated by Kattni Rembor  \n[https://learn.adafruit.com/ultrasonic-sonar-distance-sensors](https://learn.adafruit.com/ultrasonic-sonar-distance-sensors)  \nLast updated on 2026-09-30 05:06:26 PM UTC  \n©Adafruit Industries Page 1 of 16  \nTable of Contents  \nOverview 3  \n\n| Pinouts | 6 |\n| --- | --- |\n| Python & CircuitPython | 8 |\n| • CircuitPython Microcontroller Wiring\u003Cbr>• Python Computer Wiring\u003Cbr>• CircuitPython Installation of HC-SR04 / US-100 Library\u003Cbr>• Python Installation of HC-SR04 / US100 Library\u003Cbr>• CircuitPython & Python Usage of HC-SR04\u003Cbr>• CircuitPython & Python Usage of US-100\u003Cbr>• Full Example Code\u003Cbr>Python Docs | 16 |\n| Downloads | 16 |\n\n• Files:  \n©Adafruit Industries Page 2 of 16  \nOverview  \nIf you're like me, you've dreamed of being a dolphin-smoothly gliding through the water. Using your echo-location abilities to detect tasty fish treats. Until genetic modifications catches up with our desires, we'll just have to make do with these handy HC-SR04 and US100 Ultrasonic Sonar Distance Sensors and a pair of flippers.  \nThese ubiquitous sensors are really common in robotics projects, but they can also be used for automation, interactive art and motion sensing. They work at about 2cm to 400cm away, but we think 10cm-250cm will get you the best results.  \n©Adafruit Industries Page 3 of 16  \nThe HC-SR04 sensors are fast, fairly easy to use, and low cost. They do require powering from 5V for best results: connect GND (ground) and VCC to 5V power. While the Trig signal can be 3V or 5V, the 'return' Echo signal is 5V logic. For that reason, we include two 10K resistors, use these as a divider to convert the 5V logic level to a safe 2.5V that you can ready with your 3V device.  \n©Adafruit Industries Page 4 of 16  \nThe US-100 is very similar to the popular HC-SR04 ultrasonic sensors, and even looks the same, but has a few extra tricks  \n• This sensor can run from 3-5V so you don't need any logic level shifters or dividers. Just power from whatever your microcontroller provides  \n• You can use in \"HC-SR04\" mode or in \"Serial UART\" mode.  \nWhen the jumper on the back is removed, it acts like an HC-SR04 with a trigger and echo pin. When the jumper is in place, you use 9600 baud UART to communicate with the sensor. In UART mode, send 0x55 and read back two bytes (16 bit value) that is mm distance, or 0x50 to read the temperature in degrees C. Handy if you want to use with a computer and a USB-serial converter, or some other device that can't do the special timing needed for the HC-SR04 trigger/echo.  \n©Adafruit Industries Page 5 of 16  \nPinouts  \nThe HC-SR04 sensors are simple to use. Let's take a look!  \n• Vcc-Power pin-this sensor requires 5V power for best results.  \n• Trig-Signal can be 3V or 5V. Setting the Trig pin to high for 10µs causes the sensor to initiate an ultrasonic burst.  \n©Adafruit Industries Page 6 of 16  \n• Echo- \"Return\" signal is 5V logic-the sensor comes with two 10k resistors to use as a divider to convert the 5V logic level to a safe 2.5V that you can read with your 3V device. The Echo pin goes high when the ultrasonic burst is transmitted (in response to Trig) and stays high until the sensor receives an echo of its burst, at which point it goes low. By measuring the time the Echo pin is high, the distance can be computed.  \n• Gnd-Ground pin.  \nThe US100 is nearly the same except it is capable of UART.  \n• Vcc-Power pin-this sensor can run at 3V or 5V.  \n• Trig/TX-Signal can be 3V or 5V in HC-SR04 compatibility mode.. Works as TXin UART mode. Setting the Trig pin to high for 10µs causes the sensor to initiate an ultrasonic burst.  \n• Echo/RX-Signal can be 3V or 5V in HC-SR04 compatibility mode. Works as RXin UART mode. The Echo pin goes high when the ultrasonic burst is transmitted (in response to Trig) and stays high until the sensor receives an echo of its burst, at which point it goes low. By measuring the time the Echo pin is high, the distance can be comp","cbCaisXIiscklWUr","https://ap.wps.com/l/cbCaisXIiscklWUr","pdf",3823395,16,"English","# Overview\n# Pinouts\n## Python & CircuitPython\n# Downloads","[{\"question\":\"What are the main differences between the HC-SR04 and the US-100 distance sensors?\",\"answer\":\"The HC-SR04 is fast, low cost, and uses a 5V echo logic level, so it needs a voltage divider for 3V devices. The US-100 is similar but can run from 3–5V and supports both HC-SR04 compatibility mode (trigger/echo) and Serial UART mode.\"},{\"question\":\"How does the sensor measure distance using the Echo signal?\",\"answer\":\"The Echo pin goes high when the ultrasonic burst is transmitted in response to the Trig signal, and it stays high until an echo is received. Measuring how long Echo remains high allows distance to be computed.\"},{\"question\":\"What wiring considerations are needed when using HC-SR04 with a 3V microcontroller?\",\"answer\":\"HC-SR04 echo uses 5V logic, so two 10k resistors are included as a divider to convert it to a safe 2.5V level for 3V devices. VCC should be connected to 5V for best results, while Trig can be 3V or 5V.\"}]","Ultrasonic Sonar Distance Sensors | PDF",[145,149],{"page_no":22,"url":146,"width":147,"height":148},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/6122591f29d89b155d5bd96508d02af5.webp",983,1390,{"page_no":26,"url":150,"width":151,"height":152},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/b9f365c4ef0644e09d53c43388323c99.webp",982,1388,{"list":154,"token":11},[155,161,167,173,179,185,191,197,204,210],{"doc_id":156,"doc_title":157,"file_type":137,"home_preview_img_url":158,"slug":159,"view_count":33,"category_name":29,"create_tm":160},681644,"Ultrasonic Ranging Module HC-SR04 - Usage Notes","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229998373282/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111039&Signature=SU1cu64AgNDtcMKHlWUBG3SXdto%3D","ultrasonic-ranging-module-hc-sr04-usage-notes",1793951567,{"doc_id":162,"doc_title":163,"file_type":137,"home_preview_img_url":164,"slug":165,"view_count":30,"category_name":29,"create_tm":166},689906,"Ultrasonic Sensor Module - Specifications, Wiring, and Testing","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230001443357/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111039&Signature=uWc1ZIEzo5sJC1GbjwG5JbI6Gbg%3D","ultrasonic-sensor-module-specifications-wiring-and-testing",1794133617,{"doc_id":168,"doc_title":169,"file_type":137,"home_preview_img_url":170,"slug":171,"view_count":33,"category_name":29,"create_tm":172},689907,"HC SR04 Ultrasonic Sensor - User’s Manual - V1.0 - May 2013","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230001443528/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111039&Signature=GWatOjzKhiCy%2BAmBXl1vHIlRk2Y%3D","hc-sr04-ultrasonic-sensor-users-manual-v10-may-2013",1794133650,{"doc_id":174,"doc_title":175,"file_type":137,"home_preview_img_url":176,"slug":177,"view_count":33,"category_name":29,"create_tm":178},689903,"HC SR04 Ultrasonic Sensor - How it works and wiring guide","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230001443309/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111039&Signature=7RWIF9g%2FvZ%2F%2FJ30bfnA70H4QukU%3D","hc-sr04-ultrasonic-sensor-how-it-works-and-wiring-guide",1794133612,{"doc_id":180,"doc_title":181,"file_type":137,"home_preview_img_url":182,"slug":183,"view_count":30,"category_name":29,"create_tm":184},689901,"HC-SR04 Ultrasonic Distance Sensor On an Arduino - Overview, Specifications, and Code","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230001443281/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111039&Signature=Hw5WY0U2y2L04jubWmVRRjFQ%2Fl0%3D","hc-sr04-ultrasonic-distance-sensor-on-an-arduino-overview-specifications-and-code",1794133605,{"doc_id":186,"doc_title":187,"file_type":137,"home_preview_img_url":188,"slug":189,"view_count":33,"category_name":29,"create_tm":190},689898,"HC-SR04 Ultrasonic Sensor Module User Guide - User Guide: Ultrasonic Sensor V2.0","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230001443221/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111039&Signature=DZEii1AzUhrvYNmS59mmgvO0TzI%3D","hc-sr04-ultrasonic-sensor-module-user-guide-user-guide-ultrasonic-sensor-v20",1794133600,{"doc_id":192,"doc_title":193,"file_type":137,"home_preview_img_url":194,"slug":195,"view_count":105,"category_name":29,"create_tm":196},721112,"Adafruit MAX98357 I2S Class-D Amps - Stereo and Mono","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230024419629/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111039&Signature=yYTALtAlmMBivGPnmY3BMpl7FOE%3D","adafruit-max98357-i2s-class-d-amps-stereo-and-mono",1795041842,{"doc_id":198,"doc_title":199,"file_type":137,"home_preview_img_url":200,"slug":201,"view_count":202,"category_name":29,"create_tm":203},720664,"Adafruit 2.0\" 320x240 Color IPS TFT Display - Overview - Wiring & Testing Guide","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230023677033/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111039&Signature=eEyvlKKLEzKOXWvbt3gO3nBvsvU%3D","adafruit-20-320x240-color-ips-tft-display-overview-wiring-testing-guide",11,1795038681,{"doc_id":205,"doc_title":206,"file_type":137,"home_preview_img_url":207,"slug":208,"view_count":105,"category_name":29,"create_tm":209},720615,"Adafruit 4-Channel ADC Breakouts","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230023676115/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111039&Signature=LnxEIfuVCPgsgayk0Cjb47U%2BO4g%3D","adafruit-4-channel-adc-breakouts",1795038464,{"doc_id":211,"doc_title":212,"file_type":137,"home_preview_img_url":213,"slug":214,"view_count":101,"category_name":29,"create_tm":215},700225,"Adafruit STM32F405 Feather Express","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230011564446/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111039&Signature=ERixXTyEsEGe4g3hVCC96%2FIZI%2F0%3D","adafruit-stm32f405-feather-express",1794517354]