From 2f349935eb1502f32d4cbc4df6495a34d72e8e1e Mon Sep 17 00:00:00 2001 From: javiservices Date: Wed, 17 Jun 2026 14:04:22 +0200 Subject: [PATCH] =?UTF-8?q?docs:=20actualizar=20README=20ra=C3=ADz=20con?= =?UTF-8?q?=20OLED=20y=20nueva=20arquitectura?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 106 ++++++++++++++++++++++++++++++++++++++++++++++++ backend-laravel | 1 + firmware | 1 + 3 files changed, 108 insertions(+) create mode 100644 README.md create mode 160000 backend-laravel create mode 160000 firmware diff --git a/README.md b/README.md new file mode 100644 index 0000000..fa8d1b8 --- /dev/null +++ b/README.md @@ -0,0 +1,106 @@ +# DummyBot + +Bot físico de tareas para personas con TDAH, basado en **ESP32** + **pantalla OLED SSD1306 128x64 (I2C)** + **3 botones TTP223** + **vibrador**. + +Las tareas se gestionan desde una **mini-app web Laravel** (dark mode, atajos de teclado, responsive). El ESP32 hace polling HTTP cada 30 s y vibra cuando llega una tarea nueva. Se configura por **captive portal**: abre un AP `DummyBot-Setup` con un formulario web. + +## Arquitectura + +``` +┌──────────────────┐ HTTP/JSON (Bearer token) ┌──────────────────────┐ +│ Navegador web │ ◀───────────────────────────▶ │ Laravel + MySQL │ +│ (Tailwind+Alpine)│ │ /api/auth │ +└──────────────────┘ │ /api/tasks │ + │ /api/projects │ + │ /api/tags │ + │ /api/devices │ + │ /api/device/... │ + └──────────┬───────────┘ + │ HTTP + │ (device token) + ┌──────────▼───────────┐ + │ ESP32 │ + │ OLED SSD1306 128x64│ + │ 3 botones TTP223 │ + │ Vibrador │ + └──────────────────────┘ +``` + +## Estructura del proyecto + +``` +dummybot/ +├── firmware/ # PlatformIO – ESP32 Arduino +│ ├── platformio.ini +│ ├── src/main.cpp # Lógica principal (OLED + WiFi + portal) +│ ├── partitions.csv +│ └── README.md +└── backend-laravel/ # Laravel 12 (PHP 8.4, MySQL, Sanctum) + ├── app/Models/Task.php + ├── app/Models/Project.php + ├── app/Models/Tag.php + ├── app/Models/Device.php + ├── app/Http/Controllers/Auth/ # AuthController, LoginController + ├── app/Http/Controllers/Api/ # Project, Tag, Device + ├── app/Http/Controllers/TaskController.php + ├── app/Http/Controllers/PageController.php + ├── app/Http/Middleware/AuthenticateDevice.php + ├── database/migrations/ + ├── resources/views/pages/ # home, login, register, app, settings + ├── resources/views/layouts/base.blade.php + ├── routes/{web,api}.php + ├── Dockerfile + ├── docker-compose.yml + └── nginx.conf +``` + +## Endpoints clave (resumen) + +Ver [`backend-laravel/README.md`](backend-laravel/README.md) para detalle completo. + +``` +POST /api/auth/register +POST /api/auth/login +GET /api/auth/me (auth) + +GET /api/tasks (auth) +POST /api/tasks (auth) +POST /api/tasks/{id}/done (auth o device) +POST /api/tasks/{id}/snooze (auth o device) +GET /api/tasks/stats (auth) + +GET /api/projects (auth) +POST /api/projects (auth) + +GET /api/tags (auth) +POST /api/tags (auth) + +GET /api/devices (auth) +POST /api/devices → devuelve token (solo 1 vez) + +# Para el ESP32 (auth.device) +GET /api/device/tasks/pending +POST /api/device/heartbeat +``` + +## Setup del usuario + +1. Abre `http://157.180.77.232:18080/` (o `http://localhost:8000/` en dev). +2. Crea una cuenta. +3. Ve a **Ajustes → Dispositivos**, crea tu DummyBot y **guarda el token**. +4. Flashea el firmware (ver `firmware/README.md`). +5. En el primer arranque, el ESP32 abre un AP `DummyBot-Setup`. Conéctate desde el móvil y configura WiFi + token desde el formulario web. +6. Tras guardar, el bot se reinicia y se conecta solo. + +## Hardware + +- **ESP32-D0WD-V3** (DevKitC / WROOM-32, 4 MB flash) +- **Pantalla OLED SSD1306 0.96"** (128x64, I2C, 4 pines: GND/VDD/SCK/SDA) +- **3× TTP223** (botones táctiles: Siguiente / Hecha / Snooze) +- **1× motor vibrador 1027** (3V DC, controlado por MOSFET en GPIO 25) + +Ver [`firmware/README.md`](firmware/README.md) para detalle completo de cableado. + +## Licencia + +MIT \ No newline at end of file diff --git a/backend-laravel b/backend-laravel new file mode 160000 index 0000000..3a5da95 --- /dev/null +++ b/backend-laravel @@ -0,0 +1 @@ +Subproject commit 3a5da955a4be8f6c0e932e714dd906a8c06926a4 diff --git a/firmware b/firmware new file mode 160000 index 0000000..9fb87a4 --- /dev/null +++ b/firmware @@ -0,0 +1 @@ +Subproject commit 9fb87a4d623f61748d734e0b10940e7ae0c45e6b