Skip to the content
2 layers58 × 89 mmAmbilight kicad, the printed circuit board in 3D

Systeme ambilight temps reel : un script Python analyse les bords d'une video, extrait les couleurs dominantes et les envoie en UDP via WiFi a un microcontroleur Seeed XIAO ESP32-C6 qui pilote 2 chaines de 260 LEDs…

Size
58 × 89 mm
Copper layers
2
Thickness
1.6 mm
Parts
16
Nets
32
Pads
68
Tracks, vias
100, 9
Pours
1
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
23 Apr 2026
Updated
5 May 2026

Overview

Ambilight kicad is an open-source printed circuit board by lan-ensad, from the lan-ensad/arash_nassiri repository on GitHub. It is a 2-layer board of 58 × 89 mm with 16 parts on 32 nets, routed with 100 tracks and 9 vias.

Its parts include 5 connectors, 3 capacitors, 2 resistors and 2 ICs. It belongs with the ESP32 and RISC-V boards of this library.

README

readme.md

Ambilight -- Arash Nassiri

Systeme ambilight temps reel : un script Python analyse les bords d'une video, extrait les couleurs dominantes et les envoie en UDP via WiFi a un microcontroleur Seeed XIAO ESP32-C6 qui pilote 2 chaines de 260 LEDs WS2812 (520 LEDs au total, 8.67 m, 60 pixels/m).

L'ESP32 et l'ordinateur de diffusion sont connectes sur un reseau WiFi ferme dedie. L'ESP32 est monte au milieu du bas ; les 2 chaines partent de ce point central vers la gauche et la droite, pour minimiser la longueur du fil data.

Architecture

text
Source video (fichier ou capture HDMI via Cam Link)
    │
    ▼
Script Python (PC)  ──►  analyse des bords  ──►  traitement couleur  ──►  UDP (WiFi)
                         (zones.py)               (colors.py)             (udp_sender.py)
                                                                               │
                                                                               ▼
                                                                 Reseau WiFi ferme
                                                                               │
                                                                               ▼
                                                                      Firmware ESP32-C6
                                                                      (NeoPixelBus → WS2812)
                                                                               │
                                                                               ▼
                                                                      2 chaines de 260 LEDs
                                                                      (A = gauche, B = droite)

Disposition physique

Vu depuis la position du spectateur, face a l'ecran :

text
         ┌─────────────────────────────────────────────────────┐
         │                     (haut : pas de ruban)           │
         │                                                     │
         │                                                     │
      ▲  │                                                     │  ▲
      │  │                                                     │  │
  150 │  │                                                     │  │ 150
  LEDs│  │                    [  E C R A N  ]                  │  │ LEDs
      │  │                                                     │  │
      │  │                                                     │  │
      │  └──────────┐                              ┌───────────┘  │
      │             │                              │              │
      └─ CHAINE A ──┤                              ├── CHAINE B ──┘
     (cote gauche)  │                              │   (cote droit)
                    │       ┌──────────────┐       │
      ◄─────────────┤       │  ESP32 + PCB │       ├─────────────►
       110 LEDs     └───────┤              ├───────┘    110 LEDs
       demi-bas             │    milieu    │            demi-bas
       gauche               └──────┬───────┘             droit
                                   │
                                   ▼
                            Alimentation 5 V
  • Chaine A (260 LEDs) : cote GAUCHE du spectateur + demi-bas gauche
  • Chaine B (260 LEDs) : cote DROIT du spectateur + demi-bas droit

Pour chaque chaine, le flux data part de l'ESP32, remonte le demi-bas (110 LEDs) puis le cote vertical (150 LEDs, du bas vers le haut).

Chiffres cles

  • 520 LEDs WS2812 (2 chaines de 260, densite 60 px/m)
  • Alimentation Mean Well LRS150F-5 (5 V / 30 A)
  • ESP32-C6 sortie D9 = chaine A (gauche), D10 = chaine B (droite)
  • Level shifter SN74HCT14N (3.3 V → 5 V) entre ESP32 et rubans
  • Protocole UDP port 4210, 2 paquets/frame (785 o chacun), ~47 KB/s a 30 fps

Structure du projet

text
arash_nassiri/
├── readme.md               Ce fichier -- documentation generale
│
├── Firmware/               Firmware ESP32-C6 (PlatformIO)
│   └── README.md           → Installation, flashage, protocole UDP, troubleshooting firmware
│
├── script/                 Script Python (cote ordinateur)
│   └── README.md           → Installation, configuration, utilisation, troubleshooting soft
│
├── kicad/                  Electronique (schema + BOM + cablage)
│   ├── README.md           → Dimensionnement, BOM, cablage, precautions electriques
│   └── ambilight_kicad/    Projet KiCad
│
├── test_videos/            Videos de test (generees par ffmpeg)
├── run.sh                  Lancement production (fullscreen + unclutter)
└── _devis/                 Documents administratifs (devis, factures)

Documentation par composant

ComposantDocumentationConcerne
Electroniquekicad/README.mdDimensionnement, BOM, cablage, SN74HCT14N, alimentation
Firmware ESP32Firmware/README.mdPlatformIO, WiFi, flashage, protocole UDP
Script Pythonscript/README.mdOpenCV, source video, pipeline couleur, parametres

Demarrage rapide

Ordre recommande pour une premiere mise en route :

  1. Electronique : lire kicad/README.md, fabriquer / cabler la partie power + level shifter + rubans
  2. Firmware : remplir Firmware/src/wifi_config.h puis flasher (voir Firmware/README.md)
  3. Script Python : installer le venv et configurer script/config.py (voir script/README.md)
  4. Lancer : ./run.sh depuis la racine (ou configurer le service systemd, section suivante)

Pour tester le pipeline Python sans materiel (loopback UDP) : voir la section Troubleshooting dans script/README.md.

Lancement automatique au boot (service systemd user)

Pour une installation permanente. Recommande quand la source video est externe (Cam Link) et headless = True dans script/config.py -- aucune session graphique requise.

run.sh integre deja l'attente reseau (ping de la passerelle par defaut, max 30 s) et une rotation simple des logs au demarrage : aucune modification requise avant installation.

Prerequis a verifier dans script/config.py

ParametreValeur recommandeeRaison
headlessTruePas de session graphique sous systemd user (sauf si DISPLAY configure dans l'unit)
terminal_previewFalsePas de terminal → les codes ANSI du preview polluent le fichier de log
dry_runFalseSinon aucun paquet UDP n'est envoye
video_path / camera_indexsource reellevideo_path est resolu relativement a script/

IP ESP32 coherente entre script/config.py (esp32_ip) et Firmware/src/wifi_config.h (LOCAL_IP_BYTES).

1. Creer le service

Fichier ~/.config/systemd/user/ambilight.service :

ini
[Unit]
Description=Ambilight video capture and UDP send
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
WorkingDirectory=/path/to/arash_nassiri
ExecStart=/path/to/arash_nassiri/run.sh
Restart=on-failure
RestartSec=5
Environment=PYTHONUNBUFFERED=1

# Double destination des logs :
#  - Fichier persistant (rotation geree par run.sh au demarrage, >10 Mo → archive timestampee, max 5 backups)
#  - Journal systemd user natif (rotation + compression gerees par journald)
StandardOutput=append:/path/to/arash_nassiri/logs/ambilight.log
StandardError=append:/path/to/arash_nassiri/logs/ambilight.log

[Install]
WantedBy=default.target

Adapter les 3 chemins /path/to/arash_nassiri/... au chemin reel du projet. Le dossier logs/ est cree automatiquement par run.sh.

2. Activer et demarrer

bash
mkdir -p ~/.config/systemd/user
# (copier ambilight.service dans ce dossier)
systemctl --user daemon-reload
systemctl --user enable --now ambilight.service

3. Permettre le demarrage sans login utilisateur (lingering)

bash
sudo loginctl enable-linger $USER

Sans cette ligne, le service ne demarre qu'apres connexion interactive.

4. Prerequis systeme

Utilisateur dans le groupe video pour acceder a la capture (Cam Link, webcam) :

bash
sudo usermod -aG video $USER
# logout/login pour que le groupe prenne effet

5. Operer

bash
# Etat
systemctl --user status ambilight.service

# Logs temps reel -- deux options equivalentes
tail -f logs/ambilight.log                          # fichier dedie
journalctl --user -u ambilight.service -f           # journal systemd

# Logs filtres
journalctl --user -u ambilight.service -p err       # erreurs uniquement
journalctl --user -u ambilight.service --since "1 hour ago"

# Cycle de vie
systemctl --user restart ambilight.service
systemctl --user stop    ambilight.service

6. Desinstaller le service

bash
systemctl --user disable --now ambilight.service
rm -f ~/.config/systemd/user/ambilight.service
systemctl --user daemon-reload
sudo loginctl disable-linger $USER   # optionnel

Reseau WiFi ferme

PC et ESP32 sur un reseau WiFi dedie (routeur/AP dedie ou hotspot du PC). Aucun trafic Internet ni autre appareil -- isolation garantit :

  • Latence predictible (pas de contention)
  • IP statique possible pour l'ESP32

Config par defaut :

ParametreValeurFichier
IP ESP32<IP_ESP>script/config.py + Firmware/src/wifi_config.h
Hostname ESP32esp_ambilightFirmware/src/wifi_config.h
Port UDP4210Firmware/src/wifi_config.h
SSID / password<SSID + PASS>Firmware/src/wifi_config.h

Parts

16
QtyValueFootprintReferences
4MountingHoleMountingHole:MountingHole_3.2mm_M3H1, H2, H3, H4
2100nFCapacitor_THT:C_Disc_D3.8mm_W2.6mm_P2.50mmC1, C2
2330Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_HorizontalR1, R2
122uFCapacitor_THT:C_Radial_D6.3mm_H7.0mm_P2.50mmC3
17414Package_DIP:DIP-14_W7.62mmU1
1Alim_ChaineATerminalBlock_Phoenix:TerminalBlock_Phoenix_MKDS-1,5-2-5.08_1x02_P5.08mm_HorizontalJ4
1Alim_ChaineBTerminalBlock_Phoenix:TerminalBlock_Phoenix_MKDS-1,5-2-5.08_1x02_P5.08mm_HorizontalJ5
1Alim_InputTerminalBlock_Phoenix:TerminalBlock_Phoenix_MKDS-1,5-2-5.08_1x02_P5.08mm_HorizontalJ3
1RubanATerminalBlock_Phoenix:TerminalBlock_Phoenix_MKDS-1,5-3-5.08_1x03_P5.08mm_HorizontalJ1
1RubanBTerminalBlock_Phoenix:TerminalBlock_Phoenix_MKDS-1,5-3-5.08_1x03_P5.08mm_HorizontalJ2
1XIAO-ESP32-C6XIAO:XIAO-ESP32C6-DIPU2

Similar boards

  • 2 layers140.5 × 30 mmType e, the printed circuit board in 3D

    Type e

    google/mozc-devices

    Circuit diagrams and firmware source code for Gboard DIY keyboards

    16 parts3kApache-2.0
  • 2 layers41.4 × 14.5 mmU2f zero, the printed circuit board in 3D

    U2f zero

    conorpp/u2f-zero

    U2F USB token optimized for physical security, affordability, and style

    16 parts2.4k
  • 2 layers122 × 37 mmV0-UmbilicalBoard, the printed circuit board in 3D

    V0-UmbilicalBoard

    VoronDesign/Voron-Hardware

    Cool Hardware designed by the Voron Design group

    16 parts1.1kGPL-3.0
  • 2 layers152 × 57.6 mmVideoslotadapter, the printed circuit board in 3D

    Videoslotadapter

    hoglet67/RGBtoHDMI

    Bare-metal Raspberry Pi project that provides pixel-perfect sampling of Retro Computer RGB/YUV video and conversion to HDMI

    16 parts1kGPL-3.0
  • 2 layers36 × 63.4 mmSmart ringfinal layout, the printed circuit board in 3D

    Smart ringfinal layout

    hackclub/OnBoard

    💡 Join 1,000 teenagers and make your first PCB with a $100 grant!

    16 parts915
  • 2 layers60 × 40 mmHASwitchPlate, the printed circuit board in 3D

    HASwitchPlate

    aderusha/HASwitchPlate

    LCD touchscreen for Home Automation

    16 parts738MIT
  • 2 layers21.1 × 26.9 mmDemo, the printed circuit board in 3D

    Demo

    easyw/kicadStepUpMod

    kicadStepUp: ECAD to MCAD FreeCAD WorkBench

    16 parts704

Questions

How big is the Ambilight kicad PCB?

It measures 58 × 89 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Ambilight kicad use?

16 parts. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Ambilight kicad KiCad files?

From the lan-ensad/arash_nassiri repository on GitHub, at the commit this page was made from: the board is kicad/ambilight_kicad/ambilight_kicad.kicad_pcb and its schematic kicad/ambilight_kicad/ambilight_kicad.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Ambilight kicad design in my own project?

Its repository states no licence, so its author keeps all rights: ask lan-ensad before reusing the design.