Community project

Sistema Operativo de IA

Photo of Sistema Operativo de IA
Generated with AI

Dream Education

Published November 27, 2026

This project implements a lightweight machine learning classifier on an ESP32 microcontroller, demonstrating how to run AI inference directly on embedded hardware without cloud connectivity. The system uses a nearest-centroid algorithm trained on synthetic sensor data to classify equipment states based on temperature and vibration measurements into three categories: normal operation, overheating, or excessive vibration.

Builders will receive a complete guide including the wiring diagram for USB connection, a full parts list, the ready-to-flash firmware with the trained model embedded, and step-by-step assembly instructions. The classifier runs locally on the device, accepting temperature and vibration readings via serial input and returning real-time predictions with confidence metrics.

Wiring diagram

Wiring diagram for Sistema Operativo de IA
Loading diagram…

Assemble it in 1 step

1. Conecta la placa por USB

Usa un cable USB de datos. No necesitas cables de conexión ni sensores externos.

Deploy the firmware

#include <Arduino.h>
#include <math.h>
#include <stdio.h>

// Modelo de centroide mas cercano: cada centro es la media de tres
// ejemplos sinteticos de temperatura (C) y vibracion RMS (g).
constexpr float training[3][3][2] = {
  {{20,.04},{25,.06},{30,.08}},
  {{65,.05},{70,.06},{75,.07}},
  {{23,.7},{25,.8},{27,.9}}
};
const char* labels[] = {"normal", "caliente", "vibracion alta"};
float centers[3][2]{};
char line[80];
size_t used = 0;
bool overflow = false;

void classify() {
  float t, v;
  char extra;
  if (sscanf(line, " %f %f %c", &t, &v, &extra) != 2 ||
      !isfinite(t) || !isfinite(v) || t < 0 || t > 100 || v < 0 || v > 2) {
    Serial.println("Escribe temperatura (0..100 C) y vibracion (0..2 g). Ejemplo: 25 0.06");
    return;
  }
  int best = 0;
  float first = INFINITY, second = INFINITY;
  for (int k = 0; k < 3; ++k) {
    float x = (t - centers[k][0]) / 45.f;
    float y = (v - centers[k][1]) / .74f;
    float d = x*x + y*y;
    if (d < first) { second = first; first = d; best = k; }
    else if (d < second) second = d;
  }
  if (first > .25f || second - first < .15f)
    Serial.println("Sin clasificar: lejos de los ejemplos o resultado ambiguo.");
  else
    Serial.printf("Clase: %s (distancia al cuadrado: %.3f)\n", labels[best], first);
}

void setup() {
  Serial.begin(115200);
  for (int k = 0; k < 3; ++k)
    for (auto &sample : training[k])
      for (int i = 0; i < 2; ++i) centers[k][i] += sample[i] / 3.f;
  Serial.println("IA local de demostracion. Envia: 25 0.06");
}
void loop() {
  while (Serial.available()) {
    char c = Serial.read();
    if (c == '\r' || c == '\n') {
      if (overflow) Serial.println("Entrada demasiado larga.");
      else if (used) { line[used] = '\0'; classify(); }
      used = 0;
      overflow = false;
    } else if (c == '\0' || used >= sizeof(line)-1) overflow = true;
    else if (!overflow) line[used++] = c;
  }
  delay(1);
}

Remix this project

Make it yours in one click

Open a full copy of this project in your own Schematik workspace, diagram, code, parts, and assembly steps included. Swap the sensor, add features, or redesign the whole thing with AI. The author's original stays untouched.

Open in Schematik