GPS speedometer and clock
A bike or car speedometer that needs no wheel sensor: satellites do the measuring.
Shop by category
Shop all componentsThe MPU6050 on the motor foot sends its shake reading to a phone page. When it passes the limit, the alert trips and stays until cleared, so a rough spell during the night shift is not missed.
Tick anything you already have and the total updates.
Six-axis motion sensor: a three-axis accelerometer that feels gravity and bumps, and a three-axis gyro that measures how fast it turns.
Follow the colours: red is power, dark grey is ground, blue is a signal.
wifi_machine_vibration.inoVerify & upload in Electrolark// Wi-Fi machine vibration monitor
// Geekobot project library · board: ESP32-C3 SuperMini
// Wiring diagram, parts list and build steps: Geekobot project page "wifi-machine-vibration"
#include <Wire.h>
#include <Adafruit_MPU6050.h>
#include <Adafruit_Sensor.h>
#include <WiFi.h>
#include <WebServer.h>
Adafruit_MPU6050 mpu;
sensors_event_t accEvt, gyrEvt, tmpEvt;
// ---- latest readings ----
float pitchDeg = 0;
float rollDeg = 0;
float shakeG = 0;
const char* WIFI_SSID = "YOUR_WIFI_NAME"; // 2.4 GHz network
const char* WIFI_PASS = "YOUR_WIFI_PASSWORD";
WebServer server(80);
const unsigned long READ_EVERY_MS = 2000;
unsigned long lastRead = 0;
const char* statusText = "Starting";
bool tripped = false; // latches when the input fires between readings, until you press Clear
bool alertOn = false;
const float ALERT_LEVEL = 0.5; // adjust to suit
const float HYSTERESIS = 0.1;
const char PAGE[] PROGMEM = R"HTML(<!doctype html><html><head><meta name="viewport" content="width=device-width,initial-scale=1"><title>Vibration</title>
<style>body{font-family:system-ui,sans-serif;background:#0d093d;color:#fff;margin:0;padding:20px}h1{font-size:20px;margin:0 0 14px}
.g{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:12px}.c{background:#1c1866;border-radius:14px;padding:14px}
.l{font-size:12px;opacity:.7}.v{font-size:28px;font-weight:700;margin-top:4px}button{margin-top:14px;padding:12px 18px;border:0;border-radius:10px;font-size:16px;background:#a9c5ea;color:#0d093d}
.s{margin-top:12px;font-size:13px;opacity:.8}</style></head><body><h1>Vibration</h1><div class="g" id="g"></div><button id="b" onclick="fetch('/clear').then(tick)">Clear</button><p class="s" id="s">Connecting…</p>
<script>const F=[["shakeG","Shake","g"]];
async function tick(){try{const d=await(await fetch('/data')).json();document.getElementById('g').innerHTML=F.map(f=>'<div class="c"><div class="l">'+f[1]+'</div><div class="v">'+(typeof d[f[0]]==='boolean'?(d[f[0]]?'YES':'no'):d[f[0]])+' '+f[2]+'</div></div>').join('');
document.getElementById('s').textContent='Status: '+d.status+' · updated '+new Date().toLocaleTimeString();}catch(e){document.getElementById('s').textContent='Lost connection, retrying…'}}
setInterval(tick,2000);tick();</script></body></html>)HTML";
void readImu() { mpu.getEvent(&accEvt, &gyrEvt, &tmpEvt); }
float pitchDegNow() { return atan2(accEvt.acceleration.x, sqrt(accEvt.acceleration.y * accEvt.acceleration.y + accEvt.acceleration.z * accEvt.acceleration.z)) * 57.3f; }
float rollDegNow() { return atan2(accEvt.acceleration.y, accEvt.acceleration.z) * 57.3f; }
float shakeGNow() { float a = sqrt(accEvt.acceleration.x * accEvt.acceleration.x + accEvt.acceleration.y * accEvt.acceleration.y + accEvt.acceleration.z * accEvt.acceleration.z) / 9.81f; return fabs(a - 1.0f); }
float gyroZNow() { return gyrEvt.gyro.z * 57.3f; } // turning speed in degrees per second
void handleData() {
String j = "{";
j += "\"shakeG\":"; j += String(shakeG, 2); j += ",";
j += "\"status\":\""; j += statusText; j += "\"}";
server.send(200, "application/json", j);
}
void handleRoot() { server.send(200, "text/html", PAGE); }
void handleClear() { tripped = false; alertOn = false; statusText = "Normal"; server.send(200, "text/plain", "ok"); }
void evaluate() {
if (!alertOn && shakeG > ALERT_LEVEL) alertOn = true;
else if (alertOn && shakeG < ALERT_LEVEL - HYSTERESIS) alertOn = false;
statusText = alertOn ? "CHECK" : "Normal";
}
void setup() {
Serial.begin(115200);
if (!mpu.begin()) Serial.println(F("MPU6050 not found"));
mpu.setAccelerometerRange(MPU6050_RANGE_4_G);
mpu.setGyroRange(MPU6050_RANGE_500_DEG);
mpu.setFilterBandwidth(MPU6050_BAND_21_HZ);
WiFi.mode(WIFI_STA);
WiFi.begin(WIFI_SSID, WIFI_PASS);
Serial.print(F("Connecting to Wi-Fi"));
for (int i = 0; i < 40 && WiFi.status() != WL_CONNECTED; i++) { delay(500); Serial.print("."); }
Serial.println();
Serial.print(F("Open this address in your browser: http://"));
Serial.println(WiFi.localIP());
server.on("/", handleRoot);
server.on("/data", handleData);
server.on("/clear", handleClear);
server.begin();
}
void loop() {
server.handleClient();
if (shakeGNow()) tripped = true;
if (millis() - lastRead >= READ_EVERY_MS) {
lastRead = millis();
pitchDeg = (readImu(), pitchDegNow());
rollDeg = rollDegNow();
shakeG = shakeGNow();
evaluate();
Serial.print(F("Shake="));
Serial.print(shakeG, 2);
Serial.print(F("g"));
Serial.println();
}
}
The sketch above runs here on a simulated ESP32-C3. Move the sliders for the sensors and buttons it reads, and watch the Serial monitor, display and outputs change.
Check SDA and SCL are not swapped. An I²C scanner should show 0x68 (0x69 if AD0 is tied high).
Keep I²C wires short, add a 100 nF capacitor across VCC and GND, and mount the board away from motor wires.
Open the Serial Monitor at 115200 baud and check for messages. Make sure you chose the right board and port in the Arduino IDE.
Close other programs using the serial port, try another USB cable (some are charge-only) and press reset just before uploading.
Not directly; the board serves the page on your local network only. For remote access, send the readings to a cloud service such as MQTT, ThingSpeak or Blynk, or use a VPN into your home network.
No. ESP32-C3 and ESP8266 boards support 2.4 GHz networks only. Most routers broadcast both, so choose the 2.4 GHz name.
4 parts: ESP32-C3 SuperMini Development Board, GY-521 MPU6050 6-Axis Gyro and Accelerometer Module, Solderless Breadboard (830 points) and Dupont Jumper Wires (40 pcs). Tools: Digital Multimeter and Wire Stripper and Cutter. On this page you can tick the parts you already have and add only the rest to your cart.
It is a intermediate project and takes about 1–2 hours. The build on this page has 6 steps.
No. This page has the complete, tested code (wifi_machine_vibration.ino). Install these libraries first: Adafruit MPU6050 and Adafruit Unified Sensor.
Yes. The Run it panel under the code runs this exact sketch on a simulated board. Move the sliders or press the buttons for the sensors it reads, and the Serial monitor, display and outputs react as they will on the real build. It is a simulation, so real readings depend on your parts and wiring.
About ₹505 for the parts at the prices on this page, plus tools if you do not have them. Quantity price breaks lower the cost when you build several.
Accelerometers, gyros and tilt angles.
Ideas that reuse this build: Offline version. They are listed under Take it further on this page.
A bike or car speedometer that needs no wheel sensor: satellites do the measuring.
Records where you went every five seconds, ready to open on a map.
Two boards, two radios: press the button at the gate and it rings indoors.
Check temperature, humidity and pressure from any phone on your Wi-Fi.
Learning project. Check every circuit and the datasheet of each part before you power it up.
Connecting to Wi-Fi... Open this address in your browser: http://192.168.1.50 Shake=0.00g
A simulation of the sketch above, so you know what to expect. Real readings vary with your parts and wiring.