Skip to content
You Start with one site
Amounts in Start with one site
Build · Machines and maintenance

The machine condition monitor: hear a bearing failing weeks before it stops the line.

A pump bearing seizes on a Friday night. The line stops, the spare is two days away, and the weekend's orders go out late. Looking back, the warning was there for weeks: the machine was shaking a little more every day, and nobody was measuring it.

Build a small monitor for that motor or pump. It feels the vibration three thousand times a second, turns it into the numbers a vibration analyst reads first, and tells the right person when the machine starts to change.

About KSh 4,030USD 31 in parts Printing: 6 to 9 hours Building: a weekend
Found this useful?
The box from the model, and the sensor pod on the right: the accelerometer glued straight onto a steel magnet, with a printed cap over it.

What you end with

A motor or pump that reports its condition every minute: how hard it is shaking (velocity in mm/s, in three directions), which zone that is, whether impacts are showing, the main frequencies, the bearing temperature, and how long and how often it runs. You get an alert when the zone changes, when the vibration has doubled from the machine's own normal, and when the monitor goes quiet.

Samples3200 a second
Velocity band10 Hz to 1 kHz
Sensor floorabout 0.2 mm/s
Readingsone a minute
Sentfeatures, not waves
Kept offline12 hours
Never near a moving machine. Fit the sensor, the probe and the cables only with the machine stopped, isolated and locked off by the person responsible for it. Keep every cable clear of shafts, couplings, belts and fans, and tie it down. The monitor only measures: it never stops or starts the machine.

What you need

Rough prices for single parts bought online, in

Get the parts wherever suits you: a local electronics shop, or online. Pick a shop and each Find it link searches there.

#PartQtyAbout
1ESP32 DevKitAny 30 or 38 pin boardFind it1KSh 650USD 5.00
2ADXL345 accelerometer (GY-291)3 axes, 3200 samples a second on SPIFind it1KSh 260USD 2.00
3Pot magnet, 32 mmFlat face; the sensor is glued on its steel topFind it1KSh 325USD 2.50
4DS18B20 temperature probeSteel probe on a 1 m cableFind it1KSh 195USD 1.50
5Current clamp (optional)SCT-013-030, 1 V at 30 A, for running hours from the currentFind it1KSh 650USD 5.00
6Shielded cable, 8 coreFrom the sensor to the box; 1 m or lessFind it1 mKSh 260USD 2.00
7Perfboard and parts4.7 k, two 10 k, 10 µF, screw terminalsFind it1KSh 130USD 1.00
8PG7 cable glandsFor 3 to 6.5 mm cablesFind it4KSh 260USD 2.00
9Two-part epoxyHard setting, to fix the sensor to the magnetFind it1KSh 260USD 2.00
10USB cable and 5 V adapter1 A or moreFind it1KSh 520USD 4.00
11Screws4 x M3 x 10 for the lid, 2 for the frameFind it6KSh 130USD 1.00
12PETGCopes with a warm motor roomFind it150 gKSh 390USD 3.00
TotalKSh 4,030USD 31

Also: a 3D printer, a soldering iron, aluminium tape, and an account on siliconwit.io (free).

The box open on the wall, and the sensor pod beside it with its cap off, each part marked with its number from the parts list. In the box: 1, the ESP32 DevKit, on the left with its USB plug below it; 7, the perfboard and parts, at the top right; 8, the four holes in the floor for the cable glands. On the right: 2, the ADXL345 sensor board, glued on 3, the pot magnet.
Where each part goes, numbered as in the list above. The sensor (2) is glued on the steel top of the magnet (3), which goes on the machine; the box hangs on the frame or a wall. The temperature probe (4) and the clamp (5) sit at the machine, and their cables come in through the glands (8).
Why the ADXL345. It is the cheapest part that can do this job properly. At 3200 samples a second its band reaches 1600 Hz, so the usual 10 Hz to 1 kHz velocity band fits, and its noise reads about 0.2 mm/s: well under the zone boundaries. The MPU6050 is cheaper but stops near 260 Hz, too low for this. The ADXL345 has no anti-alias filter, so strong vibration above 1600 Hz can fold back into the band.
What it cannot do. It shows that a machine has changed: unbalance, looseness, misalignment and a rising overall level. It cannot see an early rolling-bearing defect, which rings at several kilohertz and starts very small. For that you need a wide-band sensor (the IIS3DWB class, flat to 6 kHz) or an industrial piezoelectric accelerometer on a stud.

