No project description provided
Project description
NexStarPy 🌌
Python 3.13+ interface for Celestron NexStar telescopes using the official serial communication protocol.
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 🤝
- Fork the repository
- Create feature branch (
git checkout -b feature/improvement) - Commit changes (
git commit -am 'Add new feature') - Push to branch (
git push origin feature/improvement) - 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e40534009f33e3dd2ba1982835948d6a858a4af127d26eb62bf7ee4a2c8ba2c5
|
|
| MD5 |
0e2fa62495e70a5874a7bd5cb272af67
|
|
| BLAKE2b-256 |
6bf4bbf217da418fd08237a047b232c681ad4cea19f0cc8afb65de0cda001a89
|
Provenance
The following attestation bundles were made for nexstarpy-0.1.0.tar.gz:
Publisher:
python-app.yml on ivangsm/nexstarpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nexstarpy-0.1.0.tar.gz -
Subject digest:
e40534009f33e3dd2ba1982835948d6a858a4af127d26eb62bf7ee4a2c8ba2c5 - Sigstore transparency entry: 165081175
- Sigstore integration time:
-
Permalink:
ivangsm/nexstarpy@6a7f9934d9a1f32e8fae3fc03f509a2913de8cce -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ivangsm
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-app.yml@6a7f9934d9a1f32e8fae3fc03f509a2913de8cce -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c82850ad7fe8df3f05ac9889106ca45e0eb9e91178e1725318781d59d4eb25e
|
|
| MD5 |
b21f38000c4e88681679f7e1faf11a86
|
|
| BLAKE2b-256 |
a7dcad7dfe933a1279fca7bc61908042ffe7caa0a5c93e3c4e01e8f658f5f77b
|
Provenance
The following attestation bundles were made for nexstarpy-0.1.0-py3-none-any.whl:
Publisher:
python-app.yml on ivangsm/nexstarpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nexstarpy-0.1.0-py3-none-any.whl -
Subject digest:
8c82850ad7fe8df3f05ac9889106ca45e0eb9e91178e1725318781d59d4eb25e - Sigstore transparency entry: 165081177
- Sigstore integration time:
-
Permalink:
ivangsm/nexstarpy@6a7f9934d9a1f32e8fae3fc03f509a2913de8cce -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ivangsm
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-app.yml@6a7f9934d9a1f32e8fae3fc03f509a2913de8cce -
Trigger Event:
push
-
Statement type: