Skip to content

FyrbyAdditive/FAC1-Controller-Linux

Repository files navigation

FAC1 Controller - Linux

A native Qt application for controlling pan and tilt servos for the FAC1 Camera. Ported from the macOS version to Linux with Flatpak distribution support.

FAC1 Camera

Features

  • Automatic USB-Serial Detection: Automatically finds and connects to USB-serial devices
  • Dual Servo Control: Controls pan and tilt servos (IDs: pan=6, tilt=4)
  • Connection Status: Detailed status reporting for USB and individual servo connections
  • Calibration: Calibrate the center point of the servos and toggle axis inversion
  • Always on Top: Optional window mode to keep the controller always visible
  • Minimal Interface: Simple arrow button controls (↑ ↓ o ← →)

FAC1 Camera

Requirements

  • Linux (tested on Ubuntu/Debian-based distributions)
  • Qt6 (Widgets)
  • USB-to-serial adapter
  • FAC1 Camera with Feetech STS servos
  • CMake 3.16+
  • C++17 compiler

Building from Source

Install Dependencies

Ubuntu/Debian:

sudo apt-get install build-essential cmake qt6-base-dev

Fedora:

sudo dnf install gcc-c++ cmake qt6-qtbase-devel

Arch:

sudo pacman -S base-devel cmake qt6-base

Clone and Build

# Clone this repository
git clone https://github.com/FyrbyAdditive/FAC1-Controller-Linux.git
cd FAC1-Controller-Linux

# Clone the SCServo_Linux library (patched version)
git clone https://github.com/FyrbyAdditive/SCServo_Linux.git

# Build
mkdir build && cd build
cmake ..
make

# Run
./FAC1Controller

Building Flatpak

Quick Build (Single-File Bundle)

# Run the build script
./build-flatpak.sh

This creates FAC1Controller.flatpak - a single-file bundle you can distribute.

Install and run:

flatpak install FAC1Controller.flatpak
flatpak run com.fyrbyadditive.FAC1Controller

Manual Build

# Install flatpak and flatpak-builder
sudo apt-get install flatpak flatpak-builder

# Add Flathub repository
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

# Install KDE runtime
flatpak install flathub org.kde.Platform//6.7 org.kde.Sdk//6.7

# Build the Flatpak with repository
flatpak-builder --repo=repo --force-clean build-dir com.fyrbyadditive.FAC1Controller.yml

# Create single-file bundle
flatpak build-bundle repo FAC1Controller.flatpak com.fyrbyadditive.FAC1Controller

# Or install locally for development
flatpak-builder --user --install --force-clean build-dir com.fyrbyadditive.FAC1Controller.yml

# Run the Flatpak
flatpak run com.fyrbyadditive.FAC1Controller

Usage

First Launch

  1. Connect your USB-to-serial adapter
  2. Power on your servos
  3. Launch the application
  4. The app will automatically search for and connect to available USB-serial ports

Controls

  • (Up Arrow): Tilt up
  • (Down Arrow): Tilt down
  • O (Circular Button): Center Camera
  • (Left Arrow): Pan left
  • (Right Arrow): Pan right

Configuration

  • Pan Servo ID: Hardcoded to ID 6
  • Tilt Servo ID: Hardcoded to ID 4
  • Always on Top: Check to keep the window always visible
  • Reconnect/Disconnect: Manually control USB-serial connection

Calibration

Use the "Calibration" menu to:

  • Calibrate Center Position: Set the current position as the center point
  • Invert Pan: Reverse the pan direction
  • Invert Tilt: Reverse the tilt direction

Servo Configuration

The application uses the following servo settings:

  • Pan Servo ID: 6 (hardcoded)
  • Tilt Servo ID: 4 (hardcoded)
  • Baud Rate: 1,000,000
  • Protocol: STS series (STS3250)
  • Movement Step: 100 units per button press
  • Speed: 200
  • Acceleration: 50
  • Position Range: 0 - 4095 (full 360°)

Servo IDs can be changed in src/ServoController.cpp if needed.

Troubleshooting

Application doesn't connect

  1. Check that servos are powered on
  2. Verify USB-serial adapter is connected
  3. Make sure servo IDs match the configured values
  4. Click "Reconnect" to retry connection

Permission denied errors

On Linux, you may need to add your user to the dialout group:

sudo usermod -a -G dialout $USER

Log out and log back in for the changes to take effect.

Alternatively, you can use udev rules. Create /etc/udev/rules.d/99-usb-serial.rules:

SUBSYSTEM=="tty", ATTRS{idVendor}=="YOUR_VENDOR_ID", MODE="0666"

Then reload udev rules:

sudo udevadm control --reload-rules
sudo udevadm trigger

List available serial ports

ls /dev/ttyUSB* /dev/ttyACM*

Credits

This project uses the SCServo_Linux library by Aditya Kamath for servo communication.

Original macOS version: FAC1-Controller-macOS

Copyright 2025, Timothy Ellis, Fyrby Additive Manufacturing & Engineering

About

Pan & tilt controller for the Fyrby Additive Camera 1 for Linux

Resources

Stars

Watchers

Forks

Packages

No packages published