Skip to main content

No project description provided

Project description

NexStarPy 🌌

Python 3.13+ interface for Celestron NexStar telescopes using the official serial communication protocol.

Python 3.13+ License: MIT

Features ✨

  • Full Protocol Implementation: Supports all documented commands from NexStar Communication Protocol V1.2
  • Precision Control: Both standard (16-bit) and precise (24-bit) positioning modes
  • Modern API: Type hints and enum-driven interfaces
  • Safety First: Robust error handling with custom exceptions
  • Cross-Model Support: Compatible with multiple NexStar telescope models

Installation 📦

pip install nexstarpy

Requirements 🔧

Requirement Details
Python Version 3.13+
Dependencies pyserial

Quick Start 🔭

from nexstarpy import NexStar, constants

# Connect to telescope
telescope = NexStar(port="/dev/ttyUSB0")  # Use actual serial port

# Basic operations
print(f"Firmware: {telescope.get_version()}")
print(f"Model: {telescope.get_model().name}")

# Get current position
ra, dec = telescope.get_radec(precise=True)
print(f"Current RA/DEC: {ra:.6f}°, {dec:.6f}°")

# Slew to M31 (Andromeda Galaxy)
telescope.goto_radec(10.6847, 41.2689, precise=True)

# Set tracking mode
telescope.set_tracking_mode(constants.TrackingMode.EQ_NORTH)

# Close connection
telescope.close()

Core Functionality 🛠️

Position Control

# Get Alt/Azm coordinates
azm, alt = telescope.get_azm_alt(precise=True)

# GOTO Alt/Azm coordinates
telescope.goto_azm_alt(145.22, 60.78)

# Sync to current position (after manual alignment)
telescope.sync_to_position()

Tracking & Slewing

# Variable rate slew
telescope.slew_variable(
    axis=constants.Axis.AZM_RA,
    direction=constants.SlewDirection.POSITIVE,
    rate=45.5  # arcseconds/sec
)

# Fixed rate slew
telescope.slew_fixed(
    axis=constants.Axis.ALT_DEC,
    direction=constants.SlewDirection.NEGATIVE_FIXED,
    rate=5  # 0-9
)

Time & Location

# Set location (Guadalajara, JAL, México)
telescope.set_location(
    lat=(20, 40, 23, constants.Hemisphere.NORTH),    # 20°40'23" N
    lon=(103, 20, 58, constants.Hemisphere.WEST)     # 103°20'58" W
)

# Set time (24h format, UTC-8 with DST)
telescope.set_time((15, 30, 0, 4, 6, 5, 248, 1))  # April 6 3:30PM PDT

Error Handling ⚠️

try:
    telescope.goto_radec(400, 100)  # Invalid coordinates
except InvalidPositionError as e:
    print(f"GOTO failed: {e}")

try:
    telescope.set_tracking_mode(5)  # Invalid mode
except InvalidTrackingMode:
    print("Use TrackingMode enum values")

Supported Exceptions

Exception Description
CommunicationError Serial port issues
ProtocolError Invalid responses
InvalidSlewRate Rate out of bounds
AlignmentError GOTO before alignment

API Reference 📚

Core Classes

Class Description
NexStar Main telescope interface
constants Protocol enums and configuration
exceptions Custom error hierarchy

Key Methods

Method Description
get_radec() Get RA/DEC coordinates
goto_azm_alt() Slew to Alt/Azm position
set_tracking_mode() Configure tracking behavior
slew_variable() Start variable rate motion
set_location() Configure geographic position

Troubleshooting 🔧

Common Issues

# Serial port permissions
sudo chmod 666 /dev/ttyUSB0

# Timeout errors
telescope = NexStar(port="COM3", timeout=5.0)

# Protocol version mismatches
if telescope.get_version() < (1, 6):
    print("Precision commands unavailable")

Contributing 🤝

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/improvement)
  3. Commit changes (git commit -am 'Add new feature')
  4. Push to branch (git push origin feature/improvement)
  5. Open Pull Request

License 📄

MIT License - See LICENSE for details

Acknowledgments

Protocol documentation courtesy of Celestron LLC


Developed with 🔭 by Iván Salazar

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nexstarpy-0.1.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nexstarpy-0.1.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file nexstarpy-0.1.0.tar.gz.

File metadata

  • Download URL: nexstarpy-0.1.0.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for nexstarpy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e40534009f33e3dd2ba1982835948d6a858a4af127d26eb62bf7ee4a2c8ba2c5
MD5 0e2fa62495e70a5874a7bd5cb272af67
BLAKE2b-256 6bf4bbf217da418fd08237a047b232c681ad4cea19f0cc8afb65de0cda001a89

See more details on using hashes here.

Provenance

The following attestation bundles were made for nexstarpy-0.1.0.tar.gz:

Publisher: python-app.yml on ivangsm/nexstarpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nexstarpy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: nexstarpy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for nexstarpy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8c82850ad7fe8df3f05ac9889106ca45e0eb9e91178e1725318781d59d4eb25e
MD5 b21f38000c4e88681679f7e1faf11a86
BLAKE2b-256 a7dcad7dfe933a1279fca7bc61908042ffe7caa0a5c93e3c4e01e8f658f5f77b

See more details on using hashes here.

Provenance

The following attestation bundles were made for nexstarpy-0.1.0-py3-none-any.whl:

Publisher: python-app.yml on ivangsm/nexstarpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page