{"product_id":"hc-sr04-ultrasonic-distance-sensor-module","title":"HC-SR04 Ultrasonic Distance Sensor Module","description":"\u003c!--\n  NZN Electronics — HC-SR04 Ultrasonic Distance Sensor\n  Description Template v5\n  SEO: all content in DOM, semantic HTML, dl\/dt\/dd specs\n--\u003e\n\n\u003cstyle\u003e\n  \/* ── Root ── *\/\n  .nznd { width: 100%; max-width: 1400px; margin: 0 auto; font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: #101114; }\n  .nznd, .nznd * { box-sizing: border-box; }\n\n  \/* ── Tabs ── *\/\n  .nznd__tabs { width: 100%; display: flex; gap: 0; border-bottom: 2px solid #e7e7e7; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; }\n  .nznd__tabs::-webkit-scrollbar { display: none; }\n  .nznd__tab {\n    flex: 0 0 auto; background: none; border: none;\n    border-bottom: 2px solid transparent; margin-bottom: -2px;\n    padding: 13px 18px;\n    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;\n    font-size: 13.5px; font-weight: 700; white-space: nowrap; color: #60646c;\n    cursor: pointer; transition: color .16s, border-color .16s;\n  }\n  .nznd__tab:hover { color: #ff7a2f; }\n  .nznd__tab.is-active { color: #ff7a2f; border-bottom-color: #ff7a2f; }\n\n  \/* ── Card ── *\/\n  .nznd__card {\n    width: 100%; background: #fff;\n    border: 1px solid #e7e7e7; border-top: none;\n    border-radius: 0 0 16px 16px;\n    padding: 36px 32px;\n    box-shadow: 0 8px 24px rgba(0,0,0,.04);\n    min-height: 480px;\n  }\n\n  \/* ── Panels ── *\/\n  .nznd__panel { display: none; }\n  .nznd__panel.is-active { display: block; animation: nzndIn .22s cubic-bezier(.22,.68,0,1.2) both; }\n  @keyframes nzndIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }\n\n  \/* ── Force left-align ── *\/\n  .nznd__panel h2, .nznd__panel h3, .nznd__panel p,\n  .nznd__panel li, .nznd__panel dt, .nznd__panel dd,\n  .nznd__panel strong, .nznd__panel span { text-align: left; }\n  .nznd__stat span { text-align: center; }\n\n  \/* ── Orange accent strip ── *\/\n  .nznd__strip { border-left: 3px solid #ff7a2f; background: #fff5ef; border-radius: 0 10px 10px 0; padding: 18px 20px; margin-bottom: 24px; }\n  .nznd__strip h2 { font-size: 18px; font-weight: 800; color: #101114; margin: 0 0 7px; line-height: 1.25; text-align: left; }\n  .nznd__strip p  { font-size: 14px; line-height: 1.65; color: #60646c; margin: 0; text-align: left; }\n\n  \/* ── Stat cards ── *\/\n  .nznd__stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 22px; }\n  .nznd__stat {\n    background: #f9fafb; border: 1px solid #e7e7e7; border-top: 3px solid transparent;\n    border-radius: 10px; padding: 14px 12px; text-align: center;\n    transition: border-top-color .18s, box-shadow .18s;\n  }\n  .nznd__stat:hover { border-top-color: #ff7a2f; box-shadow: 0 4px 12px rgba(255,122,47,.1); }\n  .nznd__stat-val { display: block; font-size: 19px; font-weight: 800; color: #101114; letter-spacing: -.02em; white-space: nowrap; margin-bottom: 4px; text-align: center; }\n  .nznd__stat-lbl { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: #60646c; text-align: center; }\n\n  \/* ── Feature pills ── *\/\n  .nznd__pills { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0 0 22px; }\n  .nznd__pill { display: inline-flex; align-items: center; gap: 7px; background: #fff; border: 1px solid #e7e7e7; border-radius: 999px; padding: 6px 13px; font-size: 13px; font-weight: 500; color: #101114; box-shadow: 0 1px 3px rgba(0,0,0,.05); }\n  .nznd__dot { width: 7px; height: 7px; border-radius: 50%; background: #ff7a2f; flex-shrink: 0; display: inline-block; }\n  .nznd__dot--blue { background: #4a9af7; }\n\n  \/* ── Callout ── *\/\n  .nznd__callout { display: flex; align-items: flex-start; gap: 12px; border-radius: 10px; padding: 15px 18px; margin-bottom: 22px; }\n  .nznd__callout--orange { background: #fff5ef; border: 1px solid rgba(255,122,47,.3); }\n  .nznd__callout--blue   { background: #eef5ff; border: 1px solid rgba(74,154,247,.3); }\n  .nznd__callout svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }\n  .nznd__callout strong { display: block; font-size: 13px; font-weight: 700; color: #101114; margin-bottom: 4px; text-align: left; }\n  .nznd__callout p { font-size: 13px; line-height: 1.6; color: #60646c; margin: 0; text-align: left; }\n\n  \/* ── Eyebrow label ── *\/\n  .nznd__eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: #ff7a2f; margin: 0 0 16px; text-align: left; }\n  .nznd__body { font-size: 14.5px; line-height: 1.7; color: #60646c; margin: 0 0 22px; text-align: left; }\n\n  \/* ── Spec dl table ── *\/\n  .nznd__specs { border: 1px solid #e7e7e7; border-radius: 10px; overflow: hidden; margin-bottom: 22px; }\n  .nznd__spec-row { display: grid; grid-template-columns: minmax(170px, .85fr) 1.4fr; border-bottom: 1px solid #e7e7e7; }\n  .nznd__spec-row:last-child { border-bottom: none; }\n  .nznd__spec-row:nth-child(even) { background: #fafafa; }\n  .nznd__spec-row dt { padding: 12px 15px; font-size: 13.5px; font-weight: 500; color: #60646c; border-right: 1px solid #e7e7e7; text-align: left; }\n  .nznd__spec-row dd { padding: 12px 15px; font-size: 13.5px; font-weight: 700; color: #101114; text-align: left; }\n\n  \/* ── Wiring layout ── *\/\n  .nznd__wiring { display: grid; grid-template-columns: 200px 1fr; gap: 28px; margin-bottom: 22px; align-items: start; }\n\n  \/* ── Module drawing box ── *\/\n  .nznd__tobox {\n    background: #f9fafb; border: 1px solid #e7e7e7; border-radius: 12px;\n    padding: 18px 12px 12px; display: flex; flex-direction: column; align-items: center;\n  }\n  .nznd__tobox-lbl { font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #60646c; margin-bottom: 10px; text-align: center; }\n  .nznd__tosvg { width: 100%; max-width: 160px; }\n  .nznd__tobox-sub { font-size: 10.5px; font-weight: 600; color: #60646c; margin-top: 8px; text-align: center; }\n  .nznd__tobox-sub span { color: #ff7a2f; }\n\n  \/* ── Step cards ── *\/\n  .nznd__steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; }\n  .nznd__step { display: grid; grid-template-columns: 34px 1fr; gap: 11px; align-items: start; background: #f9fafb; border: 1px solid #e7e7e7; border-radius: 10px; padding: 13px; }\n  .nznd__step-n { width: 34px; height: 34px; border-radius: 8px; background: #fff5ef; border: 1px solid rgba(255,122,47,.3); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 800; color: #ff7a2f; flex-shrink: 0; }\n  .nznd__step strong { display: block; font-size: 13.5px; font-weight: 700; color: #101114; margin-bottom: 3px; text-align: left; }\n  .nznd__step p { font-size: 12.5px; line-height: 1.55; color: #60646c; margin: 0; text-align: left; }\n  .nznd__step code { font-size: 12px; font-family: monospace; background: #fff; border: 1px solid #e7e7e7; border-radius: 4px; padding: 1px 5px; color: #101114; }\n\n  \/* ── Use case grid ── *\/\n  .nznd__uses { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; margin-bottom: 22px; }\n  .nznd__use { background: #f9fafb; border: 1px solid #e7e7e7; border-left: 3px solid #ff7a2f; border-radius: 0 9px 9px 0; padding: 14px; transition: background .15s, box-shadow .15s; }\n  .nznd__use:hover { background: #fff5ef; box-shadow: 0 2px 8px rgba(255,122,47,.1); }\n  .nznd__use strong { display: block; font-size: 13.5px; font-weight: 700; color: #101114; margin-bottom: 4px; text-align: left; }\n  .nznd__use p { font-size: 12.5px; line-height: 1.5; color: #60646c; margin: 0; text-align: left; }\n\n  \/* ── FAQ accordion ── *\/\n  .nznd__faq { display: grid; gap: 8px; }\n  .nznd__faq-item { border: 1px solid #e7e7e7; border-radius: 10px; overflow: hidden; background: #fff; }\n  .nznd__faq-q {\n    width: 100%; background: #f9fafb; border: none;\n    padding: 14px 17px;\n    display: flex; align-items: center; justify-content: space-between; gap: 10px;\n    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;\n    font-size: 13.5px; font-weight: 700; color: #101114;\n    cursor: pointer; text-align: left; transition: background .15s, color .15s;\n  }\n  .nznd__faq-q:hover { background: #fff5ef; }\n  .nznd__faq-item.is-open .nznd__faq-q { background: #fff5ef; color: #ff7a2f; }\n  .nznd__faq-icon {\n    width: 20px; height: 20px; flex-shrink: 0;\n    border-radius: 50%; background: #e7e7e7;\n    display: flex; align-items: center; justify-content: center;\n    transition: background .15s, transform .25s cubic-bezier(.34,1.56,.64,1);\n  }\n  .nznd__faq-q:hover .nznd__faq-icon { background: #ffe0cc; }\n  .nznd__faq-item.is-open .nznd__faq-icon { background: #ff7a2f; transform: rotate(45deg); }\n  .nznd__faq-icon svg { width: 10px; height: 10px; stroke: #60646c; }\n  .nznd__faq-item.is-open .nznd__faq-icon svg { stroke: #fff; }\n  .nznd__faq-a {\n    display: block;\n    max-height: 0;\n    overflow: hidden;\n    padding: 0 17px;\n    font-size: 13.5px; line-height: 1.65; color: #60646c;\n    border-top: 1px solid transparent;\n    text-align: left;\n    transition: max-height .32s cubic-bezier(.4,0,.2,1), padding .24s ease, border-color .24s ease;\n  }\n  .nznd__faq-item.is-open .nznd__faq-a { max-height: 260px; padding: 14px 17px; border-top-color: #e7e7e7; }\n\n  \/* ── Responsive ── *\/\n  @media (max-width: 750px) {\n    .nznd__card  { padding: 22px 16px; min-height: 0; }\n    .nznd__stats { grid-template-columns: repeat(2, 1fr); }\n    .nznd__wiring { grid-template-columns: 1fr; }\n    .nznd__tobox { flex-direction: row; gap: 16px; align-items: center; padding: 14px; }\n    .nznd__tobox-lbl { display: none; }\n    .nznd__tosvg { max-width: 90px; }\n    .nznd__tobox-sub { margin-top: 0; text-align: left; }\n    .nznd__uses { grid-template-columns: 1fr 1fr; }\n    .nznd__spec-row { grid-template-columns: 1fr; }\n    .nznd__spec-row dt { border-right: none; border-bottom: 1px solid #e7e7e7; padding-bottom: 5px; }\n    .nznd__spec-row dd { padding-top: 5px; }\n    .nznd__tab { padding: 11px 12px; font-size: 12.5px; }\n  }\n  @media (max-width: 480px) {\n    .nznd__uses { grid-template-columns: 1fr; }\n    .nznd__tab  { padding: 10px 9px; font-size: 11.5px; }\n  }\n  @media (prefers-reduced-motion: reduce) {\n    .nznd__panel { animation: none !important; }\n    .nznd__faq-a { transition: none !important; }\n    .nznd__faq-icon { transition: background .15s !important; }\n    .nznd * { transition-duration: .01ms !important; }\n  }\n\u003c\/style\u003e\n\n\u003carticle class=\"nznd\" itemscope itemtype=\"https:\/\/schema.org\/Product\"\u003e\n  \u003cmeta itemprop=\"name\" content=\"HC-SR04 Ultrasonic Distance Sensor Module\"\u003e\n  \u003cmeta itemprop=\"sku\" content=\"HCSR04\"\u003e\n  \u003cmeta itemprop=\"brand\" content=\"NZN Electronics\"\u003e\n\n  \u003cnav class=\"nznd__tabs\" role=\"tablist\" aria-label=\"Product sections\"\u003e\n    \u003cbutton class=\"nznd__tab is-active\" type=\"button\" data-tab=\"overview\" role=\"tab\" aria-selected=\"true\"\u003eOverview\u003c\/button\u003e\n    \u003cbutton class=\"nznd__tab\" type=\"button\" data-tab=\"specs\" role=\"tab\" aria-selected=\"false\"\u003eSpecifications\u003c\/button\u003e\n    \u003cbutton class=\"nznd__tab\" type=\"button\" data-tab=\"wiring\" role=\"tab\" aria-selected=\"false\"\u003eWiring Guide\u003c\/button\u003e\n    \u003cbutton class=\"nznd__tab\" type=\"button\" data-tab=\"uses\" role=\"tab\" aria-selected=\"false\"\u003eCommon Uses\u003c\/button\u003e\n    \u003cbutton class=\"nznd__tab\" type=\"button\" data-tab=\"faq\" role=\"tab\" aria-selected=\"false\"\u003eFAQs\u003c\/button\u003e\n  \u003c\/nav\u003e\n\n  \u003cdiv class=\"nznd__card\"\u003e\n\n    \u003c!-- ══════════════ OVERVIEW ══════════════ --\u003e\n    \u003csection class=\"nznd__panel is-active\" data-panel=\"overview\" role=\"tabpanel\"\u003e\n\n      \u003cdiv class=\"nznd__strip\"\u003e\n        \u003ch2 itemprop=\"name\"\u003eHC-SR04 — Ultrasonic Distance Sensor Module\u003c\/h2\u003e\n        \u003cp itemprop=\"description\"\u003eA popular 40 kHz ultrasonic ranging module capable of measuring distances from 2 cm to 450 cm with up to 3 mm precision. Sends a timed echo pulse and lets your microcontroller calculate distance using the speed of sound. Works directly with Arduino, ESP32, and Raspberry Pi GPIO pins with no extra components required.\u003c\/p\u003e\n      \u003c\/div\u003e\n\n      \u003cdiv class=\"nznd__stats\" role=\"list\" aria-label=\"Key specifications\"\u003e\n        \u003cdiv class=\"nznd__stat\" role=\"listitem\"\u003e\n          \u003cspan class=\"nznd__stat-val\"\u003e2–450cm\u003c\/span\u003e\n          \u003cspan class=\"nznd__stat-lbl\"\u003eDetection Range\u003c\/span\u003e\n        \u003c\/div\u003e\n        \u003cdiv class=\"nznd__stat\" role=\"listitem\"\u003e\n          \u003cspan class=\"nznd__stat-val\"\u003e3mm\u003c\/span\u003e\n          \u003cspan class=\"nznd__stat-lbl\"\u003ePrecision\u003c\/span\u003e\n        \u003c\/div\u003e\n        \u003cdiv class=\"nznd__stat\" role=\"listitem\"\u003e\n          \u003cspan class=\"nznd__stat-val\"\u003e40 kHz\u003c\/span\u003e\n          \u003cspan class=\"nznd__stat-lbl\"\u003eUltrasonic Freq.\u003c\/span\u003e\n        \u003c\/div\u003e\n        \u003cdiv class=\"nznd__stat\" role=\"listitem\"\u003e\n          \u003cspan class=\"nznd__stat-val\"\u003eDC 5V\u003c\/span\u003e\n          \u003cspan class=\"nznd__stat-lbl\"\u003eSupply Voltage\u003c\/span\u003e\n        \u003c\/div\u003e\n      \u003c\/div\u003e\n\n      \u003cul class=\"nznd__pills\" aria-label=\"Key features\"\u003e\n        \u003cli class=\"nznd__pill\"\u003e\n\u003cspan class=\"nznd__dot\"\u003e\u003c\/span\u003e2 cm Blind-Zone Minimum\u003c\/li\u003e\n        \u003cli class=\"nznd__pill\"\u003e\n\u003cspan class=\"nznd__dot\"\u003e\u003c\/span\u003e450 cm Maximum Range\u003c\/li\u003e\n        \u003cli class=\"nznd__pill\"\u003e\n\u003cspan class=\"nznd__dot\"\u003e\u003c\/span\u003e±15° Sensing Angle\u003c\/li\u003e\n        \u003cli class=\"nznd__pill\"\u003e\n\u003cspan class=\"nznd__dot nznd__dot--blue\"\u003e\u003c\/span\u003eArduino Compatible\u003c\/li\u003e\n        \u003cli class=\"nznd__pill\"\u003e\n\u003cspan class=\"nznd__dot nznd__dot--blue\"\u003e\u003c\/span\u003eESP32 Compatible\u003c\/li\u003e\n        \u003cli class=\"nznd__pill\"\u003e\n\u003cspan class=\"nznd__dot nznd__dot--blue\"\u003e\u003c\/span\u003eRaspberry Pi Compatible\u003c\/li\u003e\n        \u003cli class=\"nznd__pill\"\u003e\n\u003cspan class=\"nznd__dot\"\u003e\u003c\/span\u003eOnly 2 Signal Pins\u003c\/li\u003e\n        \u003cli class=\"nznd__pill\"\u003e\n\u003cspan class=\"nznd__dot\"\u003e\u003c\/span\u003e7.5g Lightweight\u003c\/li\u003e\n      \u003c\/ul\u003e\n\n      \u003cdiv class=\"nznd__callout nznd__callout--orange\" role=\"note\"\u003e\n        \u003csvg viewbox=\"0 0 24 24\" fill=\"none\" stroke=\"#ff7a2f\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\u003e\u003ccircle cx=\"12\" cy=\"12\" r=\"10\"\u003e\u003c\/circle\u003e\u003cline x1=\"12\" y1=\"8\" x2=\"12\" y2=\"12\"\u003e\u003c\/line\u003e\u003cline x1=\"12\" y1=\"16\" x2=\"12.01\" y2=\"16\"\u003e\u003c\/line\u003e\u003c\/svg\u003e\n        \u003cdiv\u003e\n          \u003cstrong\u003e5V logic — use a voltage divider on the ECHO pin for 3.3V boards\u003c\/strong\u003e\n          \u003cp\u003eThe HC-SR04 TRIG and ECHO pins operate at 5V logic. The TRIG pin is fine driven from 3.3V GPIO, but the ECHO pin outputs 5V which can damage ESP32 or Raspberry Pi inputs. Use a simple two-resistor voltage divider (1kΩ and 2kΩ) to drop ECHO to 3.3V before connecting to a 3.3V board.\u003c\/p\u003e\n        \u003c\/div\u003e\n      \u003c\/div\u003e\n\n    \u003c\/section\u003e\n\n    \u003c!-- ══════════════ SPECIFICATIONS ══════════════ --\u003e\n    \u003csection class=\"nznd__panel\" data-panel=\"specs\" role=\"tabpanel\"\u003e\n\n      \u003cp class=\"nznd__eyebrow\"\u003eElectrical \u0026amp; Physical Specifications\u003c\/p\u003e\n      \u003cp class=\"nznd__body\"\u003eFull specifications for the HC-SR04 ultrasonic distance sensor module. All values at DC 5V supply unless stated.\u003c\/p\u003e\n\n      \u003cdl class=\"nznd__specs\" itemprop=\"additionalProperty\"\u003e\n        \u003cdiv class=\"nznd__spec-row\"\u003e\n\u003cdt\u003eModel Number\u003c\/dt\u003e\n\u003cdd\u003eHC-SR04 (HCSR04)\u003c\/dd\u003e\n\u003c\/div\u003e\n        \u003cdiv class=\"nznd__spec-row\"\u003e\n\u003cdt\u003eWorking Voltage\u003c\/dt\u003e\n\u003cdd\u003eDC 5V\u003c\/dd\u003e\n\u003c\/div\u003e\n        \u003cdiv class=\"nznd__spec-row\"\u003e\n\u003cdt\u003eQuiescent Current\u003c\/dt\u003e\n\u003cdd\u003eLess than 2 mA\u003c\/dd\u003e\n\u003c\/div\u003e\n        \u003cdiv class=\"nznd__spec-row\"\u003e\n\u003cdt\u003eLevel Output (High)\u003c\/dt\u003e\n\u003cdd\u003e5V\u003c\/dd\u003e\n\u003c\/div\u003e\n        \u003cdiv class=\"nznd__spec-row\"\u003e\n\u003cdt\u003eLevel Output (Low)\u003c\/dt\u003e\n\u003cdd\u003e0V\u003c\/dd\u003e\n\u003c\/div\u003e\n        \u003cdiv class=\"nznd__spec-row\"\u003e\n\u003cdt\u003eDetection Range\u003c\/dt\u003e\n\u003cdd\u003e2 cm – 450 cm\u003c\/dd\u003e\n\u003c\/div\u003e\n        \u003cdiv class=\"nznd__spec-row\"\u003e\n\u003cdt\u003ePrecision\u003c\/dt\u003e\n\u003cdd\u003eUp to 3 mm (0.3 cm)\u003c\/dd\u003e\n\u003c\/div\u003e\n        \u003cdiv class=\"nznd__spec-row\"\u003e\n\u003cdt\u003eSensing Angle\u003c\/dt\u003e\n\u003cdd\u003eNot more than 15°\u003c\/dd\u003e\n\u003c\/div\u003e\n        \u003cdiv class=\"nznd__spec-row\"\u003e\n\u003cdt\u003eUltrasonic Frequency\u003c\/dt\u003e\n\u003cdd\u003e40 kHz\u003c\/dd\u003e\n\u003c\/div\u003e\n        \u003cdiv class=\"nznd__spec-row\"\u003e\n\u003cdt\u003eTrigger Input Signal\u003c\/dt\u003e\n\u003cdd\u003e10 µs TTL pulse minimum\u003c\/dd\u003e\n\u003c\/div\u003e\n        \u003cdiv class=\"nznd__spec-row\"\u003e\n\u003cdt\u003eDistance Formula\u003c\/dt\u003e\n\u003cdd\u003eDistance = (Echo high time × 340 m\/s) ÷ 2\u003c\/dd\u003e\n\u003c\/div\u003e\n        \u003cdiv class=\"nznd__spec-row\"\u003e\n\u003cdt\u003ePins\u003c\/dt\u003e\n\u003cdd\u003eVCC, TRIG, ECHO, GND\u003c\/dd\u003e\n\u003c\/div\u003e\n        \u003cdiv class=\"nznd__spec-row\"\u003e\n\u003cdt\u003eWeight\u003c\/dt\u003e\n\u003cdd\u003e7.5 g\u003c\/dd\u003e\n\u003c\/div\u003e\n        \u003cdiv class=\"nznd__spec-row\"\u003e\n\u003cdt\u003eMCU Compatibility\u003c\/dt\u003e\n\u003cdd\u003eArduino, ESP32 (with divider on ECHO), Raspberry Pi\u003c\/dd\u003e\n\u003c\/div\u003e\n      \u003c\/dl\u003e\n\n      \u003cdiv class=\"nznd__callout nznd__callout--blue\" role=\"note\"\u003e\n        \u003csvg viewbox=\"0 0 24 24\" fill=\"none\" stroke=\"#4a9af7\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\u003e\u003ccircle cx=\"12\" cy=\"12\" r=\"10\"\u003e\u003c\/circle\u003e\u003cline x1=\"12\" y1=\"16\" x2=\"12\" y2=\"12\"\u003e\u003c\/line\u003e\u003cline x1=\"12\" y1=\"8\" x2=\"12.01\" y2=\"8\"\u003e\u003c\/line\u003e\u003c\/svg\u003e\n        \u003cdiv\u003e\n          \u003cstrong\u003eHow distance is calculated\u003c\/strong\u003e\n          \u003cp\u003eAfter the 10 µs trigger pulse, the module fires eight 40 kHz bursts and raises ECHO HIGH for the duration the sound takes to travel to the target and back. Divide the echo time in microseconds by 58 to get centimetres, or by 148 for inches.\u003c\/p\u003e\n        \u003c\/div\u003e\n      \u003c\/div\u003e\n\n    \u003c\/section\u003e\n\n    \u003c!-- ══════════════ WIRING GUIDE ══════════════ --\u003e\n    \u003csection class=\"nznd__panel\" data-panel=\"wiring\" role=\"tabpanel\"\u003e\n\n      \u003cp class=\"nznd__eyebrow\"\u003ePinout \u0026amp; Wiring Instructions\u003c\/p\u003e\n      \u003cp class=\"nznd__body\"\u003eThe HC-SR04 has four pins in a single row: \u003cstrong\u003eVCC, TRIG, ECHO, GND\u003c\/strong\u003e — left to right when the two transducer cylinders face you.\u003c\/p\u003e\n\n      \u003cdiv class=\"nznd__wiring\"\u003e\n\n        \u003c!-- Module pin diagram --\u003e\n        \u003cdiv class=\"nznd__tobox\" aria-label=\"HC-SR04 pin diagram\"\u003e\n          \u003cp class=\"nznd__tobox-lbl\"\u003eHC-SR04 Pinout\u003c\/p\u003e\n\n          \u003csvg class=\"nznd__tosvg\" viewbox=\"0 0 160 220\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" role=\"img\" aria-label=\"HC-SR04 module front view showing VCC, TRIG, ECHO and GND pins\"\u003e\n            \u003cdefs\u003e\n              \u003clineargradient id=\"sr04-board\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\"\u003e\n                \u003cstop offset=\"0%\" stop-color=\"#1f6b3a\"\u003e\u003c\/stop\u003e\n                \u003cstop offset=\"100%\" stop-color=\"#144d2b\"\u003e\u003c\/stop\u003e\n              \u003c\/lineargradient\u003e\n              \u003clineargradient id=\"sr04-pin\" x1=\"0\" y1=\"0\" x2=\"1\" y2=\"0\"\u003e\n                \u003cstop offset=\"0%\" stop-color=\"#888\"\u003e\u003c\/stop\u003e\n                \u003cstop offset=\"45%\" stop-color=\"#d0d0d0\"\u003e\u003c\/stop\u003e\n                \u003cstop offset=\"100%\" stop-color=\"#999\"\u003e\u003c\/stop\u003e\n              \u003c\/lineargradient\u003e\n            \u003c\/defs\u003e\n\n            \u003c!-- PCB body --\u003e\n            \u003crect x=\"10\" y=\"10\" width=\"140\" height=\"130\" rx=\"6\" fill=\"url(#sr04-board)\" stroke=\"#0d3d20\" stroke-width=\"1.5\"\u003e\u003c\/rect\u003e\n\n            \u003c!-- Left transducer (Tx) --\u003e\n            \u003cellipse cx=\"45\" cy=\"65\" rx=\"26\" ry=\"26\" fill=\"#111\" stroke=\"#333\" stroke-width=\"1.5\"\u003e\u003c\/ellipse\u003e\n            \u003cellipse cx=\"45\" cy=\"65\" rx=\"19\" ry=\"19\" fill=\"#1a1a1a\"\u003e\u003c\/ellipse\u003e\n            \u003cellipse cx=\"45\" cy=\"65\" rx=\"4\" ry=\"4\" fill=\"#444\"\u003e\u003c\/ellipse\u003e\n            \u003ctext x=\"45\" y=\"103\" text-anchor=\"middle\" fill=\"#5dd68a\" font-size=\"7\" font-family=\"'Inter',sans-serif\" font-weight=\"700\"\u003eTX\u003c\/text\u003e\n\n            \u003c!-- Right transducer (Rx) --\u003e\n            \u003cellipse cx=\"115\" cy=\"65\" rx=\"26\" ry=\"26\" fill=\"#111\" stroke=\"#333\" stroke-width=\"1.5\"\u003e\u003c\/ellipse\u003e\n            \u003cellipse cx=\"115\" cy=\"65\" rx=\"19\" ry=\"19\" fill=\"#1a1a1a\"\u003e\u003c\/ellipse\u003e\n            \u003cellipse cx=\"115\" cy=\"65\" rx=\"4\" ry=\"4\" fill=\"#444\"\u003e\u003c\/ellipse\u003e\n            \u003ctext x=\"115\" y=\"103\" text-anchor=\"middle\" fill=\"#5dd68a\" font-size=\"7\" font-family=\"'Inter',sans-serif\" font-weight=\"700\"\u003eRX\u003c\/text\u003e\n\n            \u003c!-- Pin labels on PCB --\u003e\n            \u003ctext x=\"22\" y=\"122\" text-anchor=\"middle\" fill=\"#5dd68a\" font-size=\"6.5\" font-family=\"'Inter',sans-serif\" font-weight=\"700\"\u003eVCC\u003c\/text\u003e\n            \u003ctext x=\"57\" y=\"122\" text-anchor=\"middle\" fill=\"#5dd68a\" font-size=\"6.5\" font-family=\"'Inter',sans-serif\" font-weight=\"700\"\u003eTRIG\u003c\/text\u003e\n            \u003ctext x=\"96\" y=\"122\" text-anchor=\"middle\" fill=\"#5dd68a\" font-size=\"6.5\" font-family=\"'Inter',sans-serif\" font-weight=\"700\"\u003eECHO\u003c\/text\u003e\n            \u003ctext x=\"134\" y=\"122\" text-anchor=\"middle\" fill=\"#5dd68a\" font-size=\"6.5\" font-family=\"'Inter',sans-serif\" font-weight=\"700\"\u003eGND\u003c\/text\u003e\n\n            \u003c!-- Pin headers --\u003e\n            \u003crect x=\"16\" y=\"128\" width=\"12\" height=\"8\" rx=\"2\" fill=\"#c8a415\"\u003e\u003c\/rect\u003e\n            \u003crect x=\"51\" y=\"128\" width=\"12\" height=\"8\" rx=\"2\" fill=\"#c8a415\"\u003e\u003c\/rect\u003e\n            \u003crect x=\"90\" y=\"128\" width=\"12\" height=\"8\" rx=\"2\" fill=\"#c8a415\"\u003e\u003c\/rect\u003e\n            \u003crect x=\"128\" y=\"128\" width=\"12\" height=\"8\" rx=\"2\" fill=\"#c8a415\"\u003e\u003c\/rect\u003e\n\n            \u003c!-- Pin legs --\u003e\n            \u003crect x=\"20\" y=\"136\" width=\"4\" height=\"50\" fill=\"url(#sr04-pin)\" rx=\"1\"\u003e\u003c\/rect\u003e\n            \u003crect x=\"55\" y=\"136\" width=\"4\" height=\"50\" fill=\"url(#sr04-pin)\" rx=\"1\"\u003e\u003c\/rect\u003e\n            \u003crect x=\"94\" y=\"136\" width=\"4\" height=\"50\" fill=\"url(#sr04-pin)\" rx=\"1\"\u003e\u003c\/rect\u003e\n            \u003crect x=\"132\" y=\"136\" width=\"4\" height=\"50\" fill=\"url(#sr04-pin)\" rx=\"1\"\u003e\u003c\/rect\u003e\n\n            \u003c!-- Pin circles --\u003e\n            \u003ccircle cx=\"22\" cy=\"197\" r=\"9\" fill=\"#ff7a2f\"\u003e\u003c\/circle\u003e\n            \u003ccircle cx=\"57\" cy=\"197\" r=\"9\" fill=\"#ff7a2f\"\u003e\u003c\/circle\u003e\n            \u003ccircle cx=\"96\" cy=\"197\" r=\"9\" fill=\"#ff7a2f\"\u003e\u003c\/circle\u003e\n            \u003ccircle cx=\"134\" cy=\"197\" r=\"9\" fill=\"#ff7a2f\"\u003e\u003c\/circle\u003e\n\n            \u003ctext x=\"22\" y=\"201\" text-anchor=\"middle\" fill=\"#fff\" font-size=\"7.5\" font-family=\"'Inter',sans-serif\" font-weight=\"800\"\u003eV\u003c\/text\u003e\n            \u003ctext x=\"57\" y=\"201\" text-anchor=\"middle\" fill=\"#fff\" font-size=\"7.5\" font-family=\"'Inter',sans-serif\" font-weight=\"800\"\u003eT\u003c\/text\u003e\n            \u003ctext x=\"96\" y=\"201\" text-anchor=\"middle\" fill=\"#fff\" font-size=\"7.5\" font-family=\"'Inter',sans-serif\" font-weight=\"800\"\u003eE\u003c\/text\u003e\n            \u003ctext x=\"134\" y=\"201\" text-anchor=\"middle\" fill=\"#fff\" font-size=\"7.5\" font-family=\"'Inter',sans-serif\" font-weight=\"800\"\u003eG\u003c\/text\u003e\n          \u003c\/svg\u003e\n\n          \u003cp class=\"nznd__tobox-sub\"\u003e\n            \u003cspan\u003eV\u003c\/span\u003eCC  ·  \u003cspan\u003eT\u003c\/span\u003eRIG  ·  \u003cspan\u003eE\u003c\/span\u003eCHO  ·  \u003cspan\u003eG\u003c\/span\u003eND\n          \u003c\/p\u003e\n        \u003c\/div\u003e\n\n        \u003c!-- Wiring steps --\u003e\n        \u003col class=\"nznd__steps\" aria-label=\"Arduino wiring steps\"\u003e\n          \u003cli class=\"nznd__step\"\u003e\n            \u003cdiv class=\"nznd__step-n\"\u003e1\u003c\/div\u003e\n            \u003cdiv\u003e\n\u003cstrong\u003eVCC → 5V\u003c\/strong\u003e\u003cp\u003eConnect VCC to the 5V pin of your Arduino. Do not use 3.3V — the module requires 5V to operate.\u003c\/p\u003e\n\u003c\/div\u003e\n          \u003c\/li\u003e\n          \u003cli class=\"nznd__step\"\u003e\n            \u003cdiv class=\"nznd__step-n\"\u003e2\u003c\/div\u003e\n            \u003cdiv\u003e\n\u003cstrong\u003eGND → GND\u003c\/strong\u003e\u003cp\u003eCommon ground with your Arduino or ESP32.\u003c\/p\u003e\n\u003c\/div\u003e\n          \u003c\/li\u003e\n          \u003cli class=\"nznd__step\"\u003e\n            \u003cdiv class=\"nznd__step-n\"\u003e3\u003c\/div\u003e\n            \u003cdiv\u003e\n\u003cstrong\u003eTRIG → Digital Pin (e.g. D9)\u003c\/strong\u003e\u003cp\u003eSend a 10 µs HIGH pulse to trigger a reading. 3.3V GPIO is sufficient to trigger the module.\u003c\/p\u003e\n\u003c\/div\u003e\n          \u003c\/li\u003e\n          \u003cli class=\"nznd__step\"\u003e\n            \u003cdiv class=\"nznd__step-n\"\u003e4\u003c\/div\u003e\n            \u003cdiv\u003e\n\u003cstrong\u003eECHO → Digital Pin (e.g. D10)\u003c\/strong\u003e\u003cp\u003eReads the pulse duration. \u003cstrong\u003eArduino:\u003c\/strong\u003e connect directly. \u003cstrong\u003eESP32 \/ RPi:\u003c\/strong\u003e use a 1kΩ + 2kΩ voltage divider to drop 5V to 3.3V before connecting.\u003c\/p\u003e\n\u003c\/div\u003e\n          \u003c\/li\u003e\n          \u003cli class=\"nznd__step\"\u003e\n            \u003cdiv class=\"nznd__step-n\"\u003e5\u003c\/div\u003e\n            \u003cdiv\u003e\n\u003cstrong\u003eCalculate distance\u003c\/strong\u003e\u003cp\u003eUse \u003ccode\u003epulseIn(ECHO, HIGH)\u003c\/code\u003e to measure µs. Divide by 58 for cm or 148 for inches. The NewPing library simplifies this.\u003c\/p\u003e\n\u003c\/div\u003e\n          \u003c\/li\u003e\n        \u003c\/ol\u003e\n\n      \u003c\/div\u003e\n\n      \u003cdiv class=\"nznd__callout nznd__callout--orange\" role=\"note\"\u003e\n        \u003csvg viewbox=\"0 0 24 24\" fill=\"none\" stroke=\"#ff7a2f\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\u003e\u003cpolygon points=\"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2\"\u003e\u003c\/polygon\u003e\u003cline x1=\"12\" y1=\"8\" x2=\"12\" y2=\"12\"\u003e\u003c\/line\u003e\u003cline x1=\"12\" y1=\"16\" x2=\"12.01\" y2=\"16\"\u003e\u003c\/line\u003e\u003c\/svg\u003e\n        \u003cdiv\u003e\n          \u003cstrong\u003eMinimum 60 ms between readings\u003c\/strong\u003e\n          \u003cp\u003eWait at least 60 ms between trigger pulses to allow ultrasonic echoes to clear. Triggering too quickly causes false short-range readings from the previous cycle's echo.\u003c\/p\u003e\n        \u003c\/div\u003e\n      \u003c\/div\u003e\n\n    \u003c\/section\u003e\n\n    \u003c!-- ══════════════ COMMON USES ══════════════ --\u003e\n    \u003csection class=\"nznd__panel\" data-panel=\"uses\" role=\"tabpanel\"\u003e\n\n      \u003cp class=\"nznd__eyebrow\"\u003eApplications \u0026amp; Use Cases\u003c\/p\u003e\n      \u003cp class=\"nznd__body\"\u003eThe HC-SR04 is one of the most widely used sensors in hobbyist and maker projects. Its low cost, simple two-wire interface, and 4.5 m range make it ideal for anything from obstacle avoidance to liquid level monitoring.\u003c\/p\u003e\n\n      \u003cdiv class=\"nznd__uses\"\u003e\n        \u003cdiv class=\"nznd__use\"\u003e\n\u003cstrong\u003eObstacle Avoidance Robots\u003c\/strong\u003e\u003cp\u003eMount on a servo for sweeping detection or fixed for forward collision avoidance on Arduino and ESP32 rovers.\u003c\/p\u003e\n\u003c\/div\u003e\n        \u003cdiv class=\"nznd__use\"\u003e\n\u003cstrong\u003eParking Sensor\u003c\/strong\u003e\u003cp\u003eDIY garage or vehicle parking aid — beeps when an object is detected within a set distance.\u003c\/p\u003e\n\u003c\/div\u003e\n        \u003cdiv class=\"nznd__use\"\u003e\n\u003cstrong\u003eLiquid Level Monitoring\u003c\/strong\u003e\u003cp\u003eMeasure water tank, sump, or container fill levels without contact with the liquid.\u003c\/p\u003e\n\u003c\/div\u003e\n        \u003cdiv class=\"nznd__use\"\u003e\n\u003cstrong\u003ePeople \/ Object Counter\u003c\/strong\u003e\u003cp\u003eDetect when someone passes through a doorway or breaks the beam between two points.\u003c\/p\u003e\n\u003c\/div\u003e\n        \u003cdiv class=\"nznd__use\"\u003e\n\u003cstrong\u003eHeight Measurement\u003c\/strong\u003e\u003cp\u003eNon-contact height gauging for conveyor systems, sorting machines, or interactive installations.\u003c\/p\u003e\n\u003c\/div\u003e\n        \u003cdiv class=\"nznd__use\"\u003e\n\u003cstrong\u003eHome Automation\u003c\/strong\u003e\u003cp\u003eTrigger lights, fans, or alarms based on detected presence or proximity with ESPHome or Home Assistant.\u003c\/p\u003e\n\u003c\/div\u003e\n      \u003c\/div\u003e\n\n      \u003cdiv class=\"nznd__callout nznd__callout--blue\" role=\"note\"\u003e\n        \u003csvg viewbox=\"0 0 24 24\" fill=\"none\" stroke=\"#4a9af7\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\u003e\u003ccircle cx=\"12\" cy=\"12\" r=\"10\"\u003e\u003c\/circle\u003e\u003cline x1=\"12\" y1=\"16\" x2=\"12\" y2=\"12\"\u003e\u003c\/line\u003e\u003cline x1=\"12\" y1=\"8\" x2=\"12.01\" y2=\"8\"\u003e\u003c\/line\u003e\u003c\/svg\u003e\n        \u003cdiv\u003e\n          \u003cstrong\u003eESPHome integration\u003c\/strong\u003e\n          \u003cp\u003eThe HC-SR04 is natively supported in ESPHome with the \u003ccode\u003eultrasonic\u003c\/code\u003e sensor platform. Define TRIG and ECHO pins and get distance readings directly in Home Assistant with no extra code.\u003c\/p\u003e\n        \u003c\/div\u003e\n      \u003c\/div\u003e\n\n    \u003c\/section\u003e\n\n    \u003c!-- ══════════════ FAQs ══════════════ --\u003e\n    \u003csection class=\"nznd__panel\" data-panel=\"faq\" role=\"tabpanel\"\u003e\n\n      \u003cp class=\"nznd__eyebrow\"\u003eFrequently Asked Questions\u003c\/p\u003e\n\n      \u003cdl class=\"nznd__faq\"\u003e\n\n        \u003cdiv class=\"nznd__faq-item\"\u003e\n          \u003cdt\u003e\u003cbutton class=\"nznd__faq-q\" type=\"button\" aria-expanded=\"false\"\u003e\n            Will the HC-SR04 work with an ESP32 or Raspberry Pi at 3.3V?\n            \u003cspan class=\"nznd__faq-icon\"\u003e\u003csvg viewbox=\"0 0 12 12\" fill=\"none\" stroke-width=\"2\" stroke-linecap=\"round\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\u003e\u003cline x1=\"6\" y1=\"2\" x2=\"6\" y2=\"10\"\u003e\u003c\/line\u003e\u003cline x1=\"2\" y1=\"6\" x2=\"10\" y2=\"6\"\u003e\u003c\/line\u003e\u003c\/svg\u003e\u003c\/span\u003e\n          \u003c\/button\u003e\u003c\/dt\u003e\n          \u003cdd class=\"nznd__faq-a\"\u003eThe module itself needs 5V on VCC to function. The TRIG pin can be driven from 3.3V GPIO. The ECHO pin outputs 5V however, which can damage 3.3V microcontrollers — use a 1kΩ\/2kΩ voltage divider or a logic level shifter on the ECHO line before connecting to an ESP32 or Raspberry Pi.\u003c\/dd\u003e\n        \u003c\/div\u003e\n\n        \u003cdiv class=\"nznd__faq-item\"\u003e\n          \u003cdt\u003e\u003cbutton class=\"nznd__faq-q\" type=\"button\" aria-expanded=\"false\"\u003e\n            What is the minimum detectable distance?\n            \u003cspan class=\"nznd__faq-icon\"\u003e\u003csvg viewbox=\"0 0 12 12\" fill=\"none\" stroke-width=\"2\" stroke-linecap=\"round\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\u003e\u003cline x1=\"6\" y1=\"2\" x2=\"6\" y2=\"10\"\u003e\u003c\/line\u003e\u003cline x1=\"2\" y1=\"6\" x2=\"10\" y2=\"6\"\u003e\u003c\/line\u003e\u003c\/svg\u003e\u003c\/span\u003e\n          \u003c\/button\u003e\u003c\/dt\u003e\n          \u003cdd class=\"nznd__faq-a\"\u003eThe blind zone starts at 2 cm. Objects closer than 2 cm may not be reliably detected. For very close-range sensing consider an IR proximity sensor instead.\u003c\/dd\u003e\n        \u003c\/div\u003e\n\n        \u003cdiv class=\"nznd__faq-item\"\u003e\n          \u003cdt\u003e\u003cbutton class=\"nznd__faq-q\" type=\"button\" aria-expanded=\"false\"\u003e\n            How do I calculate distance from the ECHO pulse?\n            \u003cspan class=\"nznd__faq-icon\"\u003e\u003csvg viewbox=\"0 0 12 12\" fill=\"none\" stroke-width=\"2\" stroke-linecap=\"round\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\u003e\u003cline x1=\"6\" y1=\"2\" x2=\"6\" y2=\"10\"\u003e\u003c\/line\u003e\u003cline x1=\"2\" y1=\"6\" x2=\"10\" y2=\"6\"\u003e\u003c\/line\u003e\u003c\/svg\u003e\u003c\/span\u003e\n          \u003c\/button\u003e\u003c\/dt\u003e\n          \u003cdd class=\"nznd__faq-a\"\u003eMeasure the ECHO HIGH duration in microseconds using \u003ccode\u003epulseIn(echoPin, HIGH)\u003c\/code\u003e. Divide by 58 to get centimetres, or by 148 for inches. This accounts for the round-trip travel of the sound pulse. The NewPing Arduino library handles all of this automatically.\u003c\/dd\u003e\n        \u003c\/div\u003e\n\n        \u003cdiv class=\"nznd__faq-item\"\u003e\n          \u003cdt\u003e\u003cbutton class=\"nznd__faq-q\" type=\"button\" aria-expanded=\"false\"\u003e\n            How often can I take readings?\n            \u003cspan class=\"nznd__faq-icon\"\u003e\u003csvg viewbox=\"0 0 12 12\" fill=\"none\" stroke-width=\"2\" stroke-linecap=\"round\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\u003e\u003cline x1=\"6\" y1=\"2\" x2=\"6\" y2=\"10\"\u003e\u003c\/line\u003e\u003cline x1=\"2\" y1=\"6\" x2=\"10\" y2=\"6\"\u003e\u003c\/line\u003e\u003c\/svg\u003e\u003c\/span\u003e\n          \u003c\/button\u003e\u003c\/dt\u003e\n          \u003cdd class=\"nznd__faq-a\"\u003eWait at least 60 ms between trigger pulses. Faster polling risks detecting the echo from the previous cycle, giving spuriously short readings. In practice 100 ms (10 readings per second) is a safe rate for most applications.\u003c\/dd\u003e\n        \u003c\/div\u003e\n\n        \u003cdiv class=\"nznd__faq-item\"\u003e\n          \u003cdt\u003e\u003cbutton class=\"nznd__faq-q\" type=\"button\" aria-expanded=\"false\"\u003e\n            Does it work with soft surfaces like foam or fabric?\n            \u003cspan class=\"nznd__faq-icon\"\u003e\u003csvg viewbox=\"0 0 12 12\" fill=\"none\" stroke-width=\"2\" stroke-linecap=\"round\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\u003e\u003cline x1=\"6\" y1=\"2\" x2=\"6\" y2=\"10\"\u003e\u003c\/line\u003e\u003cline x1=\"2\" y1=\"6\" x2=\"10\" y2=\"6\"\u003e\u003c\/line\u003e\u003c\/svg\u003e\u003c\/span\u003e\n          \u003c\/button\u003e\u003c\/dt\u003e\n          \u003cdd class=\"nznd__faq-a\"\u003eSoft or angled surfaces absorb or scatter ultrasonic energy, reducing effective range and accuracy. For best results aim at flat, hard surfaces such as walls, water, or solid objects. Angled surfaces should be within roughly 15° of perpendicular to the sensor face.\u003c\/dd\u003e\n        \u003c\/div\u003e\n\n        \u003cdiv class=\"nznd__faq-item\"\u003e\n          \u003cdt\u003e\u003cbutton class=\"nznd__faq-q\" type=\"button\" aria-expanded=\"false\"\u003e\n            Is there an Arduino library I can use?\n            \u003cspan class=\"nznd__faq-icon\"\u003e\u003csvg viewbox=\"0 0 12 12\" fill=\"none\" stroke-width=\"2\" stroke-linecap=\"round\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\u003e\u003cline x1=\"6\" y1=\"2\" x2=\"6\" y2=\"10\"\u003e\u003c\/line\u003e\u003cline x1=\"2\" y1=\"6\" x2=\"10\" y2=\"6\"\u003e\u003c\/line\u003e\u003c\/svg\u003e\u003c\/span\u003e\n          \u003c\/button\u003e\u003c\/dt\u003e\n          \u003cdd class=\"nznd__faq-a\"\u003eYes — the \u003cstrong\u003eNewPing\u003c\/strong\u003e library by Tim Eckel is the most popular choice. Install it via the Arduino Library Manager. It simplifies triggering, echo timing, and includes median filtering to reduce noise. For ESPHome users, the built-in \u003ccode\u003eultrasonic\u003c\/code\u003e platform works out of the box.\u003c\/dd\u003e\n        \u003c\/div\u003e\n\n      \u003c\/dl\u003e\n\n    \u003c\/section\u003e\n\n  \u003c\/div\u003e\n\u003c\/article\u003e\n\n\u003cscript\u003e\n(function () {\n  'use strict';\n  var w = document.currentScript\n    ? (document.currentScript.closest('.nznd') || document.querySelector('.nznd'))\n    : document.querySelector('.nznd');\n  if (!w) return;\n\n  w.addEventListener('click', function (e) {\n\n    \/* Tab switch *\/\n    var tab = e.target.closest('.nznd__tab');\n    if (tab) {\n      var target = tab.getAttribute('data-tab');\n      w.querySelectorAll('.nznd__tab').forEach(function (t) { t.classList.remove('is-active'); t.setAttribute('aria-selected','false'); });\n      w.querySelectorAll('.nznd__panel').forEach(function (p) { p.classList.remove('is-active'); });\n      tab.classList.add('is-active');\n      tab.setAttribute('aria-selected','true');\n      var panel = w.querySelector('[data-panel=\"' + target + '\"]');\n      if (panel) panel.classList.add('is-active');\n      return;\n    }\n\n    \/* FAQ accordion *\/\n    var btn = e.target.closest('.nznd__faq-q');\n    if (btn) {\n      var item = btn.closest('.nznd__faq-item');\n      var open = item.classList.contains('is-open');\n      w.querySelectorAll('.nznd__faq-item').forEach(function (x) {\n        x.classList.remove('is-open');\n        x.querySelector('.nznd__faq-q').setAttribute('aria-expanded','false');\n      });\n      if (!open) { item.classList.add('is-open'); btn.setAttribute('aria-expanded','true'); }\n    }\n\n  });\n}());\n\u003c\/script\u003e","brand":"NZN Electronics","offers":[{"title":"1 Pack","offer_id":42861955154016,"sku":"HCSR04-1PK","price":3.89,"currency_code":"NZD","in_stock":true},{"title":"3 Pack","offer_id":42861955186784,"sku":"HCSR04-3PK","price":11.29,"currency_code":"NZD","in_stock":true},{"title":"5 Pack","offer_id":42861955219552,"sku":"HCSR04-5PK","price":18.19,"currency_code":"NZD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0664\/6127\/0112\/files\/HC-SR-04-IR-Sensor-ProductHero.png?v=1781062116","url":"https:\/\/www.nznelectronics.co.nz\/products\/hc-sr04-ultrasonic-distance-sensor-module","provider":"NZN Electronics","version":"1.0","type":"link"}