No description
  • C# 67.2%
  • C++ 32.8%
Find a file
2026-03-03 10:56:55 -05:00
.github/workflows Update build-windows-app.yml 2026-02-24 18:15:16 -05:00
firmware Consolidate deferred issues into KNOWN_ISSUES.md 2026-02-27 19:01:54 +00:00
windows Fix Balanced mode oscillation: detect target-crossing and dampen 2026-03-03 15:48:00 +00:00
.gitignore Initial implementation of LinTool measurement automation system 2026-02-15 16:44:56 -05:00
adaptivelog.txt Add files via upload 2026-03-03 09:38:18 -05:00
ARCHITECTURE.md Update ARCHITECTURE.md 2026-02-15 21:42:55 -05:00
CLAUDE.md Add communication rules to CLAUDE.md, flag hardcoded UI IDs 2026-02-27 18:44:37 +00:00
DOCUMENTATION_STATUS.md Update documentation status: ALL FILES COMPLETE (100%) 2026-02-15 18:24:24 -05:00
KNOWN_ISSUES.md Add advanced settings feature plan to KNOWN_ISSUES.md (#4) 2026-02-27 19:32:24 +00:00
LinTool_Debug_20260227_153931.log Add files via upload 2026-02-27 16:18:17 -05:00
log.txt Update log.txt 2026-02-26 15:07:31 -05:00
powers.txt Add files via upload 2026-02-27 17:03:53 -05:00
README.md Revert RMS current to 1000mA, update all docs to match 2026-02-27 18:07:24 +00:00

LinTool - Measurement Automation System

LinTool is a comprehensive measurement automation system consisting of a Windows desktop application and Raspberry Pi Pico firmware for controlling precision measurements with automated motor control.

System Overview

The system consists of two main components:

  1. Windows Application - A standalone .NET 8 WPF application that:

    • Controls automated measurements by interacting with a target desktop application via UI Automation
    • Communicates with the Pico via USB serial to control motor movements
    • Orchestrates the complete measurement workflow
  2. Raspberry Pi Pico Firmware - Arduino-based firmware that:

    • Controls a stepper motor via TMC2209 driver
    • Receives commands from the Windows application
    • Provides precise motor positioning and movement

Features

Windows Application

  • Parameter Configuration:

    • Low Power setting (default: 3.0)
    • High Power setting with "maximum reachable power" option
    • Power Steps (default: 5.0)
    • Attenuation range selection (0dB-30dB in 2dB steps)
  • Automated Workflow:

    • Iterates through attenuation levels
    • Adjusts motor position to achieve target power readings
    • Takes measurements at specified power increments
    • Stops at maximum power or when no change detected
  • USB Serial Communication:

    • Connects to Raspberry Pi Pico via COM port
    • Sends motor control commands
    • Receives position and status updates

Pico Firmware

  • TMC2209 Driver Control:

    • 16 microsteps for smooth operation
    • StealthChop mode for quiet operation
    • Configurable current settings (default: 1000mA RMS)
  • Serial Command Protocol:

    • MOVE:<steps> - Move by specified steps
    • MOVE_HALF - Move half rotation
    • STOP - Emergency stop
    • GET_POS - Get current position
    • RESET_POS - Reset position counter
    • SET_SPEED:<rpm> - Set motor speed

Hardware Requirements

Raspberry Pi Pico Setup

  • Raspberry Pi Pico
  • TMC2209 stepper motor driver
  • NEMA 17 stepper motor (200 steps/rev)
  • 12V or 24V power supply for motor

Pin Connections:

  • GPIO 2 → TMC2209 STEP
  • GPIO 3 → TMC2209 DIR
  • GPIO 4 → TMC2209 EN
  • GPIO 8 → 1K resistor → BTT board RX pin (UART TX to PDN_UART)
  • GPIO 9 → BTT board RX pin (UART RX from PDN_UART, direct)
  • Pico GND → TMC2209 GND (common ground)
  • Pico 3.3V → TMC2209 VIO (logic voltage)

UART Wiring (Single-Wire via BTT board RX pin): Both Pico GPIO 8 (TX) and GPIO 9 (RX) connect to the same BTT TMC2209 board "RX" header pin. A 1K resistor on GPIO 8 prevents bus contention. The BTT board's "TX" header pin is not used.

TMC2209 Power:

  • VM → Motor power supply positive (12V or 24V)
  • GND → Common ground (shared with Pico and power supply)
  • Motor terminals → Stepper motor coils

See firmware/README.md for detailed hardware setup instructions.

Installation

Windows Application

Option 1: Download Pre-built Release

  1. Go to the Releases page
  2. Download the latest LinTool-Windows-x64.exe
  3. Run the executable (no installation required)

Option 2: Build from Source

Requirements:

  • .NET 8 SDK
# Clone repository
git clone <repository-url>
cd LinTool

# Build
dotnet build windows/LinTool.sln --configuration Release

# Publish standalone executable
dotnet publish windows/LinTool/LinTool.csproj \
  --configuration Release \
  --runtime win-x64 \
  --self-contained true \
  --output bin \
  -p:PublishSingleFile=true \
  -p:PublishTrimmed=true

# Executable will be in bin/LinTool.exe

Pico Firmware

Requirements:

  • Arduino IDE 2.x or newer
  • Raspberry Pi Pico board support
  • TMCStepper library

See firmware/README.md for detailed installation instructions.

Usage

1. Setup Hardware

  1. Connect TMC2209 driver to Raspberry Pi Pico according to pin diagram
  2. Connect stepper motor to TMC2209 driver
  3. Connect motor power supply to TMC2209
  4. Connect Pico to Windows PC via USB

2. Upload Firmware

  1. Open firmware/LinTool_Pico/LinTool_Pico.ino in Arduino IDE
  2. Select "Raspberry Pi Pico" board
  3. Select the correct COM port
  4. Upload firmware

3. Run Windows Application

  1. Launch LinTool.exe
  2. Select the Pico's COM port from dropdown
  3. Click "Connect"
  4. Configure measurement parameters:
    • Set Low Power, High Power, and Power Steps
    • Select Starting and Ending Attenuation levels
  5. Click "Start Measurement"

4. Monitor Progress

  • Status log shows real-time progress
  • Progress indicator displays current attenuation level
  • Connection status shows serial port state

Measurement Workflow

For each attenuation level in the specified range:

  1. Set Attenuation: Select attenuation value in target application dropdown
  2. Add User Comment: Click user comment button and enter attenuation value
  3. Adjust to Low Power: Move motor until power reading equals low power setting
  4. Initial Measurement: Click measure button
  5. Increment and Measure:
    • Move motor to increase power by power step amount
    • Take measurement
    • Repeat until stopping condition met
  6. Stopping Conditions:
    • If "maximum reachable power" is checked: Stop when half rotation produces no power change
    • Otherwise: Stop when high power value is reached

Architecture

Windows Application Structure

windows/LinTool/
├── Models/                    # Data models
│   ├── MeasurementParameters.cs
│   └── AttenuationLevel.cs
├── Services/                  # Business logic
│   ├── MotorControlService.cs      # Serial communication
│   ├── UIAutomationService.cs      # UI automation (placeholders)
│   └── MeasurementOrchestrator.cs  # Main workflow
└── ViewModels/                # MVVM view models
    └── MainViewModel.cs

Pico Firmware Structure

firmware/LinTool_Pico/
├── LinTool_Pico.ino          # Main Arduino sketch
├── MotorController.h/.cpp    # TMC2209 motor control
└── SerialProtocol.h/.cpp     # Command parsing

Development

Building Windows Application Locally

# Restore dependencies
dotnet restore windows/LinTool.sln

# Build in debug mode
dotnet build windows/LinTool.sln --configuration Debug

# Run application
dotnet run --project windows/LinTool/LinTool.csproj

CI/CD Pipeline

GitHub Actions automatically builds the Windows application on:

  • Push to main/master/develop branches
  • Pull requests
  • New releases

Artifacts are uploaded and attached to releases automatically.

UI Automation Notes

The UIAutomationService.cs currently contains placeholder implementations. To complete the integration:

  1. Use a tool like Inspect.exe (Windows SDK) or UI Automation Verify to identify UI elements in the target application

  2. Update the element identifiers in UIAutomationService.cs:

    • AttenuationDropdown - AutomationId or Name of attenuation dropdown
    • UserCommentButton - AutomationId or Name of user comment button
    • UserCommentTextbox - AutomationId or Name of text input
    • MeasureButton - AutomationId or Name of measure button
    • PowerReadingText - AutomationId or Name of power reading display
  3. Uncomment and adapt the example implementation code in each method

Troubleshooting

Windows Application

  • Serial port not found: Make sure Pico is connected and drivers are installed
  • Connection timeout: Verify Pico firmware is uploaded and running
  • Command errors: Check serial communication baud rate (115200)

Pico Firmware

  • Motor not moving: Check TMC2209 EN pin (should be LOW when enabled)
  • Motor stuttering: Adjust RMS current setting in MotorController.cpp
  • Serial not responding: Verify UART pins (GPIO 8, 9) are correctly configured

License

[Add your license here]

Contributing

[Add contribution guidelines here]

Support

For issues and questions:

  • Open an issue on GitHub
  • Check existing documentation in /firmware/README.md