Skip to content

bartei/rotary-controller-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

636 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Rotary Controller Python (RCP)

Discord Shop at Provvedo

A Kivy-based Digital Read-Out (DRO) and single-axis controller UI for rotary tables and similar devices, designed to run on Raspberry Pi or desktop environments (Windows, macOS, Linux). Interfaces via RS-485/Modbus RTU with a dedicated STM32-based control board.

πŸ›’ Purchase all boards from our shop: Provvedo Shop


πŸš€ Features

  • Responsive touch-capable UI built with Kivy
  • Communicates over RS-485 Modbus RTU with an STM32 controller (rotary-controller-f4)
  • Configurable axes β€” add/remove axes, assign hardware scale inputs, apply transforms (identity, scaling, weighted sum, angle cos/sin)
  • Electronic Lead Screw (ELS) mode for synchronized threading and power feed on manual lathes
  • Sync mode with configurable gear ratios for spindle-synchronized movement
  • Circle pattern calculator for bolt hole patterns
  • Customizable display: fonts, colors, digit formats (metric/imperial/angle)
  • Contextual help β€” info button on every setting field with documentation and examples
  • Works on Raspberry Pi 3/4/5, Windows, macOS, and Linux
  • Runs headless on Pi using the custom OSPI OS with pre-installed RCP (ospi)

🎯 Requirements

  • Hardware

    • Rotary controller board (STM32 firmware from rotary-controller-f4)
    • RS-485 interface (e.g. via Power Hat)
    • Raspberry Pi 3/4/5 for Pi deployments
  • Software

    • Python 3.10+
    • uv package manager

βš™οΈ Installation & Setup

1. Clone the Repository

git clone https://github.com/bartei/rotary-controller-python.git
cd rotary-controller-python

2. Install uv

Install uv (Linux/macOS):

curl -LsSf https://astral.sh/uv/install.sh | sh

For Windows, see the uv installation docs.

3. Install Dependencies

uv sync

4. Run the App

uv run python -m rcp.main

5. Run Tests

uv run pytest

πŸ’» Platform-specific Notes

Windows/macOS/Linux

  • Python >= 3.10
  • Virtual environment managed automatically by uv
  • Ensure your RS-485 adapter is accessible (check serial port permissions on Linux/macOS)

Raspberry Pi & OSPI

  • Install an SD card image from the OSPI project

  • RCP is pre-installed in /root/rotary-controller-python/

  • To update:

    sudo systemctl stop rotary-controller
    cd /root/rotary-controller-python
    git pull
    uv sync
    reboot
  • View logs:

    journalctl -u rotary-controller
    journalctl -xeu rotary-controller
    tail -n +1 /var/log/kivy*

πŸ“‚ Project Structure

rcp/
β”œβ”€β”€ main.py                    # Entry point (asyncio + Kivy event loop)
β”œβ”€β”€ app.py                     # MainApp class
β”œβ”€β”€ feeds.py                   # Feed/thread pitch configurations
β”œβ”€β”€ help/                      # Contextual help documents (markdown)
β”œβ”€β”€ components/                # UI layer
β”‚   β”œβ”€β”€ home/                  # Home screen (coordbar, servobar, elsbar, statusbar)
β”‚   β”œβ”€β”€ screens/               # Full-screen views (setup, scale, servo, formats, etc.)
β”‚   β”œβ”€β”€ widgets/               # Reusable form widgets with help button support
β”‚   β”œβ”€β”€ popups/                # Modal dialogs (keypad, help, feeds table, etc.)
β”‚   β”œβ”€β”€ toolbars/              # Toolbar buttons
β”‚   └── plot/                  # Plot/visualization
β”œβ”€β”€ dispatchers/               # Event dispatchers and state management
β”‚   β”œβ”€β”€ saving_dispatcher.py   # Auto-persisting properties to YAML
β”‚   β”œβ”€β”€ formats.py             # Display format settings
β”‚   β”œβ”€β”€ circle_pattern.py      # Circle pattern calculator
β”‚   └── board.py               # Board/device event dispatcher
└── utils/                     # Hardware communication layer
    β”œβ”€β”€ communication.py       # ConnectionManager (Modbus RTU)
    β”œβ”€β”€ base_device.py         # C typedef parser and register I/O
    └── devices.py             # Device type definitions

πŸ› οΈ Troubleshooting

  • Serial issues: Verify RS-485 wiring, correct serial port, and permissions
  • Service failures (Pi): Check journalctl logs and Kivy log files under /var/log/
  • Display issues: Adjust font size and display format in the Formats setup screen

πŸ“š References & Related Projects


🧾 Changelog

See CHANGELOG.md for detailed history, updates, and breaking changes.


🀝 Contributing

Contributions are welcome! Please:

  • Open issues for bugs or feature requests
  • Submit pull requests or improvements
  • Help with testing, documentation, porting new features

πŸ† Support

Join our Discord community for support, collaboration, and updates.


πŸ“„ License

Licensed under MIT. See LICENSE for full terms.

About

Digital Read Out and Single Axis Controller Python UI

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors