Skip to the content
2 layers249.4 × 122 mmPCB Controller, the printed circuit board in 3D

FlipDisc Project was made for education of Project. Chadsadakorn Piriyasiriphan Jadesalit Suriyanimitsuk Sutthiphong Hongkham

Size
249.4 × 122 mm
Copper layers
2
Thickness
1.6 mm
Parts
159
Nets
312
Pads
992
Tracks, vias
3,337, 211
Pours
6
Routed
Yes
KiCad
KiCad 10.0 (file 20260206)
Created
18 Dec 2024
Updated
28 Sep 2026

Overview

PCB Controller is an open-source printed circuit board by Sutthiphong-H, from the Sutthiphong-H/project-flip-disc repository on GitHub. It is a 2-layer board of 249.4 × 122 mm with 159 parts on 312 nets, routed with 3,337 tracks and 211 vias.

It is built around the 74HCT245, TSR 1-2450 and UDN2981A-T, with the 74HC595, 74HC00D and 74HC123D among its other parts. Its parts include 65 resistors, 41 capacitors, 29 ICs, 11 connectors and 9 transistors. It belongs with the ESP32 boards of this library.

Main components

9

README

README.md

FlipDisc Project

FlipDisc Project was made for education of Project. Chadsadakorn Piriyasiriphan Jadesalit Suriyanimitsuk Sutthiphong Hongkham

A webcam feed is segmented with RVM (Robust Video Matting; U2NET optional), each silhouette's distance is estimated from its height, and everyone beyond FLIPDISC_MAX_DISTANCE is dropped. What's left is reduced to an 80x45 black-and-white matrix and streamed to the React frontend over Socket.IO. With nobody in range the backend loops an idle video instead.

Layout

text
backend/
├── assets/            idle video clips
├── models/            model weights (not committed)
├── requirements.txt
├── src/
│   ├── app.py         entry point
│   ├── settings.py    every tunable, overridable by environment variable
│   ├── pipeline.py    capture -> segment -> publish loop
│   ├── frame_rate.py  rolling FPS meter
│   ├── sources/       webcam capture, idle video playback
│   ├── vision/        RVM + U2NET models, segmentation worker
│   └── server/        Flask + Socket.IO server and publisher
└── tools/camtest.py   preview a camera to find its index
flip-disc_frontend/    React client
arduino/               ESP32 sketches

Installation

The RTX 50-series needs a CUDA 12.8 build of torch, so install torch first:

bash
cd backend
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu128
pip install -r requirements.txt