The design, in 3D and on paper

Turn it, open Parts to hide the lid or the pod cap, and use Section to cut through the box and the sensor pod. The parts carry the numbers of the parts list.

The machine condition monitor: the box, the lid, the sensor pod and the parts inside. Drag to turn, pinch or scroll to zoom. Open in the full viewer.
A3 assembly drawing, first angle. The front view of the box with the lid taken off shows the ESP32 DevKit on the left and the perfboard on the right. To its right, the view from the left and section A-A through the third gland hole and the perfboard, hatched, with the lid's skirt hanging over the walls. Below, at twice full size, the sensor pod from above and section B-B through its axis: the sensor board glued on the magnet, under the cap. Sizes 100.8 by 146.8 by 36.8 mm, pod 36.6 mm across and 15.1 mm tall. Balloons match the item list: 1, 2, 3, 7 and 8, then 13 to 15 for the box, the lid and the pod cap.
The A3 assembly drawing (click for the PDF). Sheets 2 to 4 give every size of the box, the lid and the pod cap.

Build it

Each step links to the lesson section that teaches it. Open one only when you need it.

Build track
Follow this build, one step at a time

Tick each step as you finish it. Your place is kept, so you can stop and come back.

1

Wire it on the desk

Wire it on the desk first, and fit it to the machine only when it works.

Wiring drawing. ADXL345 CS to GPIO 5, SCL to GPIO 18, SDO to GPIO 19, SDA to GPIO 23, VCC to 3.3 V. DS18B20 data to GPIO 4 with 4.7 k to 3.3 V. The optional SCT-013-030 clamp: one lead to GPIO 34, the other to a bias point made by two 10 k resistors between 3.3 V and ground, with 10 microfarads from the bias point to ground.
Open the drawing full size. The ADXL345 runs on SPI here: at 3200 samples a second the slower I2C bus cannot keep up.
  • Keep the sensor cable under 1 m and shielded, with the shield to GND at the box end only. Long SPI wires near a motor drive pick up noise.
  • The clamp goes round one wire of the motor supply, not the whole cable. The SCT-013-030 has its burden inside, so its leads are safe to leave open.
2

Make the sensor pod

  1. Sand the steel top of the pot magnet clean. Glue the ADXL345 board flat on it with a thin layer of hard two-part epoxy, chip side up. Nothing soft (foam tape, a plastic spacer) goes between the chip and the steel.
  2. Mark the board's x and y arrows on the magnet: you will line them up with the machine.
  3. Solder the shielded cable to the board, and put the printed cap over it, with the cable through the side hole. A ring of silicone holds the cap and keeps oil out.

Every layer between the machine and the chip is a spring, and a spring makes the reading too large near its own resonance. A thin hard glue line on a steel magnet keeps that resonance well above 1 kHz; a flat magnet on a flat, clean pad is usually good to a few kilohertz.

3

Flash and check on the desk

Open machine_monitor/machine_monitor.ino, choose ESP32 Dev Module, and install PubSubClient, ArduinoJson (version 7), OneWire and DallasTemperature. Compiled with the esp32 core 4.0.0: 1.11 MB of flash (84 % of the default app space), 64 KB of RAM for global data, and about 130 KB taken from the heap at start for the sample blocks and the spectra. No warnings from the sketch.

How it works: a task of its own empties the sensor's 32-sample buffer every 4 ms into a block of 4096 samples (1.28 s). For each block and each direction, the board takes a Hann-windowed FFT, divides each line by 2πf to turn acceleration into velocity, and adds up the lines from 10 Hz to 1 kHz. Gravity, slow tilt and drift never enter, because they sit below 10 Hz. The DSP was tested on a laptop with signals of known size; the tolerance is 2 %:

velocity: 15.0 Hz, 2.00 mm/s in -> 1.989 mm/s (0.54 %)
velocity: 50.0 Hz, 1.40 mm/s in -> 1.407 mm/s (0.52 %)
velocity: 903.0 Hz, 4.50 mm/s in -> 4.500 mm/s (0.00 %)
drift: 50 Hz at 2.8 mm/s with gravity, a 0.3 Hz tilt and a 5 Hz sway reads 2.800 mm/s
noise: 400 ug/sqrt(Hz) reads 0.197 mm/s on its own; under 1.40 mm/s it reads 1.415 mm/s
peaks: 200.0 Hz 4.00 mm/s, 25.0 Hz 3.00 mm/s (sum 5.00 mm/s)
crest: sine 1.414 (sqrt 2 = 1.414); with impacts 5.01
Lay the pod on the desk. Check: v reads about 0.2 mm/s (the sensor's own noise). Stand it on a running desk fan's base: v rises, and f1 sits near the fan's turning speed in turns a second.
4

Print the box and the pod cap

PETG, 0.2 mm layers, 4 walls, 20 % infill, no supports. About 150 g in all.

PartLay it
BoxOn its back, open side up. 101 x 147 mm with its ears.
LidFront face down, skirt up.
Pod capClosed top down.

Every cable enters the box from below through a gland, the lid's skirt hangs 6 mm over the walls, and a weep hole lets condensation out. Checked in FreeCAD 1.1: the board, its USB plug and the perfboard fit, and the cap clears the magnet and the sensor board.

5

Fit it to the machine, stopped

  1. With the machine stopped, isolated and locked off, pick a flat spot on the bearing housing, as close to the bearing as you can: on the drive end of a motor, or the pump's bearing nearest the impeller. Clean off paint flakes, rust and oil.
  2. Touch one edge of the magnet down and roll it onto the spot. Do not let it snap on: the shock can damage the sensor, and it can trap a finger.
  3. Line the board's x arrow up horizontal, across the shaft, and y vertical; z then points along the shaft. Mark the spot with paint, so the sensor goes back in the same place after any work.
  4. Press the DS18B20's steel probe against the housing beside the pod, under a strip of aluminium tape.
  5. Mount the box on the frame or a wall, not on the machine. Run both cables through their glands, clear of every moving part, and tie them down.
6

Connect it

On siliconwit.io, our monitoring service: Add Device, then Define my own device, with the fields of the reading below, and a data interval of 60 seconds. Copy the Device ID and Access Token into these lines, with your Wi-Fi above them, and upload again:

const char* MQTT_HOST = "mqtt.siliconwit.io";
const int MQTT_PORT = 8883; // MQTT over TLS
const char* DEVICE_ID = "SWD-XXXXXX"; // client ID, username, and the topic name
const char* MQTT_PASS = "your-access-token"; // the Access Token
#define USE_TLS 1 // 0 only for a test broker on your own network: then port 1883, and no certificate

One reading a minute, on d/<device-id>/t. Features only: the waveform stays on the board.

{"v":2.31,"v_x":2.31,"v_y":1.64,"v_z":0.82,"zone":2,"a_rms":0.071,"a_peak":0.31,"crest":3.10,
"f1":24.6,"p1":2.02,"f2":49.2,"p2":0.91,"f3":98.4,"p3":0.40,"temp":41.5,"running":1,
"run_h":1032.50,"starts":214,"trend":1.12,"ts":1795000630}
v, v_x, v_y, v_zvelocity RMS in mm/s, 10 Hz to 1 kHz: the largest of the three, and each direction zone1 to 4 for A to D, sent only while the machine runs a_rms, a_peak, crestacceleration in g, and peak over RMS: 1.41 for a smooth sine, higher when impacts appear f1 to f3, p1 to p3the three largest lines of the minute's velocity spectrum, Hz and mm/s run_h, starts, trendrunning hours, starts, and v over the machine's own baseline

The link is MQTT over TLS on port 8883, with the ISRG Root X1 certificate in the sketch. After a failed connect it waits 5, 10, 20, 40, then 60 seconds. While the network is down it keeps up to 12 hours of short readings and sends them later with their own times. A watchdog restarts the board if the code gets stuck; the sampling task keeps going while the board reconnects. Your own Mosquitto broker works the same: change the broker lines, as on the live sensor node.

7

Set the zones, and let it learn its normal

The standards for machine vibration (ISO 20816, which replaced ISO 10816) sort the velocity on a bearing housing into four zones:

Ausual for a machine just put into service Bfine for long running Cnot for long running: measure more often, plan the repair for the next stop Ddamage is likely: tell the person who can stop the machine, today

The boundaries depend on the machine's size and its foundation. The sketch starts with the values often quoted for medium machines (15 to 300 kW) on rigid foundations: 1.4, 2.8 and 4.5 mm/s. Check the standard for your machine, and any limit from its maker, and set yours:

// --- your machine ---
float ZONES[3] = {1.4f, 2.8f, 4.5f}; // mm/s: the A/B, B/C and C/D boundaries for your machine's class
float RUN_MM_S = 0.6f; // above this the machine counts as running (the sensor's own noise is about 0.2)
const float BASE_HOURS = 24; // running hours that make the machine's own baseline

A table knows the class, not your machine. So for its first 24 running hours the board learns the machine's own level, and then sends trend: today's level over that baseline. A machine that sits in zone A but has gone from 0.9 to 1.8 mm/s has doubled, and something in it has changed. After a repair, send rebaseline:

d/SWD-XXXXXX/c {"command":"zones","value":[2.3,4.5,7.1],"session":"a1"}
d/SWD-XXXXXX/k/a1 {"status":"ok"}
d/SWD-XXXXXX/c {"command":"rebaseline","session":"a2"} after a repair
d/SWD-XXXXXX/k/a2 {"status":"ok"}
d/SWD-XXXXXX/c {"command":"zones","value":[4,2,1],"session":"a3"}
d/SWD-XXXXXX/k/a3 {"status":"error","message":"zones must be three rising values in mm/s, such as [1.4,2.8,4.5]"}
8

Set the alerts

Email alerts come with the free account; SMS with the Business plan. Send each one to the person who can act on it:

Zone Czone 3 or more, held for 30 minutes: plan the repair Zone Dzone equal to 4, held for 10 minutes: decide about stopping, today Doubledtrend above 2, held for an hour: the machine has changed Running hottemp above your limit, held for 15 minutes Not reportingthe device silent for 10 minutes

"Held for" keeps one knock or one start from waking anyone. The last alert matters as much as the others: a monitor that has lost its power cannot say so itself.

9

Read the record

  • The trend over weeks is the warning. A slow rise, week on week, gives you time to order the part and plan the stop, instead of finding out on a Friday night.
  • The lines point to the cause. A large line at the turning speed (1×) often means unbalance; a large 2× with high axial (v_z) often means misalignment; many multiples can mean looseness. Confirm with an analyst before you act on it.
  • Crest factor rising while v stays flat is a hint of impacts, worth a closer look by someone with a wide-band sensor.
  • Running hours and starts plan the greasing and the service by use, not by the calendar.

You are done when

  • On the desk, v reads about 0.2 mm/s at rest and rises on a running fan, with f1 near its speed.
  • On the machine, all three directions report, and running follows the machine on and off.
  • The zone, the temperature and the running hours arrive every minute, and trend appears after 24 running hours.
  • An alert reaches your phone when you unplug the monitor for ten minutes.
  • You have marked the measuring point, and the sensor goes back there after any work on the machine.

Downloads

Checked: the firmware compiles for the ESP32 with no warnings from the sketch, with and without TLS and the clamp. Its DSP (the FFT, velocity RMS from sines of known size, drift, sensor noise, crest factor, peaks, zones, running hours and the baseline) passes 30 checks on a laptop, within 2 %. The parts were checked in FreeCAD 1.1. A build on a real machine, beside a calibrated vibration meter, is next: if your readings differ, tell us in the discussion below.

References

Ways to take this build

Have it done for your site

Fitted and watched by us

Our engineers fit the sensors, watch the readings and send a monthly record of what it found and saved.

Start with one site
Supervised, with an engineer

KSh 15,000USD 150 for the build

Four video meetings over about six weeks: plan it, show progress, show it working. Ends in a project record anyone can check.

Build it with a supervisor
On your own

Open to all

Every step, the firmware and the printable files. Tick the steps as you go.

Start step 1
For a team or a class

Priced for the group

Your staff or students build the machine condition monitor together, with reviews and a record for each person.

Ask for a group

Plus opens the worked answers in the lessons each step links to: see Plus.

Made by

Engineers who build what they teach, and answer for it.