v11.0 · 151 Fases
Arquitetura & Embedded Fases 1–119 Implementado · ~10 min (1.870 palavras) BuildrootPythonWebSocketsystemd
📄 docs/01-arquitetura-geral.md ↗

01 — Arquitetura Geral & Perfis Dual-Vehicle (Zenith AutoOS)

Este documento descreve a arquitetura completa do Zenith AutoOS, integrando o Sistema Operacional Linux Embarcado via Buildroot (Fases 1–119), o Emulador QEMU / CI Monolith, o Simulador Multi-Janela / DevTools e os perfis independentes por veículo.

Zenith AutoOS: 11.0.0 Fases: 151 Guias: 33 Idioma: PT-BR

Categoria: Arquitetura & Embedded Fases: 1–119 Status: Implementado Buildroot: stack Python: stack WebSocket: stack systemd: stack

🏠 README · 📚 Documentação · 02 · Elétrica/ESP32 ➡️

📑 Neste guia — 5 seções · ~10 min de leitura

Visão geral da arquitetura Zenith AutoOS
Visão geral: HMI multi-screen, serviços embarcados, gateway ESP32 e integrações em nuvem.


🗺️ Visão geral em diagrama

Diagrama Mermaid
flowchart TB
    subgraph HMI["HMI multi-screen · 60 FPS"]
        CL["Cluster 1920×720"]
        CE["Central 1920×1080"]
        HUD["AR-HUD 1280×720"]
        RSE["RSE 2× 1280×720"]
    end

    subgraph OS["Zenith AutoOS · Buildroot"]
        HUB["Hub WebSocket 60 Hz"]
        GRPC["gRPC / Protobuf :50051"]
        CAN["SocketCAN / K-Line"]
        ADAS["ADAS 360° + Coral TPU"]
        DSP["PipeWire + CamillaDSP"]
        PWR["Energia INA226 + ULP"]
    end

    ESP["ESP32 FreeRTOS<br/>TWAI + ULP + HSM"]
    CAR["Veículo 12 V<br/>Freelander · Lexus"]
    CLOUD["MQTT · Telegram<br/>WebRTC · OTA"]

    CL <--> HUB
    CE <--> HUB
    HUD <--> HUB
    RSE <--> HUB
    HUB <--> GRPC
    GRPC <--> CAN
    CAN <--> ESP
    ESP <--> CAR
    HUB <--> ADAS
    HUB <--> DSP
    HUB <--> PWR
    HUB <--> CLOUD

    style HMI fill:#0A5C36,color:#fff,stroke:#C8A951
    style OS fill:#123A52,color:#fff,stroke:#38BDF8
    style CAR fill:#4A2B12,color:#fff,stroke:#F59E0B
    style CLOUD fill:#1E3A34,color:#fff,stroke:#2DD4BF

Como ler: o diagrama resume o fluxo principal deste guia; os detalhes, pinagens, endpoints e trechos de código aparecem nas seções abaixo.

1. Visão Geral das Camadas (Sistema Embarcado Buildroot — 119 Fases)

text
+---------------------------------------------------------------------------------------+
| CAMADA DE APRESENTAÇÃO MULTI-SCREEN PIXEL-PERFECT (Weston scale=1 + Godot 4 Shaders)  |
|  - HDMI-A-1 (1920x720): ClusterWindow.gd (Velocímetro, Tell-tales, Tribologia, Radar) |
|  - HDMI-A-2 (1920x1080): CentralWindow.gd (OSM, RTA 3D, EnergyFlow, Ativadores UDS)   |
|  - HDMI-A-3 (1280x720 Transp.) & DP-1 (CVBS): AR_HUD.gd (V2X SPaT/Pothole) & RSE      |
+----------------------------------------+----------------------------------------------+
                                         | ws://127.0.0.1:8765 (JSON) + :8766 (Protobuf)
+----------------------------------------v----------------------------------------------+
| SERVIÇOS DE SISTEMA (Boot DAG <3.5s + K3s Cluster + RAUC A/B Deltas + Watchdog 3s)    |
|  - Barramentos & IPC: zenith_can_bridge (BPF SocketCAN/K-Line) + gRPC Hub (:50051)    |
|  - Vídeo Zero-Copy & DVR: zenith_dmabuf_gl + zenith_frame_sync + GStreamer HEVC 15Mbps|
|  - Hub ADAS 360° (Pothole 500ms) + Sensor Fusion EKF + PTP IEEE 1588 + V2X SPaT/LoRa  |
|  - Áudio Hi-End: FIR 4096 taps + Auto-EQ REW/UMIK-1 + Fletcher-Munson + Exciter/ASD   |
|  - Energia & Clima: INA226 + Topo SRTM + Difusores HVAC + Bio-Feedback BLE + Óleo AI  |
|  - Segurança & Remoto: HSM ATECC608 ECC + ECU Flasher UDS + WebRTC Twin 3D (Three.js) |
|  - Cognição & Ecossistema: LLM NCM (llama.cpp) + SDK Sandbox (.pck) + HomeLink CC1101 |
|  - Globalização, Settings & Catálogo Offline (Fases 117–119): i18n RTL + zenith_settings.yaml AES-GCM + SQLite |
+----------------------------------------+----------------------------------------------+
                                         | /dev/ttyUSB0 @ 2.000.000 baud (Protobuf+CRC32)
+----------------------------------------v----------------------------------------------+
| FIRMWARE ESP32 MASTER GATEWAY FREERTOS DUAL-CORE (firmware.ino + ulp_battery.S)       |
|  - Core 0: Driver Nativo TWAI (CAN 500kbps) | Core 1: UART K-Line / I2C / SWC / ISR   |
|  - Dashboard OLED SSD1306 Fail-Safe (>1.5s sem Heartbeat) + HSM ATECC608 (0x60)       |
|  - ULP Deep Sleep 10s (<11.9V) | Supercap UPS | Pré-Tensores & Difusores PCA9685     |
+---------------------------------------------------------------------------------------+

2. Mapa Completo de Serviços Systemd (Fases 1–119)

