Extension board · Sensors and inputs
A very simple knock and shake detector. A spring switch closes for an instant when the board is shaken; the circuit stretches that into a pulse of about 34 ms, long enough for the controller to notice and run a command.
| Purpose | Detecting a knock or that a machine is moving. Not a measuring instrument and not a crash-protection or safety device |
| Sensor | SW-18020P spring switch, mounted lying down |
| Output | Digital, high while vibration is detected, through 100 Ω |
| Supply | 3.3 V from the socket, under 2 mA |
| Indicator | Green LED lit while the output is high |
| Sockets | Two 10-contact Gadgeteer type X sockets (Samtec SHF-105, 1.27 mm): input and chain |
| Size | 50 × 55 mm, four M3 holes on a 40 × 40 mm pattern |
| Works with | Smoothieboard V2 Prime header GF through the button box module |
| 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) — The type X socket to the controller; the signal is on contact 3.
2Chain socket CHAIN (J2) — Passes the unused contacts on.
3Vibration switch (SW1) — A spring around a pin inside a small tube; sensitivity depends on how the board is oriented.
4Pulse stretcher (R1, R2, C1) — A closing switch empties the capacitor quickly; the 470 kΩ resistor refills it slowly.
5Schmitt inverter (U1) — SN74LVC1G14 turns the slow capacitor voltage into a clean digital pulse.
6Output resistor (R3) — 100 Ω in series with contact 3.
7Indicator (D1, R4) — Green LED, lit while the output is high.
8LED link (JP20) — Closed as delivered; open it to switch the LED off.
9Chain link (JP3) — Open as delivered, keeping the signal off the chain.
10Mounting hole — One of four M3 holes. Mount rigidly to the part being watched.
Check contact numbering with the power removed before wiring by hand.
| Contact | Signal | Use | Prime header GF |
|---|---|---|---|
| 1 | 3.3 V | Logic and LED supply | 3.3 V |
| 2 | 5 V | Passed to the chain only | 5 V |
| 3 | VIB | High while shaking | PB1 |
| 4 to 9 | Passed through | Not used | PJ4, PA4, PG0, PJ3, PG1, PJ2 |
| 10 | GND | Ground | GND |
Screw it firmly to the part to be monitored.
Plug J1 into header GF.
Power up and tap it gently while watching the LED.
By design the LED flashes briefly for each knock; the simulated pulse is about 34 ms.
Use the entry below, restart and tap again with a terminal open.
The configured command should run when the output goes high.
| You want | Module | Example |
|---|---|---|
| Run a command on a knock | Button box | The entry below |
| Measure vibration strength | None | The board only gives on/off |
Add this to config.ini. The pulse is shorter than the button box default polling period of 50 ms (20 Hz), so raise the polling rate. Replace the echo command with your own.
[button box]
common.poll_frequency_hz = 100
shake.enable = true
shake.pin = PB1
shake.press = echo vibration detected
See the SmoothieV2 button box module. The common polling rate applies to every button in the section.
At rest the capacitor is charged to 3.3 V and the inverter output is low. A shake closes the spring switch for a couple of milliseconds, which discharges the capacitor through 100 Ω. The output goes high and stays high while the 470 kΩ resistor recharges the capacitor up to the inverter threshold. Repeated shaking keeps the output high.
Leave JP3 open while the sensor is in use. Open JP20 if the light is unwanted.
| Link | What it does | As delivered |
|---|---|---|
| JP3 | Joins contact 3 to the chain socket | Open |
| JP20 | Powers the indicator LED from the output | Closed |
A further board on CHAIN can use contacts 4 to 9.
| Contact | Signal | On CHAIN |
|---|---|---|
| 1, 2, 10 | Power and ground | Passed on |
| 3 | Vibration | Stopped by open JP3 |
| 4 to 9 | Free | Passed on |
| Symptom | Likely cause | What to check |
|---|---|---|
| LED never lights | No 3.3 V, JP20 open, or vibration too weak | Test point 3.3 V, then tap harder or turn the board |
| LED lights but no command runs | Polling too slow or wrong pin | Set the polling rate to 100 Hz and use PB1 |
| Triggers constantly | Machine vibration or loose mounting | Mount elsewhere; the switch has no adjustment |
| Misses some knocks | Knock along an insensitive direction | Change the board orientation |
| Light | Meaning |
|---|---|
| Green (D1) | Output high: vibration detected |
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 |
| 3D view, angled (PNG) | Rendered from the design files |
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.
| Hole | X (mm) | Y (mm) | Diameter | Use |
|---|---|---|---|---|
| 1 | 5.00 | 5.00 | 3.2 mm, not plated | Mounting, M3 screw |
| 2 | 45.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 | 45.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 |
|---|---|---|---|---|---|
| Supply voltage | J1 contact 1 | — | 3.3 V | — | Design |
| Supply current | 3.3 V | — | — | 2 mA | Calculated, LED lit |
| Output pulse from 2 ms contact | Contact 3 | — | 34 ms | — | Simulated; depends on inverter threshold |
| Peak contact current | SW1 | — | 25 mA | — | Simulated |
| Output series resistance | Contact 3 | — | 100 Ω | — | Design |
| Part | Limit | Use on this board |
|---|---|---|
| Switch contact current | 50 mA (limit used) | 25 mA peak (simulated) |
| Capacitors | 16 V | 3.3 V |
The pulse stretcher was simulated with ngspice for a 2 ms switch closure, with an assumed 1.6 V inverter threshold.
| Result | Simulated value | Limit | Outcome |
|---|---|---|---|
| Output pulse from a 2 ms contact closure | 33.8 ms | 15 ms to 60 ms | Within |
| Peak contact current against 50 mA rating | 25.4 mA | at most 50 mA | Within |
| Node level while closed | 913 µV | at most 400 mV | Within |
Not simulated: mechanical sensitivity, frequency response, contact bounce and the spread of the inverter threshold.
The first page of each manufacturer data sheet. Click a page to open the PDF.
See all boards on the extension boards page.