On a machine without an NVIDIA GPU, install the much smaller CPU build instead (--index-url https://download.pytorch.org/whl/cpu). The backend runs on the CPU by itself when there is no GPU, or the GPU fails a test run. That includes cards older than the RTX 20-series, which the cu128 build has no kernels for. It also falls back when the GPU can't load the model.

DeviceModel inputPer framefps with this webcam
RTX 5060 (CUDA graph)1280x720~8.5 ms20 (the camera's limit)
CPU, 6 threads640x360~47 ms~17

The header of the page shows GPU or CPU (in amber) for the one in use.

Put the weights in backend/models/:

  • rvm_mobilenetv3.pth -- the default model (download)
  • u2net_human_seg.pth -- only needed for FLIPDISC_MODEL=u2net (download)

Put the idle clip at backend/assets/video.mp4 (not in git -- it's 90 MB).

RVM's code in backend/src/vision/rvm/ is vendored from RobustVideoMatting and is GPL-3.0.

bash
cd flip-disc_frontend
npm install

Running

Build the frontend once and the backend serves it -- open http://localhost:5000:

bash
cd flip-disc_frontend
npm run build            # -> flip-disc_frontend/dist (FLIPDISC_FRONTEND_DIST to move it)
cd ../backend
python src/app.py        # Flask + Socket.IO + the built page, all on port 5000

While working on the frontend, use Vite's dev server instead (http://localhost:5173, talks to the backend on port 5000):

bash
cd flip-disc_frontend
npm run dev

Running unattended

backend/run-backend.bat runs the backend and restarts it whenever it exits with an error. The backend exits with code 1 by itself when something breaks and won't recover in place: the pipeline thread dies (a model that won't load, a CUDA context broken by a GPU driver reset), segmentation hangs, or no frame goes out for FLIPDISC_STALL_SECONDS. Frames go out in every mode (the idle clip plays even without a camera), so a gap in them always means the backend is stuck. Ctrl+C exits with 0 and ends the script too.

To start it with Windows, create a Task Scheduler task with the trigger At log on and the action backend\run-backend.bat. Use log on rather than a Windows service: services run outside the desktop session, and webcam access from there is unreliable. On the display machine, also turn off sleep and USB selective suspend (Power Options → USB settings), or the webcam can be powered down.

  • GET /status returns 503 with "status": "stalled" once frames stop, for an external health check. Before the first frame the status is "starting".
  • The page shows No frames from the backend when it is connected but nothing has arrived for 3 s, and Disconnected once the backend has exited.
  • If WebGL loses its context (a GPU reset, a driver update), the flip-disc view rebuilds itself. You don't need to reload.

Cameras are managed from the camera icon at the top right of the page: pick the camera in use from the dropdown, and add, edit or delete cameras.

  • Webcam: Scan shows the webcams plugged into the backend machine (with a thumbnail each); pick one, give it a name and a resolution.
  • IP camera: name, IP, port, username, password, channel, main/sub stream, brand and resolution. The RTSP URL is built from those: Dahua .../cam/realmonitor?channel=1&subtype=0 or Hikvision .../Streaming/Channels/101.
  • Test grabs one frame and shows it. The backend only switches to a camera that delivers a picture, otherwise the current one keeps running.

The list lives in backend/cameras.json -- not committed, since it holds the IP cameras' passwords, which the page never gets back (a blank password when editing keeps the saved one). Without that file the backend starts with webcam FLIPDISC_CAMERA.

The page has three views: Flip-disc (the simulated display), Mask (the raw 80x45 matrix) and Camera (the webcam with the silhouette highlighted and a distance box per person, streamed from /debug.mjpg only while it's open).

Environment variables

VariableDefaultMeaning
FLIPDISC_CAMERA0First webcam, until cameras.json exists
FLIPDISC_PORT5000Socket.IO / HTTP port
FLIPDISC_EMIT_FPS30Upper bound on frames sent to the client
FLIPDISC_MAX_DISTANCE15People further than this (m) are dropped
FLIPDISC_FOCAL_LENGTH460For the distance estimate; calibrate it
FLIPDISC_MIN_AREA0.005Blobs under this share of frame = noise
FLIPDISC_MODELrvmrvm or u2net
FLIPDISC_DEVICEautoauto, cuda or cpu
FLIPDISC_PROCESS_SIZEper deviceModel input, 16:9. RVM: GPU 1280x720, CPU 640x360; U2NET 512x288
FLIPDISC_THIN_BOOST2Extra weight for parts thinner than a disc (fingers); 0 = off
FLIPDISC_SMOOTHING0.5Anti-flicker; 1 = off, lower = steadier
FLIPDISC_IDLE_TIMEOUT15Seconds without a person before idle
FLIPDISC_IDLE_VIDEOvideo.mp4Clip in backend/assets/ to loop
FLIPDISC_STALL_SECONDS10No frame this long: exit for a restart
FLIPDISC_STARTUP_SECONDS120No first frame this long: same

Parts

159
QtyValueFootprintReferences
6010kResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_HorizontalR2, R10, R11, R12, R13, R14, R15, R16, R17, R18, R19, R20, R21, R22, R23, R24 +44
340.1 ufCapacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolderC2, C10, C11, C12, C13, C14, C15, C16, C17, C18, C19, C20, C21, C22, C23, C24 +18
1674HC595Package_DIP:DIP-16_W7.62mm_SocketU5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U25, U26, U27, U30, U31, U32
8UDN2981APackage_DIP:DIP-18_W7.62mm_SocketU15, U16, U17, U18, U19, U33, U34, U35
8ULN2803APG_O,N,HZNPackage_DIP:DIP-18_W7.62mm_SocketQ2, Q3, Q4, Q5, Q6, Q7, Q8, Q9
3100nFCapacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolderC8, C41, C43
310kResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR38, R39, R41
2Conn_01x15Connector_PinSocket_2.54mm:PinSocket_1x15_P2.54mm_VerticalJ10, J11
11000uF/35VCapacitor_THT:CP_Radial_D12.5mm_P5.00mmC42
110uF/50VCapacitor_SMD:C_1206_3216Metric_Pad1.33x1.80mm_HandSolderC3
11N4744ADiode_THT:D_DO-41_SOD81_P7.62mm_HorizontalD3
12.2kResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_HorizontalR1
122uF/10VCapacitor_SMD:C_1206_3216Metric_Pad1.33x1.80mm_HandSolderC4
1470uF/35VCapacitor_THT:CP_Radial_D10.0mm_P5.00mmC1
147kResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR40
174HC00Package_DIP:DIP-14_W7.62mm_SocketU22
174HC123Package_DIP:DIP-16_W7.62mm_SocketU3
174HCT245Package_DIP:DIP-20_W7.62mm_SocketU4
1ColumnPin_1-12Connector_IDC:IDC-Header_2x08_P2.54mm_VerticalJ2
1ColumnPin_13-24Connector_IDC:IDC-Header_2x08_P2.54mm_VerticalJ3
1ColumnPin_25-36Connector_IDC:IDC-Header_2x08_P2.54mm_VerticalJ4
1Conn_01x05Connector_PinHeader_2.54mm:PinHeader_1x05_P2.54mm_VerticalJ8
1DC_Jack_5.5x2.5_24VConnector_BarrelJack:BarrelJack_CUI_PJ-063AH_HorizontalJ1
1ESP32-DEVKIT-V1ESP32-DEVKIT-V1:MODULE_ESP32_DEVKIT_V1U23
1IRF4905Package_TO_SOT_THT:TO-220-3_VerticalQ1
1LED_Power_5VLED_SMD:LED_1206_3216Metric_Pad1.42x1.75mm_HandSolderD1
1PPTC 3AFuse:Fuse_Bourns_MF-RG300F1
1RowPin17-24Connector_IDC:IDC-Header_2x08_P2.54mm_VerticalJ7
1RowPin_1-8Connector_IDC:IDC-Header_2x08_P2.54mm_VerticalJ5
1RowPin_9-16Connector_IDC:IDC-Header_2x08_P2.54mm_VerticalJ6
1SMBJ28CADiode_SMD:D_SMBD2
1Screw_Terminal_24VTerminalBlock_Phoenix:TerminalBlock_Phoenix_MKDS-1,5-2-5.08_1x02_P5.08mm_HorizontalJ9
1TSR_1-2450Converter_DCDC:Converter_DCDC_TRACO_TSR-1_THTU1

Similar boards

  • 2 layers65.6 × 56.5 mmTop HAT Alt, the printed circuit board in 3D

    Top HAT Alt

    PetervanderMeij/train-controller

    Raspberry Pi model train controller

    28 parts
  • 2 layers198.1 × 193 mmSTE25, the printed circuit board in 3D

    STE25

    stonedDiscord/Automatenplatinen

    Reverse engineerte Hardware aus deutschen Spielautomaten.

    252 parts5BSD-2-Clause
  • 2 layers278 × 135 mmN3-universal, the printed circuit board in 3D

    N3-universal

    oliviera999/n3_firmwires

    firmwires des bojetw connectés n3

    179 parts
  • 2 layers224 × 78 mmVFD Clock, the printed circuit board in 3D

    VFD Clock

    AronASzucs/IV-11-VFD-Clock

    6-digit Soviet IV-11 VFD tube clock — custom PCB, mixed 25V/1.5V power system, 7-state FSM firmware

    41 parts43
  • 2 layers225 × 80 mmVFD, the printed circuit board in 3D

    VFD

    davidmpye/VFD

    This repository contains a design for an IV-11 based Vacuum Fluorescent Display (VFD) display unit.

    72 parts9
  • 2 layers3-digit, the printed circuit board in 3D

    3-digit

    jamesfowkes/cryptology-countdown

    PCBs and software for two synchronous countdown timers

    40 parts
  • 2 layers100 × 70 mmWired console k9ay, the printed circuit board in 3D

    Wired console k9ay

    ra0sms/universal_control_console

    Control console for any types of antenna's switches

    115 partsMIT

Questions

How big is the PCB Controller PCB?

It measures 249.4 × 122 mm and has 2 copper layers, 1.6 mm thick.

What parts does the PCB Controller use?

159 parts, built around the 74HCT245, TSR 1-2450, UDN2981A-T and 74HC595. 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 PCB Controller KiCad files?

From the Sutthiphong-H/project-flip-disc repository on GitHub, at the commit this page was made from: the board is PCB_Controller/PCB_Controller.kicad_pcb and its schematic PCB_Controller/PCB_Controller.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the PCB Controller design in my own project?

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