Extension board · Sensors and inputs
A carrier for the common HC-SR04 ultrasonic distance module. It powers the module from 5 V and brings its echo signal down to a level the controller accepts. Measuring distance means timing a pulse, which needs your own driver.
| Purpose | Coarse non-contact distance or presence sensing, for example a material or enclosure check |
| Module | HC-SR04 with 5V, TRIG, ECHO, GND pins; bought separately |
| Module connectors | J3: four-way 2.54 mm right-angle socket. J4: alternative four-way JST PH footprint, not fitted; use only one |
| Signals | Trigger through 220 Ω with 100 kΩ pull-down; echo through a 10 kΩ / 18 kΩ divider |
| Supply | 5 V from the socket |
| Sockets | Two 10-contact Gadgeteer type X sockets (Samtec SHF-105, 1.27 mm): input and chain |
| Size | 60 × 50 mm, four M3 holes on a 50 × 40 mm pattern; the module overhangs the edge |
| Works with | Smoothieboard V2 Prime header GF electrically; no firmware driver |
| Licence | Open hardware, CERN-OHL-S-2.0 |
Every figure with its basis is in the electrical specifications appendix; hole positions are in the mounting dimensions appendix.
The numbers on the drawing match the list below it. The board is shown from the component side.
1Input socket X IN (J1) — Trigger on contact 3, echo on contact 4.
2Chain socket CHAIN (J2) — Passes the unused contacts on.
3Module socket (J3) — The module plugs in here, matching the printed order 5V, TRIG, ECHO, GND.
4Cable connector position (J4) — Alternative footprint for a module on a cable.
5Trigger parts (R1, R2) — Series resistor, and a pull-down that keeps the module idle while the pin floats.
6Echo divider (R3, R4) — Brings the 5 V echo down to about 3.3 V.
7Supply capacitors (C1, C2) — 100 nF and 10 µF on 5 V.
8Power light (D1, R5) — Green, lit when 5 V is present.
9LED link (JP9) — Closed as delivered.
10Chain links (JP3, JP4) — Open as delivered, keeping trigger and echo off the chain.
11Mounting hole — One of four M3 holes.
Check contact numbering and the module’s pin order before applying power.
| Contact | Signal | Use | Prime header GF |
|---|---|---|---|
| 1 | 3.3 V | Passed to the chain | 3.3 V |
| 2 | 5 V | Module supply | 5 V |
| 3 | TRIG | Output from controller | PB1 |
| 4 | ECHO | Input to controller | PJ4 |
| 5 to 9 | Passed through | Not used | PA4, PG0, PJ3, PG1, PJ2 |
| 10 | GND | Ground | GND |
| Pin | Signal |
|---|---|
| 1 | 5 V |
| 2 | TRIG |
| 3 | ECHO |
| 4 | GND |
With the power off, match 5V, TRIG, ECHO and GND to the printing.
Point the module at a flat target and keep the beam clear of the machine frame.
Plug J1 into header GF.
The green LED should light.
Pulse the trigger for at least 10 µs and time the echo pulse; wait 60 ms or more between measurements.
By the module data sheet, the pulse width in microseconds divided by 58 gives the distance in centimetres.
| You want | Module | Example |
|---|---|---|
| Read distance | None | No SmoothieV2 module drives an HC-SR04 |
There is nothing to add to config.ini.
The module sends an ultrasonic burst after each trigger and holds its echo output high for as long as the sound takes to return. The two resistors scale that 5 V signal by 18/28. Their effect on timing is small: the simulated rise time of 0.42 µs corresponds to well under a tenth of a millimetre.
Leave JP3 and JP4 open while the module is in use.
| Link | What it does | As delivered |
|---|---|---|
| JP3 | Joins contact 3 to the chain socket | Open |
| JP4 | Joins contact 4 to the chain socket | Open |
| JP9 | Powers the green LED | Closed |
A further board on CHAIN can use contacts 5 to 9.
| Contact | Signal | On CHAIN |
|---|---|---|
| 1, 2, 10 | Power and ground | Passed on |
| 3, 4 | Trigger, echo | Stopped by open links |
| 5 to 9 | Free | Passed on |
| Symptom | Likely cause | What to check |
|---|---|---|
| No echo at all | No 5 V, module plugged in wrongly, or trigger too short | LED, pin order, a 10 µs or longer pulse |
| Module ignores the trigger | Module needs a 5 V trigger level | Try another module |
| Erratic distance | Soft or angled target, or measurements too close together | Use a flat target and wait 60 ms |
| Distance slightly off | Air temperature changes the speed of sound | Calibrate in place |
| Light | Meaning |
|---|---|
| Green (D1) | 5 V present |
Still stuck? Read how to ask for help or see the general troubleshooting guide.
| File | What it is |
|---|---|
| Schematic (PDF) | The circuit diagram |
| Parts list (CSV) | Every component with its value, footprint and part number where one is chosen |
| Board drawing (PNG) | The top view used on this page |
| 3D view, top (PNG) | Rendered from the design files; the module itself is not shown |
| 3D view, angled (PNG) | Rendered from the design files; the module itself is not shown |
For drilling a mounting plate or designing an enclosure. Positions are hole centres, in millimetres, measured from the top-left corner with the board seen from the component side. Allow for the module overhanging the board edge.
| Hole | X (mm) | Y (mm) | Diameter | Use |
|---|---|---|---|---|
| 1 | 5.00 | 5.00 | 3.2 mm, not plated | Mounting, M3 screw |
| 2 | 55.00 | 5.00 | 3.2 mm, not plated | Mounting, M3 screw |
| 3 | 5.00 | 45.00 | 3.2 mm, not plated | Mounting, M3 screw |
| 4 | 55.00 | 45.00 | 3.2 mm, not plated | Mounting, M3 screw |
Every figure is a design value, a calculated or simulated value, or a manufacturer’s data sheet value, as the last column says. A dash means no figure is given.
| Parameter | Applies to | Lower | Nominal | Upper | Basis |
|---|---|---|---|---|---|
| Module supply | 5 V | — | 5 V | — | Design |
| Module current | 5 V | — | 15 mA | — | Module data sheet |
| Range | Module | 2 cm | — | 4 m | Module data sheet |
| Trigger pulse | Contact 3 | 10 µs | — | — | Module data sheet |
| Measurement interval | Module | 60 ms | — | — | Module data sheet |
| Echo high at controller | Contact 4 | 2.83 V | — | 3.37 V | Simulated for 4.4 to 5.25 V from the module |
| Echo rise time | Contact 4 | — | 0.42 µs | — | Simulated |
| Part | Limit | Use on this board |
|---|---|---|
| Echo divider | Limits current into the controller through 10 kΩ | 5 V module signal |
| Capacitors | 10 V and 16 V | 5 V |
The echo divider was simulated with ngspice at the highest and a low module output voltage.
| Result | Simulated value | Limit | Outcome |
|---|---|---|---|
| Host input high level at 5.25 V echo | 3.37 V | 2.4 V to 3.45 V | Within |
| Echo rise time (1 us equals 0.17 mm of range) | 424 ns | at most 1 µs | Within |
| Host input high level at 4.4 V echo | 2.83 V | at least 2.31 V | Within |
Not simulated: the module itself, its acoustics and its timing.
The first page of the module data sheet. Click the page to open the PDF. It is a copy distributed by a reseller.
See all boards on the extension boards page.