ZWO Mount Control
A Rust library for controlling ZWO AM5/AM3 telescope mounts via serial communication, with built-in support for satellite tracking using the space-dust crate for TLE/SGP4 propagation.
Features
- GoTo/Slewing: Command the mount to slew to any celestial coordinates
- Manual Motion: Control axis motion at various speeds (guide to max slew)
- Tracking: Enable/disable tracking with sidereal, lunar, solar, or custom rates
- Alt-Az & Equatorial Modes: Switch between altitude-azimuth and equatorial tracking
- Autoguiding: Send guide pulses for autoguiding applications
- Satellite Tracking: Track satellites using TLE data and SGP4 propagation
- Mock Mount: Test your application without physical hardware
Installation
Add to your Cargo.toml:
[]
= { = "https://github.com/jmcguigs/zwo_mount_control" }
Quick Start
Connect to a Real Mount
use ;
// Connect via serial port (typical on Linux/Mac)
let mut mount = new;
mount.connect?;
// Get current position
let pos = mount.get_position?;
println!;
// Slew to Vega
let vega = from_hms_dms;
mount.goto_equatorial?;
Use the Mock for Testing
use ;
let mut mount = new;
mount.connect?;
mount.unpark?;
// Set Alt-Az mode and slew to horizontal coordinates
mount.set_altaz_mode?;
let target = new;
mount.goto_altaz?;
Satellite Tracking
use ;
// ISS TLE data
let line1 = "1 25544U 98067A 24001.50000000 .00016717 00000-0 10270-3 0 9025";
let line2 = "2 25544 51.6400 208.9163 0006703 35.6028 75.3281 15.49560066429339";
let mut tracker = from_tle?;
// Set observer location (Los Angeles)
tracker.set_observer_location;
// Find next pass
let pass = tracker.find_next_pass?;
if let Some = pass
Examples
Basic Control (Alt-Az Slewing)
This example demonstrates:
- Connecting to a mock mount
- Setting Alt-Az mode
- Going to home position
- Slewing to Az/Alt coordinates
Satellite Tracking
The example fetches TLE data from Celestrak and demonstrates satellite position calculations and pass predictions.
Module Overview
| Module | Description |
|---|---|
mount |
Core Mount trait and mount status types |
serial_mount |
Serial port mount implementation for real hardware |
mock_mount |
Simulated mount for testing |
protocol |
Serial command definitions (LX200-compatible with ZWO extensions) |
coordinates |
Coordinate conversion utilities (RA/Dec, Az/Alt, HMS/DMS) |
satellite_tracker |
Satellite tracking with TLE propagation |
error |
Error types |
Coordinate Systems
Equatorial Coordinates (RA/Dec)
Used when mount is in equatorial mode (on wedge, polar aligned):
- Right Ascension (RA): Decimal hours (0-24)
- Declination (Dec): Decimal degrees (-90 to +90)
Horizontal Coordinates (Az/Alt)
Used when mount is in Alt-Az mode (on tripod, no wedge):
- Azimuth (Az): Degrees from North (0-360°, clockwise)
- Altitude (Alt): Degrees above horizon (0-90°)
Hardware Requirements
- ZWO AM5 or AM3 mount (or compatible)
- USB-serial connection to the mount
- Serial port permissions (on Linux, add user to
dialoutgroup)
# Linux: Add user to dialout group for serial access
# Log out and back in for changes to take effect
Dependencies
space-dust- Satellite propagation (SGP4/TLE)serialport- Serial communicationchrono- Date/time handlingthiserror- Error types
License
MIT
Contributing
Contributions are welcome! Please feel free to submit issues and pull requests.