SpawnDev.BlazorJS.NexStar
1.2.0
dotnet add package SpawnDev.BlazorJS.NexStar --version 1.2.0
NuGet\Install-Package SpawnDev.BlazorJS.NexStar -Version 1.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SpawnDev.BlazorJS.NexStar" Version="1.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SpawnDev.BlazorJS.NexStar" Version="1.2.0" />
<PackageReference Include="SpawnDev.BlazorJS.NexStar" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SpawnDev.BlazorJS.NexStar --version 1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SpawnDev.BlazorJS.NexStar, 1.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SpawnDev.BlazorJS.NexStar@1.2.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SpawnDev.BlazorJS.NexStar&version=1.2.0
#tool nuget:?package=SpawnDev.BlazorJS.NexStar&version=1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
SpawnDev.BlazorJS.NexStar
SpawnDev.BlazorJS.NexStar provides a robust NexStarService for communicating with and controlling Celestron NexStar telescopes directly from a browser using the Web Serial API in Blazor WebAssembly.
Built on top of SpawnDev.BlazorJS, this library enables full hardware access without requiring a backend server.
🔭 Live Demo App
The repository includes SpawnDev.BlazorJS.NexStar.App, a full-featured Progressive Web App (PWA) demonstrating the library's capabilities.
App Features:
- Telescope Control:
- Complete directional slewing with variable rates.
- GoTo coordinates (RA/Dec).
- Tracking mode selection (EQ North, EQ South, Alt-Az, Off).
- Object Browser:
- Catalog of 110 Messier objects and bright alignment stars.
- "Quick Access" panel showing objects currently visible from your location.
- Filter by constellation, magnitude, and type.
- Satellite Tracker 🛰️:
- Real-time tracking of orbital objects (ISS, Starlink, weather satellites, etc.).
- Fetches TLE data from CelesTrak with offline caching.
- Automatic telescope slewing to track selected satellite.
- Plane Tracker ✈️:
- Real-time tracking of nearby aircraft using ADS-B data.
- Displays callsign, altitude, speed, and distance.
- Calculate look angles and track aircraft with telescope.
- Alignment Helper:
- Real-time suggestions for best alignment stars based on time and location.
- Visual tracking of alignment status.
- Location Services:
- Sync telescope time and location with browser data.
- Fallback USB Support:
- For Android devices, uses Web USB API to connect via Prolific PL2303 driver.
- Dark Mode:
- Optimized dark red/black UI for viewing in low light environments.
Data Sources & Credits
| Feature | Source | License |
|---|---|---|
| Satellite TLE Data | CelesTrak | Free for non-commercial use |
| Aircraft Data | OpenSky Network | Free API (non-commercial) |
Dependencies
| Package | Purpose |
|---|---|
| SGP.NET | SGP4 orbital propagation for satellite tracking |
💻 Library Features (SpawnDev.BlazorJS.NexStar)
Core Capabilities
- Web Serial Connectivity: Direct serial port selection and connection via browser.
- Web USB Connectivity: Fallback connection method for Android devices using Web USB API.
- Command Protocol: Implementation of the Celestron NexStar communication protocol.
- Position Tracking:
- Real-time RA/Dec and Az/Alt monitoring.
- Automatic polling and state management.
- Astronomy Math:
- Built-in utilities for coordinate conversion (Equatorial ↔ Horizontal).
- LST (Local Sidereal Time) calculation.
- Visibility calculations based on observer location.
- Catalogs:
- Integrated database of alignment stars and Messier objects.
Installation
dotnet add package SpawnDev.BlazorJS.NexStar
Usage Example (Program.cs)
using SpawnDev.BlazorJS;
using SpawnDev.BlazorJS.NexStar;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
// Add BlazorJSRuntime (Required for Web Serial/USB)
builder.Services.AddBlazorJSRuntime();
// Add NexStarService
builder.Services.AddSingleton<NexStarService>();
await builder.Build().BlazorJSRunAsync();
Common Usage Examples
@inject NexStarService NexStar
<button @onclick="Connect" disabled="@NexStar.SerialPortSelected">Connect</button>
<button @onclick="Disconnect" disabled="@(!NexStar.SerialPortSelected)">Disconnect</button>
@if (NexStar.SerialPortSelected)
{
<p>Model: @NexStar.Model | Aligned: @NexStar.IsAligned</p>
<p>RA: @NexStar.CurrentRa?.ToString("F4")h | Dec: @NexStar.CurrentDec?.ToString("F2")°</p>
<p>Az: @NexStar.CurrentAz?.ToString("F2")° | Alt: @NexStar.CurrentAlt?.ToString("F2")°</p>
<button @onclick="GoToM31">GoTo M31 (Andromeda)</button>
<button @onclick="StopSlew">Stop</button>
}
@code {
// Connect to telescope (opens device picker)
private async Task Connect()
{
if (await NexStar.SelectPortAsync())
{
Console.WriteLine($"Connected to {NexStar.Model}");
}
}
// Disconnect from telescope
private async Task Disconnect() => await NexStar.DeselectPortAsync();
// GoTo a specific RA/Dec coordinate (M31 Andromeda Galaxy)
private async Task GoToM31()
{
double ra = 0.712; // RA in hours (0h 42m 44s)
double dec = 41.27; // Dec in degrees (+41° 16')
await NexStar.GotoRaDecAsync(ra, dec);
}
// GoTo using Az/Alt (useful for terrestrial or satellite tracking)
private async Task GoToAzAlt(double az, double alt)
{
await NexStar.GotoAzAltAsync(az, alt);
}
// Slew manually (for directional buttons)
private async Task SlewNorth() => await NexStar.SlewFixedAsync(SlewAxis.Dec, SlewDirection.Positive, 5);
private async Task SlewSouth() => await NexStar.SlewFixedAsync(SlewAxis.Dec, SlewDirection.Negative, 5);
private async Task SlewEast() => await NexStar.SlewFixedAsync(SlewAxis.Ra, SlewDirection.Positive, 5);
private async Task SlewWest() => await NexStar.SlewFixedAsync(SlewAxis.Ra, SlewDirection.Negative, 5);
// Stop all slewing
private async Task StopSlew() => await NexStar.StopAllSlewAsync();
// Set tracking mode
private async Task SetTracking(TrackingMode mode) => await NexStar.SetTrackingModeAsync(mode);
// Sync current position (after centering on a known star)
private async Task SyncPosition(double ra, double dec) => await NexStar.SyncRaDecAsync(ra, dec);
// Set telescope time/location from browser
private async Task SyncTimeLocation()
{
await NexStar.SetTimeAsync(DateTime.UtcNow);
// Location can be set via NexStar.SetLocationAsync(lat, lon)
}
}
Key Properties
| Property | Type | Description |
|---|---|---|
SerialPortSelected |
bool |
True if connected to telescope |
IsAligned |
bool |
True if telescope is aligned |
Model |
string? |
Telescope model name |
CurrentRa / CurrentDec |
double? |
Current RA/Dec position |
CurrentAz / CurrentAlt |
double? |
Current Az/Alt position |
TrackingMode |
TrackingMode |
Current tracking mode |
Key Methods
| Method | Description |
|---|---|
SelectPortAsync() |
Opens device picker, connects to telescope |
DeselectPortAsync() |
Disconnects from telescope |
GotoRaDecAsync(ra, dec) |
Slew to RA/Dec coordinates |
GotoAzAltAsync(az, alt) |
Slew to Az/Alt coordinates |
SlewFixedAsync(axis, dir, rate) |
Manual slew at fixed rate (1-9) |
StopAllSlewAsync() |
Stop all motion |
SyncRaDecAsync(ra, dec) |
Sync position after centering |
SetTrackingModeAsync(mode) |
Set tracking (Off, AltAz, EqNorth, EqSouth) |
Requirements
- A browser with Web Serial API support (Chrome, Edge, Opera).
- A browser with Web USB API support (Chrome on Android).
- A Celestron NexStar telescope (or compatible mount).
- A USB cable connected to the telescope's hand controller port.
Tested Platforms
- Windows (Chrome): Verified working with Web Serial API.
- Android (Chrome): Verified working with Web USB API (using minimal PL2303 driver).
- Web Serial: Generic Support
- Web USB: Generic Prolific PL2303 Support
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- SpawnDev.BlazorJS (>= 2.62.0)
-
net6.0
- SpawnDev.BlazorJS (>= 2.62.0)
-
net7.0
- SpawnDev.BlazorJS (>= 2.62.0)
-
net8.0
- SpawnDev.BlazorJS (>= 2.62.0)
-
net9.0
- SpawnDev.BlazorJS (>= 2.62.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.