Serviço (systemd) Script / Binário Canal / Porta / Socket Função
seatd.service /usr/bin/seatd -g seat /run/seatd.sock Acesso DRM/Input sem PAM
dbus-broker.service /usr/bin/dbus-broker-launch /run/dbus/system_bus_socket Barramento D-Bus alta prioridade (Nice=-15, RR 55)
weston.service /usr/bin/weston /run/user/1000/wayland-0 Compositor Dual-Screen HDMI-A-1 + HDMI-A-2
zenith-firewall.service nft -f /etc/nftables.conf Kernel Netfilter Bloqueia portas administrativas no Hotspot/LTE
zenith-ids.service zenith_ids.py BlueZ logs + /run/zenith/esp32_cmd.sock Bloqueio MAC Bluetooth + auditoria serial
zenith-pipewire.service /usr/bin/pipewire /run/user/1000/pipewire-0 Áudio travado em 48000 Hz
zenith-wireplumber.service /usr/bin/wireplumber PipeWire SPA Regras Sound Blaster X-Fi + BlueZ A2DP/HFP
zenith-dsp.service start-dsp.sh + camilladsp hw:Loopback -> X-Fi (:1234) DSP 6 canais + WatchdogSec=10
zenith-v4l2-splitter.service zenith_v4l2_splitter.sh /dev/video10..13 Copia zero-copy video0/video7
zenith-adas.service adas_radar.py ws://127.0.0.1:8765, hub_ingest.sock Hub 60Hz + Coral TPU + WatchdogSec=10
zenith-telemetry.service zenith_telemetry.py /dev/rfcomm0 -> hub_ingest.sock OBD-II 15Hz (ELM327)
zenith-bt-manager.service zenith_bt_manager.py BlueZ D-Bus -> bt_mgr.sock Multiponto Always-On (threads isoladas) + Auto-Power/Trust
zenith-bt-agent.service zenith_bluetooth_agent.py BlueZ D-Bus / OBEX BIP -> bt_cmd.sock Auto-Pair + AVRCP 1.6 Base64 Art + SWC Reverso
zenith-ble-rgb.service zenith_ble_rgb.py Bleak / esp32_cmd.sock -> rgb_cmd.sock Fitas LED ELK-BLEDOM + Redline + Music Sync + Espelho 3D
zenith-call.service zenith_call_manager.py call_cmd.sock <-> CamillaDSP + ESP32 Chamadas HFP + WebRTC AEC + redução A/C + mute música
zenith-tpms.service zenith_tpms_ble.py Bleak Passivo / tpms_ingest.sock Scanner TPMS BLE 4 rodas + alarmes no Cluster
zenith-bt-watchdog.service zenith_bluetooth_watchdog.sh hcitool + dbus + uhubctl Watchdog HCI0 (>5s) + reset USB 5V 500ms + resume
zenith-rse.service zenith_multiseat_rse.py rse_cmd.sock -> zenith.rse.virtual_splitter Encostos HDMI-A-3 VAAPI + Dual A2DP fones independentes
zenith-dvr.service zenith_dvr.py /data/dvr/{front,rear}/*.mp4 Gravação VAAPI H.264 (3 min, 50GB)
zenith-voice.service zenith_voice_agent.py pw-record -> Whisper.cpp/Vosk -> espeak Assistente de voz offline multilíngue + hot-swap gRPC via /run/zenith/voice_cmd.sock (Fases 13 & 117)
zenith-gps-nav.service zenith_gps_nav.py gpsd:2947 -> /run/zenith/nav_map.png GPS + renderizador de mapas offline
zenith-hotspot.service zenith_hotspot.sh wlan0 (192.168.50.1/24) AP Car_Hotspot (hostapd + dnsmasq)
zenith-wardriving.service wardriving_logger.py wlan1 monitor -> wardriving.db Coleta Wi-Fi + GPS em SQLite
zenith-dms.service zenith_dms.py /dev/video8 -> hub_ingest.sock EAR sonolência + gestos mão direita
zenith-health.service zenith_health_monitor.py v4l2-ctl, smartctl, i2cset, uhubctl Self-healing USB/câmeras + proteção 85°C
zenith-mqtt.service zenith_mqtt_bridge.py Broker MQTT TLS :8883 Telemetria nuvem + portão < 50m
zenith-power.service zenith_power_daemon.py /dev/ttyUSB0 <-> esp32_cmd.sock Safe Shutdown + UPS <10ms + ULP <11.9V + WatchdogSec=10
zenith-power-meter.service zenith_power_meter.py I2C INA226 0x41..0x44 -> hub Coulomb Counting (PC/Áudio/Cam/Alt) @ 10 Hz
zenith-governor.service zenith_thermal_governor.py intel_pstate / RAPL sysfs TDP dinâmico (10W trânsito / 65W rodovia)
zenith-battery-ai.service zenith_battery_ai.py SQLite SoH + CamillaDSP + ESP32 Predição bateria fria + corte Sub auto SoH<=40%
zenith-video-sync.service /usr/bin/zenith_frame_sync /dev/shm/zenith_genlock_frame Software Genlock multi-câmera (skew <= 8ms)
zenith-dmabuf.service /usr/bin/zenith_dmabuf_gl /dev/shm/zenith_dmabuf_meta Captura Zero-Copy VIDIOC_EXPBUF (<15ms)
zenith-fusion.service zenith_sensor_fusion.py RPLIDAR + mmWave -> hub_ingest.sock Fusão EKF LiDAR/mmWave + Nuvem 3D
zenith-profiles.service zenith_profile_manager.py profile_cmd.sock <-> CamillaDSP :1234 Perfis biométricos (banco, RGB, Sweet Spot)
zenith-track.service zenith_imu_track.py /dev/i2c-* IMU 100Hz -> trackday/*.csv Friction Circle G-G, Lap Timer & freio V2V
zenith-prognostics.service zenith_prognostics.py SQLite WAL + Isolation Forest Edge ML Preditivo (bateria CCA/alternador)
zenith-v2v.service zenith_mesh_radio.py SX1276 /dev/spidev0.0 915MHz Rede mesh V2V até 5 km com CRC-16
zenith-valet.service zenith_valet_immobilizer.py security_cmd.sock <-> ESP32 Modo Manobrista (PIN) + Imobilizador Geo-Fence
zenith-webrtc.service zenith_webrtc_twin.py wg0:8443 aiortc + DataChannel Gêmeo Digital remoto H.264/VP8 < 300ms
zenith-loudness.service zenith_dynamic_loudness.py hub WS + dsp_safety <-> :1234 Loudness Fletcher-Munson + corte térmico 75°C
zenith-sweetspot.service zenith_sweetspot_manager.py sweetspot_cmd.sock <-> :1234 Time Alignment dinâmico (Solo / Phantom Center)
zenith-bitperfect.service zenith_bitperfect_clock.py pw-dump <-> FIR + CamillaDSP Bit-Perfect dynamic clock 44.1 / 48 / 88.2 / 96 kHz
zenith-asd.service /usr/bin/zenith_asd_synth /run/zenith/asd_state.sock -> ALSA Síntese sonora ativa de motor (V8 / V10 / EV)
zenith-rta.service zenith_rta_analyzer.py PipeWire Monitor -> hub_ingest.sock FFT 4096 pts 60Hz em 31 bandas ISO 1/3 oitava
zenith-hmi.service start-hmi.sh (Godot 4) wayland-0 <-> :8765 / :8766 Triple-Screen Cluster + Central + AR HUD + Render Monolith 16.667ms (Fase 100)
zenith-boot-video.service zenith_boot_video.sh /usr/share/plymouth/themes/zenith/zenith_boot_60fps.mp4 Boot cinematográfico 60fps H.264 + hold último frame DRM antes do Godot (Fase 93)
zenith-brightness.service zenith_brightness_sync.py /run/zenith/brightness_cmd.sock + ddcutil Master Dimmer logarítmico + True Tone VEML7700 (Fases 57, 92 e 97)
zenith-can-bridge.service /usr/bin/zenith_can_bridge can0/vcan0 + L9637D -> can_proto.sock Sniffing SocketCAN BPF + K-Line em C
zenith-grpc-hub.service zenith_grpc_hub.py :50051 gRPC / ws://127.0.0.1:8766 Streaming Protobuf binário (ZE/ZL) + Heartbeat OLED + SetLocale/GetLocale (Fases 73 & 117)
zenith-mdns-mesh.service zenith_mdns_mesh.py Avahi mDNS _zenith_rse._tcp Autodescoberta nós traseiros + túnel criptografado
zenith-ecu-flasher.service zenith_ecu_flasher.py /run/zenith/ecu_flash_cmd.sock Backup ROM NVMe + Remap UDS/KWP2000 + Recovery
zenith-hil.service zenith_hil_simulator.py vcan0 (bancada sob demanda) Simulador HIL 0–120 km/h em rede fantasma
zenith-ptp.service ptp4l + zenith_ptp_sync.py IEEE 1588 PTP :319/:320 Sincronismo nanossegundo freio/câmera/DSP
zenith-active-diag.service zenith_active_diag.py /run/zenith/diag_cmd.sock Scanner bidirecional UDS 0x2F (bicos/EGR/fan)
zenith-ota.service zenith_ota_delta.py RAUC A/B + casync + mqtt_alert.sock OTA delta chunked + crash reporter pós-rollback
zenith-v2x.service zenith_v2x_its.py UDP :15100 -> hub_ingest.sock Semáforo V2X SPaT/GLOSA + Start-Stop ESP32
zenith-biofeedback.service zenith_biofeedback.py BLE GATT 0x2A37 -> ESP32/CamillaDSP Redução estresse (>110 BPM): A/C, RGB e Sub
zenith-topo-energy.service zenith_topo_energy.py SRTM .hgt + GPS -> hub_ingest.sock Planejamento energético preditivo em serras
zenith-smart-hvac.service zenith_smart_hvac.py DMS/FSR -> esp32_cmd.sock Servos difusores motorizados PCA9685
zenith-k3s-scheduler.service zenith_k3s_scheduler.py kubectl K3s (optiplex <-> rpi-rear) Migração térmica automática de vídeo (>=80°C)
zenith-oil-tribology.service zenith_oil_tribology.py SQLite /data/ml/zenith_oil_tribology.db Degradação molecular de óleo 5W-40 por IA
zenith-llm.service zenith_llm_ncm.py /run/zenith/llm_cmd.sock / llama.cpp Assistente cognitivo offline NCM + manuais LR/Toyota
zenith-plugin-daemon.service zenith_plugin_sandbox.py /run/zenith/plugin_cmd.sock / /data/plugins Carregamento e isolamento LXC/chroot de plugins e .pck
zenith-sentry.service zenith_sentry_guard.py + zenith_sentry_capture.sh /run/zenith/sentry_cmd.sock / pendrive USB Captura estacionária 2 min frontal/traseira após impacto MPU6050
zenith-maintenance.service zenith_maintenance_db.py /run/zenith/maint_cmd.sock / SQLite manutenção Contadores preventivos (óleo/filtros/pneus/freio) + saúde bateria
zenith-spatial-chime.service zenith_spatial_chime.py /run/zenith/chime_cmd.sock / PipeWire 6ch Alertas sonoros posicionais por porta aberta (Door Ajar)
zenith-boot-dag.service zenith_boot_dag.py + zenith_settings_manager.py /run/zenith/boot_dag_status.json, /data/config/zenith_settings.yaml, zenith_vehicle_db.sqlite Orquestrador DAG < 3.5s com nó settings_nvme_decrypt (<10ms), catálogo veicular offline SQLite (157k+ veículos) & Clean Flash Godot (Fases 90, 118 e 119)
rauc-mark-good.service rauc status mark-good /boot/efi/EFI/BOOT/grubenv Confirma slot OTA A/B ativo

3. Sistema de Perfis Independentes (profiles/)

Recurso Land Rover Freelander 1 (2006) Lexus ES 300 (1998)
Arquivo de Perfil profiles/freelander_2006.json profiles/lexus_es300_1998.json
Protocolo OBD-II AUTO (ISO 9141-2 / KWP2000) ISO 9141-2
TPMS Ideal / Alerta 30 PSI / ≤ 26 PSI 32 PSI / ≤ 28 PSI
Câmera 360° + Ré + Frontal Sim (Auto-off > 20 km/h) Sim (Auto-off > 15 km/h)
Áudio 5.1 (SB1095) 4 Falantes + Sub Central + 4 Portas + Sub
Teto Estrelado & LEDs Não Sim (PCA9685 / BLE)
Vidros / Teto Solar / Porta-Malas Vidros Elétricos Vidros + Teto Solar + Porta-Malas

4. Evolução Fases 120–138 (Segurança Ativa, Retrofit Digital, Inteligência & Conectividade)

Além da base operacional de 119 fases, o Zenith AutoOS integra 19 funcionalidades nativas end-to-end documentadas em detalhes nos guias 29–32:

  • Segurança no Dia a Dia (Fases 120–125 — Doc 29): SafeExitAssist por lado de porta, alerta "O carro da frente andou", leitura de placas R-19 com velocidade laranja (#F97316), Saída de Faixa OpenCV (LDW), base offline de radares SQLite/CSV e detecção de batida (MPU6050) com trava automática da dashcam (/data/dvr/locked) + SOS Telegram GPS.
  • Retrofit Carro Antigo → Carro Novo (Fases 126–131 — Doc 30): Farol automático VEML7700, ar-condicionado digital SHT31 (22 °C), detecção de lâmpada queimada via INA219 em português, fechamento automático dos vidros ao trancar, sensor de estacionamento ultrassônico com som direcional no DSP 6ch e vista superior Bird's-Eye 360° por homografia OpenCV.
  • Inteligência Útil (Fases 132–135 — Doc 31): Explicador offline/LLM de DTCs em português, consumo real com detecção automática de abastecimento (custo em R$), Diário de Bordo SQLite + exportação CSV e Nota de Condução com dicas.
  • Conectividade Avançada (Fases 136–138 — Doc 32): Apple CarPlay / Android Auto embutido (aasdk + openauto), Bot do Telegram autenticado por allowed_chat_ids e sincronização na garagem Wi-Fi (auto, ask, never) via zenith-telegram.service, zenith-garage-sync.service, zenith-openauto.service e zenith-birdseye.service.

⬆️ Topo · 📚 Índice · 02 · Elétrica/ESP32 ➡️

Zenith AutoOS 11.0 · Documentação técnica · Novembro de 2026 · README principal