Contaminated drinking water remains a critical public health threat, particularly in peri-urban communities where laboratory-based quality assessment is inaccessible due to high cost and infrastructure requirements. This study developed an embedded, multi-parameter water quality detection system built on the ESP32 microcontroller, incorporating pH, Total Dissolved Solids (TDS), turbidity, and temperature sensors within an IP54-rated weatherproof enclosure. A Random Forest classifier, optimised via Grid Search Cross-Validation, was trained on a nine-parameter physicochemical dataset comprising 3,276 labelled water samples to perform binary potability determination. Feature importance analysis identified pH and TDS as the two dominant predictors, enabling a computationally efficient dual-parameter decision rule for on-device real-time inference. Sensor accuracy was validated against certified reference instruments: the pH sensor achieved 97.67% mean accuracy (error: 2.33%; SD: 0.017) and the TDS sensor achieved 97.55% (error: 2.45%; SD: 1.06 ppm). Seven real-world water specimens of diverse physicochemical composition were correctly classified as safe or unsafe, consistent with World Health Organization guidelines and Indonesian national standard SNI 01-3553-2006, requiring pH between 6.5 and 8.5 and TDS below 500 ppm. The Random Forest model outperformed rule-based single-threshold approaches by 6 to 13 percentage points, recording an F1-score of 84.6% on the held-out test set. Results are delivered instantly via an LCD 20×4 I2C display and colour-coded LED indicators, eliminating laboratory dependency and supporting practical deployment in resource-constrained North Sumatran communities.