Nightglass
A desktop controller for the Celestron Origin smart telescope, for macOS,
Linux and Windows: discovery, status, initialize/align, go-to from 34 deep-sky
catalogs, a Planetarium, manual slew, focus, imaging with live and stacked
frames, mosaics, schedules, Wi-Fi and camera settings, and saving the final
image. It is a clean-room Go reimplementation of the Origin app’s
telescope protocol; it contains no Celestron code, artwork or sky data.

Layout
| Path |
What |
origin/ |
protocol: WebSocket client, commands, image download, discovery |
origin/fake/ |
in-process fake Origin for tests, procedural and survey sky frames |
catalog/ |
the astro-recommender target lists (packed gob), alt/az, Solar System, Sun & Moon times, rise/transit/set, framing of large nebulae, the Planetarium’s stars and constellations |
app/control/ |
the GUI’s Go side (no Wails import, tests anywhere) |
app/ |
Wails v3 window and the HTML/CSS/JS frontend |
cmd/originctl/ |
CLI with every GUI action |
cmd/origin-fake/ |
simulated Origin for GUI work without a telescope |
Build
Go 1.27.1 or newer. The GUI needs the platform WebView toolchain:
- Linux (Debian 13 / Ubuntu 24.04):
sudo apt install libgtk-4-dev libwebkitgtk-6.0-dev
- macOS: Xcode command line tools (
xcode-select --install)
- Windows: nothing extra; the WebView2 runtime ships with Windows 10/11
go build -o dist/ ./cmd/... # originctl, origin-fake
go build -o dist/nightglass ./app # Linux, macOS
go build -ldflags -H=windowsgui -o dist/nightglass.exe ./app # Windows
With Task: task build formats, regenerates the
catalog lists and builds everything into dist/; task build-cli builds only
the static CLI tools; task --list shows the rest.
Develop without a telescope
go run ./cmd/origin-fake # prints: fake Origin at 127.0.0.1:8080
go run ./app # finds it by its UDP announcement, or Connect… → 127.0.0.1:8080
go run ./cmd/originctl -host 127.0.0.1:8080 status
The fake announces itself for discovery (-announce 0 turns it off; a second
one on another port, e.g. -listen 127.0.0.1:8081, brings up the picker),
moves its mount for go-tos, the slew pad and Reframe, focuses (stars blur
off focus), reboots or powers down when told to (-reboot sets how long a
reboot takes), offers a flat panel with -elpanel, a cooled camera with
-cooled, no dew heater with -dewheater=false, configurable optics with
-optics (an Origin’s are fixed), Wi-Fi networks to join, imaging lists
(Schedules) and video capture, and serves star fields of
where it points (with the position in each image’s notification), less noisy
as a stack deepens.
For real sky in the frames, -sky cuts 2.5° tiles from a HiPS survey via CDS
hips2fits, or from the DESI Legacy Survey viewer with legacy:<layer>, in the
background (network needed; procedural stars stand in until a tile arrives).
When CDS does not answer, CDS/P/DSS2/color tiles are made from ESA’s mirror
of its HiPS (skies.esac.esa.int/DSSColor) instead:
go run ./cmd/origin-fake -sky CDS/P/DSS2/color
go run ./cmd/origin-fake -sky legacy:ls-dr10 # Dec > ~-68°, no Milky Way
go run ./cmd/origin-fake -sky CDS/P/PanSTARRS/DR1/color-z-zg-g,CDS/P/DSS2/color # first covering each tile
Test
go test -race ./...
node --test app/frontend/targets.test.mjs
sh scripts/smoke.sh # the GUI in Wails server mode against origin-fake
sh scripts/e2e.sh # GUI tests: the frontend in headless Chrome (CHROME=… if not found)
task check # all of the above, as CI runs them
task lint # format, then golangci-lint (must report 0 issues)
task demo # re-render demo.gif (headless Chrome, ffmpeg, gifsicle, network)
Releases
Push a tag such as v0.1.0: .github/workflows/release.yml builds
Nightglass with originctl and origin-fake for macOS (Apple Silicon and
Intel, as Nightglass.app), Linux and Windows, and attaches them to a
GitHub release. macOS builds are signed and notarised when the
MACOS_CERT_P12, MACOS_CERT_PASSWORD, APPLE_ID, APPLE_TEAM_ID and
APPLE_APP_PASSWORD secrets are set, and are unsigned otherwise.
The icon is Nightglass’s own (app/build/icon.svg); after changing it run
sh scripts/icons.sh and commit the regenerated icon.png, icon.ico and
icon.icns.
Updating the catalogs
catalog/targets/*.yaml are verbatim copies from
astro-recommender
(internal/catalog/targets/); never edit them here. To update: copy the YAML
files over, update the commit in catalog/targets/NOTICE.md, then
go test ./catalog -run TestEmbeddedLists -args -update
and commit the YAML and the regenerated *.gob together. CI fails if they
disagree. If no *.gob exists at all (a fresh tree), add
-tags catalogbootstrap to that command once.
The Planetarium’s stars and constellations (catalog/sky.gob) are packed
from the Yale Bright Star Catalogue (public domain) and d3-celestial’s
constellation lines and names (BSD 3-Clause); sources and licences are in
catalog/SKY-NOTICE.md, shown in About. To rebuild it:
curl -O http://tdc-www.harvard.edu/catalogs/bsc5.dat.gz && gunzip bsc5.dat.gz
curl -O https://raw.githubusercontent.com/ofrohn/d3-celestial/master/data/constellations.lines.json
curl -O https://raw.githubusercontent.com/ofrohn/d3-celestial/master/data/constellations.json
go run catalog/skygen.go -bsc bsc5.dat -lines constellations.lines.json -names constellations.json
go test ./catalog -run TestSky
Hardware acceptance checklist
Run against a real Origin, from the GUI and once with originctl. Items marked
verify are protocol details only the hardware can confirm.
originctl discover lists the telescope once (UDP 55555; firmware
1.5.6286 announces Identity:<id> Origin IP Address = <ip> for each of
its Wi-Fi and Ethernet addresses, kept once by identity). On Origin’s own
Wi-Fi it also lists 1.2.3.4, its direct-connect address.
- Connect; status shows mount, battery, task state, weather, storage
(replies and notifications name their module in
Source, which
Celestron’s own web app in firmware 1.5.6286 routes by too).
- Settings: enter location and time zone. Initialize & align completes and
Aligned turns yes (latitude/longitude go out as radians, which firmware
1.5.6286 checks them as).
- Slew pad and arrow keys move the mount at each rate (1–9 on the slider, as the web client’s); releasing stops it, and rates 1–5 are slow enough for centring.
Switching to another window mid-slew stops it. Up and right send
+
AltRate and +AzmRate, as Celestron’s web app does; verify right
is azimuth-increasing.
- Pull the Wi-Fi mid-slew: within about 10 s Nightglass notices the silent
link and reconnects; the mount stops when the link returns.
- Focus ±10/±100 (±100/±1000 in snapshot mode) and a typed position move
the focuser within its limits, only while idle; Auto runs autofocus.
Verify
Focuser/GetPositionLimits and the stretch sliders change the
stacked images.
- Pick a target above the lowest go-to altitude (Mount → Min Altitude, 0°
by default): Go to slews there (J2000 coordinates, unprecessed); below
it, or above a Max Altitude when one is set, Go to is refused. Go to and slewing are refused while the telescope is imaging.
- Image (as in the app, it images where the telescope points, so go to the
target first; the run is named after the selection only within about 1°
of where the telescope points, else after what is there): live frames,
then stacked frames update; Finish imaging
(HaltTasks + GetFinalStackedMaster) produces the final image, shown and
saved to the save folder as a PNG with EXIF (check it in an EXIF viewer);
the status line and progress bar follow the run as in the app. Cancel
imaging asks, then discards the run.
Disconnect mid-run and reconnect: the app offers the run’s image for
download.
Below 0° Image is refused; above 85° off a wedge it warns about field
rotation. With manual exposure off the Origin picks exposure and ISO;
verify both modes and snapshot (manual live view).
- Night mode (N) turns the whole window red.
- Snapshot mode: Capture Image takes a snapshot to save or delete.
Reframe: click the image, Center Here recentres there (verify the
offsets’ direction). The filter button changes filters and offers
autofocus.
- Files: list, re-download, copy to a USB stick (progress, cancel) and
delete image folders. Origin: each advanced setting changes the
telescope (verify the dew heater, fans and lights respond).
- On a wedge: initialize, accept the polar alignment recommendation, adjust
the mount until the errors are small, End Polar Alignment (verify
the error signs match the knobs). Capture dark and flat frames; check
Version & Updates against the Origin’s own app; demo mode indoors.
- On connect the Origin is told its Wi-Fi regulatory domain (verify
with
originctl watch that Network/SetRegulatoryDomain is accepted
for your country); an uncalibrated Origin shows “Factory Calibration
Incomplete” once.
- Solar System: go to the Moon and a planet, then image them. Verify
the run’s
TargetTrack (16 J2000 places one second apart from 30 s on,
the Moon corrected for parallax, Julian dates in UT) keeps the target
centred; firmware 1.5.6286 drops a track with no point after its own
clock, so a computer clock more than about 45 s behind the Origin’s
loses it. Verify that ObjectSize (twice the object’s size, as the app
sends it) gives the same exposures as the Origin’s own app.
- Status: charger, the site and clock the mount reports (they should match
Settings after Initialize), encoders and, with a StarSense Autoguider,
its state. The warning badge shows a low battery, charger fault or full
disk. Origin → Download Origin Logs saves the log bundle (firmware
1.5.6286 sends its
DownloadLink in System/LogsReady and serves it
under /SmartScope-1.0/dev2/Logs). Power Off disconnects. An
out-of-range manual exposure is limited with the app’s explanation.
- Gallery: favorite, view, delete and share (the file manager opens at the
image) saved images; Edit an image, crop and rotate it, Overwrite and
Export Copy, and check the result in an image viewer (the EXIF stays).
A typed address with no Origin offers Try Automatically.
- Start a run, close Nightglass and reconnect mid-run: verify what the
Origin sends for
GetFinalStackedMaster during a run (stacked or final;
a final one is saved as it arrives), and that Finish then works.
- Pull the Wi-Fi briefly: Nightglass reconnects, clears the images and
rejoins a run in progress. Verify which close code the Origin sends
when it shuts the connection itself (a normal close now disconnects
without reconnecting).
- A timed run (Stop after N min): the Origin ends it after that long
(Celestron’s web app relies on it too); verify the final image then
arrives; compare the battery
percentage with the Origin’s battery level over a session.
- Origin → Reboot: verify the Origin restarts and how long it takes
(Nightglass waits 180 s, as after an update; Attempt To Connect from the
connection badge reconnects earlier).
- On a wedge, accept the polar alignment recommendation at once: verify
the Origin starts polar alignment while it is still finishing
initialization (the app sends it immediately).
- Mosaic: from a target, Mosaic… with a 2 × 2 grid; verify the tiles,
their thumbnails, the status line’s tile and frame, Re-Capture, and
Compose Mosaic (the composed image is saved);
originctl watch shows
whether the Origin pushes Mosaic notifications. Before the first frame the
grid uses the sensor Camera/GetCameraInfo reports, at 335 mm:
verify its MaxImageWidth, MaxImageHeight and PixelSize (µm)
with originctl watch (an Origin 678C plans 4 × 2 tiles for 120′ × 40′).
- Version & Updates: verify the update offer against Celestron’s
channel list, the release notes, and “Download And Update Origin” (the
Origin downloads, installs and restarts; Nightglass reconnects).
- With
originctl watch: verify the close code when the Origin ends a
session.
- Start a mosaic, disconnect until it finishes, reconnect: “Image List
Available for Download” is offered (verify that
TaskController/GetObservingListInfo answers ImagingInfo.ListStatus
FINISHED); Download Images… opens it.
- During a run, the computer does not idle-sleep (macOS
pmset -g assertions lists caffeinate; Linux systemd-inhibit --list; Windows
powercfg /requests), and may sleep again once the Origin is idle.
- Give the Origin a new address (e.g. a DHCP change) and restart it:
Nightglass finds it at the new address instead of redialling the old one.
- Check a stacked and a final master’s bit depth (
originctl fetch): if
16-bit, verify Nightglass’s auto-stretch looks like the app’s; with
Auto-Crop Images on, the saved image is 64 pixels smaller each way.
- Provoke an Origin error (e.g. go to while it initializes): verify the
“Origin Error” alert, and that an error the app ignores (-2, -301) shows
nothing.
- Go to the Rosette (NGC 2237 / C 49), the Pelican (IC 5067) and IC 1396:
verify the frame holds the nebula (Nightglass’s own framing points,
catalog.Framing).
- Switch the Origin off while connected: Nightglass searches once (“Searching
for Origin…”) and, finding none, shows “Automatic Telescope Wi-Fi Connection
Failed” (Quick Start only if it never connected); with a typed address it
shows “Manual IP Address Invalid”. With Keep Screen On the display does not
blank (macOS, Windows; Linux as the desktop allows).
- Double-click Capture: one run starts and the button stays disabled until
the Origin reports it. Verify a frame announced while a stacked master
downloads is never needed (Nightglass drops it, as the app), and that a
schedule’s run reports
ComposingMosaicInfo.ListUuid while composing.
- Start a timed run, pull the Wi-Fi for a minute and restore it: the run
still ends by itself with its final image downloaded.
- Start Nightglass while the Origin is still booting: no “Connection
Failure” once it answers on the network; the connection opens by itself.
Verify go-to, slew, initialise and halt answer promptly (Nightglass no
longer waits for them) and that a single Origin is found at once via
origin.local.
- Origin → Images → Final Image Format: switch to PNG, image, finish; the
final image shows stretched and saves. Verify
ImageServer/GetFsmFormat
answers with Format (tif, png or jp2). Set jp2 with another
client: the final image is kept as a .jp2 beside the PNGs, with a toast.
- Go to the Moon (or a planet) with the telescope aligned and do not image:
verify it stays centred for an hour (
Mount/TrackMovingTarget, 361
places 10 s apart) and that the go-to is not cut short by the track.
- Files: Download All Files (ZIP) on a run saved with raw images: the ZIP
(status “Compressing Files N%…”) lands in the save folder with the
Light*.fits frames, and verify it is gone from the Origin after
(ImageServer/DeleteFile).
- Focus Hold: In / Hold: Out run the focuser while held and stop on
release, on leaving the window, and after a Wi-Fi pull. Verify which
way “in” moves the reported position.
- Status: battery temperature, telescope and CPU temperatures, the
camera’s temperature and, while guiding, the RA/Dec corrections.
- With an Origin-585C-TEC (cooled camera): Origin → Camera Cooling shows;
Cooler On at a target cools (status shows the cooler’s power), and the
choice is sent again after a reconnect. Verify the camera reports
Temperature and PowerLevel in Camera/GetCaptureParameters.
- A task that fails (initialize in daylight without demo mode): one
“Origin Error” alert, not one per second, and the status line follows the
Origin. Verify with
originctl watch that TaskController/GetStatus
carries the ErrorCode beside its State, and that a halted task
reports -7 (INTERRUPTED, not shown).
- Without a dew heater: verify what
DewHeater/GetStatus answers
(origin-fake -dewheater=false assumes -19, DEW_HEATER_NO_RESPONSE,
which shows an alert on each connect), and the status push rates
(origin-fake pushes Mount, Camera, TaskController, Environment and
DewHeater about once a second, as Celestron’s web app describes).
- Defaults are Celestron’s web client’s: a new run keeps raw images on the
Origin (check the run’s folder for
Light*.fits), manual imaging uses
10 s at ISO 1000, a new mosaic is 3° × 3° with 600 s tiles. Verify
autofocus with UseFineFocus (Focuser → Fine, the web client’s
default) still converges as the app’s did, and that Rough
(UseFineFocus false) searches a wider range.
- Wi-Fi tab: the mode, IP address and both lists match the Origin (a
dual-band router listed once); joining a known, an open and a secured
network moves the Origin there; a wrong passphrase shows “[Bad
Password]”; Force Direct Connect on and off, the 5 GHz switch and a new
Direct Connect password work. Verify the reply keys of
GetVisibleWiFi and Get5GHzAccessPoint, taken from the web client only.
- Optics tab: hidden on an Origin (it refuses Optics). Only on a telescope
that answers Optics: a model, a reducer and custom figures are kept.
- Schedules: two targets scheduled from the Target tab run on the Origin in
turn, the later one waiting for its rise (
MinimumStartTime); the list
then appears under Previous Schedules with each target’s frames;
Rerun (only failed) and Delete (with images) work; Power Down After
Completion powers it off.
- Camera tab: model, serial, firmware, SDK, image and pixel size match;
LiveStream off stops live frames; binning, bit depth and white balance
change the live view; Capture Single Image with and without Calibrate;
Start Stacking in manual and automatic exposure; Capture Video (exposure
under 0.1 s) with and without a region and a frame limit writes a SER
or AVI folder; the Filter select asks to refocus.
- Final Image: the last final image; Strength, Background and De-noise
change only the view (the Origin’s stretch and saved files unchanged).
- Target tab: Rise, Transit and Set Time agree with a planetarium for the
location (within a minute or two).
- Factory Reset: the Origin resets and restarts, and Nightglass
reconnects (to its access point, if its Wi-Fi was reset).
- Planetarium: the telescope’s reticle sits on the star it points at after
alignment (the mount’s own Alt/Azm), a clicked object or star becomes
the target and Goto Target slews to it, and Center Target / Center
Telescope turn the view to them. Every catalog’s objects are drawn (one
per object, the chosen list on top; All Catalogs hides the rest), and
clicking one selects it from its own list.
- Mount tab: Goto Coords slews to typed J2000 coordinates, Stop Slewing
stops it, Recenter reframes on a click in the live view, and verify
Enable Sidereal Tracking (
Mount/EnableTracking) starts and stops
tracking as Mount/GetStatus IsTracking reports.
- Focuser tab: Move To and the jog rate move the focuser and its velocity
shows while it moves; verify Calibrate Focuser
(
TaskController/CalibrateFocuser) finds the travel and updates
Focuser/GetPositionLimits, and that HaltTasks stops it.
License
MIT, see LICENSE, with these exceptions:
- The error code names and English error messages in
origin/errcodes.go
are reproduced from Celestron’s Origin app, so that Origin errors read as
the app reports them. They remain the property of their owner and are not
covered by the MIT license.
- The vendored catalog lists in
catalog/targets/ keep their own sources and
licenses, listed in catalog/targets/NOTICE.md.
评论