ToolSphere
All perfboard layouts

Nano HC-SR04 Buzzer Perfboard Layout

A classic 5 V Nano reads an ultrasonic distance sensor and drives a quiet passive piezo. This layout is schematic-verified, not physically prototype-tested.

Nano + HC-SR04 and piezo buzzer perfboard layoutA1 NanoJ1 5V INPUTJ2 HC-SR04R1 1kJ3 PIEZOR2 10kC1 100nC2 10u
Open this layout in the simulator Connection check: no shorts, 6 named nets

Red wires carry power, white is ground, yellow and blue are signals. Every hole is an isolated pad; connections are the wires shown. In the simulator you can move parts, add your own and re-run the check.

Parts list

As an Amazon Associate, ToolSphere earns from qualifying purchases.

How it works

Use the classic ATmega328P Arduino Nano with 5 V logic, not a Nano ESP32 or another 3.3 V variant. Compare the official Nano pinout with your module before soldering socket rows. The Nano USB end is at the left of this turned footprint. Spare pins, including VIN, remain unused intentionally.

Sensor header J2: VCC goes to +5V, TRIG to D2, ECHO to D3 and GND to the common return. J2 represents a cable header, not the sensor's physical body. Match the HC-SR04's printed pin names; do not assume a cable preserves their order. Mount the transducers facing away from the board with a clear sound path.

The HC-SR04 datasheet calls for a trigger pulse at least 10 µs high and recommends measurement cycles longer than 60 ms. Firmware times the ECHO high pulse to estimate round-trip travel. Give the read a finite timeout; a missing echo is an invalid measurement, not a nearby object. Soft, angled or small targets can give unreliable returns. This is a maker demonstration, not a collision-prevention device.

Buzzer header J3: D5 reaches the passive piezo's positive terminal through R1, a 1 kΩ resistor. Its other terminal goes to GND, with R2, 10 kΩ, across the piezo. Use a capacitive passive piezo transducer, not a magnetic buzzer, speaker or unknown active module. Call Arduino's tone function on D5 for sound and noTone to stop. A steady HIGH will not make a sustained tone from a passive transducer.

For an ideal 5 V pin and a zero-voltage load, the site's Ohm's law library computes 5 mA through R1. This is a feed-current bound, not the piezo's continuous current or a loudness prediction. The conservative resistor makes a quiet indicator; use a separately designed driver if you need more sound. R2 provides a discharge path. This circuit does not need a flyback diode because the specified transducer is capacitive.

Power: J1 takes regulated 5 V, with C1 ceramic bypass and polarized C2 bulk capacitance near the sensor header. Both Nano ground pins join the return. Use one power source at a time: disconnect J1 before USB programming, with external peripherals unpowered. Do not feed 9 V into the 5V header. ECHO is a 5 V signal here; a 3.3 V controller needs a different design with suitable level conversion.

Use isolated-pad perfboard with insulated jumpers. The top-row junctions are individual endpoints, not a continuous copper bus. Wire crossings are not solder joints. The checker verifies continuity and shorts, not ultrasonic measurements or firmware. No sketch is included: initialize TRIG low, implement the timing and timeout, and choose your own valid-distance alarm threshold.

Building it, step by step

  1. Fit socket rows for a classic Nano and headers J1, J2 and J3. Verify the USB orientation and every header label before wiring.
  2. With the Nano removed, wire regulated 5 V, common ground and both bypass capacitors. C2 positive goes to +5V. Check for supply shorts and measure the rail before inserting the Nano.
  3. Wire J2 VCC/GND to power, TRIG to D2 and ECHO to D3. Match the sensor labels at both ends of its cable.
  4. Wire D5 through R1 to J3 positive, with R2 across J3 and J3 negative grounded. Attach only the specified passive piezo.
  5. Program the Nano separately over USB. Use a finite echo timeout, spaced measurements and an explicit invalid-reading state. Generate sound with tone on D5 only for a valid alarm condition.
  6. Remove USB and power before inserting the Nano. Start on current-limited external 5 V, verify rails, then test with a broad flat target and confirm missing echoes do not trigger a false near-distance result.

Tools for this build

Frequently asked questions

Which Arduino Nano does this use?

The classic 5 V ATmega328P Nano. Other Nano families have different logic levels and may have different power requirements.

Which pins connect to the sensor?

D2 is TRIG, D3 is ECHO, with VCC at regulated 5 V and GND shared with the Nano. Check the sensor labels rather than relying on cable colors.

Can I use an active buzzer or a speaker?

No direct substitution is specified. This layout uses a capacitive passive piezo through a series resistor. Other loads require an appropriate driver and rating check.

Does this include an Arduino sketch?

No. The layout fixes the wiring and pin assignments. Your sketch must implement triggering, echo timing, timeouts and the alarm behavior.

What does no echo mean?

It is an invalid measurement. It can mean no usable target, poor reflection or a wiring problem; it must not be treated as zero distance.

Does the simulator measure distance or play the buzzer?

No. It checks the drawn electrical connections. Verify sensor readings, tone generation and alarm behavior on the actual hardware.