{"id":47612445,"url":"https://github.com/onstepninja/luna","last_synced_at":"2026-05-01T14:02:01.925Z","repository":{"id":345272447,"uuid":"1185062206","full_name":"OnStepNinja/LUNA","owner":"OnStepNinja","description":"AI-driven telescope controller for LX200, OnStep, and Temma2. MCP Server + Lua on ESP32.","archived":false,"fork":false,"pushed_at":"2026-04-30T04:08:01.000Z","size":1888,"stargazers_count":8,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-30T06:09:35.410Z","etag":null,"topics":["esp32","lua","lx200","mcp","onstep","temma2"],"latest_commit_sha":null,"homepage":"https://nskikaku.blog.fc2.com/","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OnStepNinja.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-18T07:45:23.000Z","updated_at":"2026-04-30T04:08:04.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/OnStepNinja/LUNA","commit_stats":null,"previous_names":["onstepninja/luna"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/OnStepNinja/LUNA","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OnStepNinja%2FLUNA","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OnStepNinja%2FLUNA/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OnStepNinja%2FLUNA/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OnStepNinja%2FLUNA/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OnStepNinja","download_url":"https://codeload.github.com/OnStepNinja/LUNA/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OnStepNinja%2FLUNA/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32499691,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["esp32","lua","lx200","mcp","onstep","temma2"],"created_at":"2026-04-01T20:39:28.871Z","updated_at":"2026-05-01T14:02:01.913Z","avatar_url":"https://github.com/OnStepNinja.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# LUNA — AI-Driven Telescope \u0026 Observatory Controller\n\n**MCP Server + Lua Scripting Engine on ESP32**\n\n\u003e Let Claude AI control your telescope, camera, and entire observatory — in plain language.\n\n![Version](https://img.shields.io/badge/version-v5.9.3-blue)\n![License](https://img.shields.io/badge/license-MIT-green)\n![Platform](https://img.shields.io/badge/platform-ESP32-orange)\n\n---\n\n## LUNA Docs (NotebookLM)\n\n📚 LUNA Docs — Start here for setup guides, technical references, and FAQ.\nAsk questions directly inside NotebookLM and get answers from the official documentation.\n👉 https://notebooklm.google.com/notebook/f2ce997f-18c2-44c4-8738-973b204c190c\n\n💬 AiBridgeMCP Community — Join our Facebook group to ask questions, share your results, and connect with other users. The developer is also a member. Everyone is welcome.\n👉 https://www.facebook.com/groups/1230935959149731\n\n---\n\n## What is LUNA?\n\nLUNA is a firmware for ESP32 that turns it into an **MCP (Model Context Protocol) server with a built-in Lua scripting engine**.\n\nConnect LUNA to your telescope or observatory equipment, then control everything through Claude AI — in plain language.\n\n```\nYou ──→ Claude AI ──→ LUNA (ESP32) ──→ Telescope / Serial Device\n              \"Go to M42\"    serial command    🔭 slews\n\nYou ──→ Claude AI ──→ LUNA (ESP32) ──→ NINA (PC) ──→ Camera / Focuser / Guider\n         \"Image M42 tonight\"   HTTP API       🌟 full automation\n```\n\nLUNA runs **Lua scripts autonomously** on the ESP32. Claude writes the scripts, deploys them, and monitors results — all through the MCP protocol.\n\n![Hardware_Pinout_RS232C_Wiring_Guide](assets/Hardware_Pinout_RS232C_Wiring_Guide2.png)\n\n![LUNA Observatory System v5.9.6](assets/LUNA%20Observatory%20System%20v5.9.6.png)\n\n---\n\n## ★ New in v5.9.3 — Vixen Mount Support (UDP)\n\nLUNA now supports **Vixen Wireless Unit** mounts (AXD, SXP, SXD2, AP, SX2, AXJ, SXP2) via UDP, and **Vixen STAR BOOK TEN** via HTTP — all through the new `udp.*` Lua module.\n\n| Mount | Protocol | Connection |\n|-------|----------|------------|\n| Vixen Wireless Unit (AXD/SXP/SXD2/AP/SX2/AXJ/SXP2) | UDP | 192.168.6.1 : 60023 |\n| Vixen STAR BOOK TEN | HTTP GET | 169.254.1.1 : 80 |\n\n```lua\n-- Example: slew Vixen Wireless Unit to a target\nudp.begin(50000)\nudp.connect(\"192.168.6.1\", 60023)\nudp.write(\"$MTTGT=1,83.82,−5.39,Orion Nebula\\r\\n\")\nudp.write(\"$MTMV2\\r\\n\")\nlocal resp = udp.read(2000)\nudp.close()\nlog.write(\"GoTo response: \" .. (resp or \"timeout\"))\n```\n\n\u003e Claude knows the full Vixen command set internally via `vixen_guide` — just tell it where to point.\n\n---\n\n## ★ New in v5.9.2 — NINA Astrophotography Integration\n\nLUNA now controls **NINA (Nighttime Imaging 'N' Astronomy)** — the world's most popular free astrophotography software — directly via its HTTP API.\n\n### What this means\n\n| Without LUNA | With LUNA + NINA |\n|-------------|-----------------|\n| Build sequences manually (30–50 settings) | Just tell Claude what you want to image |\n| Start imaging manually | \"Image M42 at 3 min, 20 frames\" — done |\n| Configure each device separately | Claude coordinates telescope, camera, focuser, guider, dome, and weather sensor together |\n| Troubleshoot errors yourself | Claude explains what went wrong and suggests fixes |\n\n### Verified working (2026-03-27)\n\n```\n✅ Camera connection and status\n✅ Capture start / stop\n✅ Autofocus\n✅ Filter wheel control\n✅ Sequence start / stop\n✅ Guider start / stop\n✅ ASCOM / Alpaca device control (switch, weather sensor)\n✅ Stellarium integration\n```\n\n### How it works\n\n```\n\"Image M42 tonight\"\n\n  ① Check weather sensors → safe to observe?     (LUNA + Alpaca)\n  ② Slew telescope to M42                         (Alpaca)\n  ③ Run autofocus                                 (NINA HTTP API)\n  ④ Test exposure → plate solve → correct pointing (NINA HTTP API)\n  ⑤ Start main imaging sequence                   (NINA HTTP API)\n  ⑥ Re-focus periodically as temperature drops    (NINA HTTP API)\n  ⑦ Auto-abort if weather deteriorates            (LUNA monitoring)\n```\n\n\u003e **NINA is the \"hands\", Claude is the \"brain\", LUNA is the \"nervous system.\"**\n\n### Requirements for NINA integration\n\n- NINA v3.x — [nighttime-imaging.eu](https://nighttime-imaging.eu/) (free)\n- NINA Advanced API plugin (free, installed from within NINA)\n- Port: **1888** (default), API Enabled: **ON**\n- LUNA and the NINA PC on the same WiFi network\n\n---\n\n## Key Features\n\n- **MCP Server** — connects directly to Claude via the Model Context Protocol\n- **Lua 5.1 scripting engine** — write, save, and run scripts on the ESP32\n- **Autonomous operation** — scripts run independently; Claude monitors and intervenes as needed\n- **Vixen mount support** — Wireless Unit (UDP) and STAR BOOK TEN (HTTP) via new `udp.*` module (v5.9.3)\n- **NINA integration** — control astrophotography software via HTTP POST (v5.9.2)\n- **http module** — `http.get` / `http.put` / `http.post` for ASCOM/Alpaca, NINA Advanced API, and Vixen STAR BOOK TEN\n- **udp module** — `udp.begin` / `udp.connect` / `udp.write` / `udp.read` / `udp.close` for Vixen Wireless Unit (v5.9.3)\n- **MCP Resources** — Claude reads device state naturally, like reading a gauge\n- **Script-to-script data passing** — `log.save()` / `log.load()` enable stateful workflows without Claude\n- **Serial device control** — full RS-232C control via `serial.query()`, `serial.write()`, `serial.read()`\n- **FreeRTOS dual-core** — MCP server and Lua engine run on separate cores; no blocking\n\n---\n\n## Supported Devices\n\n| Variant | Baud Rate | Target Devices |\n|---------|-----------|----------------|\n| **LUNA Standard** | 9,600 bps | Meade LX200, OnStep, LX200-compatible mounts |\n| **LUNA Temma2** | 19,200 bps | Takahashi Temma2 |\n\n**PC Software Integration (v5.9.2+)**\n\n| Software | Protocol | Port |\n|----------|----------|------|\n| NINA Advanced API | HTTP POST/GET | 1888 |\n| Stellarium Remote Control | HTTP POST/GET | 8090 |\n| ASCOM / Alpaca devices | HTTP GET/PUT | varies |\n\n**Vixen Mount Integration (v5.9.3)**\n\n| Mount | Protocol | Address |\n|-------|----------|---------|\n| Vixen Wireless Unit (AXD/SXP/SXD2/AP/SX2/AXJ/SXP2) | UDP | 192.168.6.1 : 60023 |\n| Vixen STAR BOOK TEN | HTTP GET | 169.254.1.1 : 80 |\n\n\u003e LUNA works with **any RS-232C serial device** and any **ASCOM/Alpaca-compatible device** on your LAN.\n\n---\n\n## Requirements\n\n### Hardware\n- **ESP32 development board** (ESP32-DevKitC or compatible)\n- RS-232C interface circuit (MAX3232 or equivalent)\n- Power: **5V via micro USB** (power bank or USB charger)\n\n\u003e **Ready-to-use LUNA boards** (LUNA OnStepNinja V2 — pre-wired, pre-flashed) are available from the author.\n\n### Software / Service\n- [Claude Desktop](https://claude.ai/download) (free)\n- MCP connector (included in the GitHub Releases download package)\n\n---\n\n## Getting Started\n\n### Step 1 — Flash the Firmware\n\nDownload the firmware binary from [GitHub Releases](https://github.com/OnStepNinja/LUNA/releases):\n\n| File | Target |\n|------|--------|\n| `LUNA_v5.9.3_Standard.bin` | LX200 / OnStep (9600 bps) |\n| `LUNA_v5.9.3_Temma2.bin` | Takahashi Temma2 (19200 bps) |\n\nFlash to your ESP32 using esptool or ESP32 Flash Download Tool.\n\n📄 **See [LUNA_Quick_Setup_Guide.md](docs/LUNA_Quick_Setup_Guide.md) for full instructions.**\n\n### Step 2 — Connect Claude Desktop to LUNA\n\nConfigure Claude Desktop using the MCP connector included in the download package.\n\n📄 **See [LUNA_Quick_Setup_Guide.md](docs/LUNA_Quick_Setup_Guide.md) for the 3-step setup.**\n\n### Step 3 — Start talking to your telescope\n\n```\nYou:    \"Go to M42\"\nClaude: → slews telescope to M42\n\nYou:    \"Image M42 tonight, 3 minutes per frame, 20 frames\"\nClaude: → autofocuses, plate solves, starts NINA sequence\n```\n\n---\n\n## Example: Full Observatory Automation\n\n```lua\n-- LUNA Lua script: check weather, then start NINA sequence\nlocal resp, code = http.get(\n  \"http://192.168.x.x/api/v1/observingconditions/0/humidity\", 2000)\n\nif code == 200 then\n  local humidity = -- parse resp\n  if humidity \u003c 80 then\n    http.post(\"http://192.168.x.x:1888/v2/api/sequence/start\", \"{}\",\n              \"application/json\", 3000)\n    log.write(\"Sequence started. Humidity: \" .. humidity .. \"%\")\n  else\n    notify.set(\"Humidity too high (\" .. humidity .. \"%). Imaging skipped.\")\n  end\nend\n```\n\n---\n\n## MCP Tools Available to Claude\n\n| Tool | Description |\n|------|-------------|\n| `lua_exec` | Execute a Lua script immediately |\n| `lua_save` | Save a script to the ESP32 (SPIFFS) |\n| `lua_run` | Run a saved script asynchronously |\n| `lua_status` | Check execution state and results |\n| `lua_log` | Read the script log buffer |\n| `lua_stop` | Stop a running script |\n| `lua_list` | List saved scripts |\n| `serial_query` | Send a command and read response |\n| `serial_write` | Send a raw serial command |\n| `serial_read` | Read serial data |\n| `fs_read` | Read a file from ESP32 storage |\n| `fs_write` | Write a file to ESP32 storage |\n| `check_notify` | Receive async notifications from Lua scripts |\n\n---\n\n## Lua API (inside scripts)\n\n```lua\n-- Serial control\nserial.write(cmd)\nserial.read(timeout_ms)\nserial.query(cmd, timeout_ms)\n\n-- HTTP (LAN only — ASCOM/Alpaca/NINA/Stellarium/Vixen STAR BOOK TEN)\nhttp.get(url, timeout_ms)\nhttp.put(url, body, content_type, timeout_ms)\nhttp.post(url, body, content_type, timeout_ms)  -- v5.9.2\n\n-- UDP (Vixen Wireless Unit)              -- v5.9.3\nudp.begin(local_port)\nudp.connect(host, port)\nudp.write(data)\nudp.read([timeout_ms])\nudp.close()\n\n-- Logging \u0026 data passing\nlog.write(message)\nlog.read([n])       -- n omitted = latest line\nlog.save()          -- persist to flash\nlog.load()          -- restore from flash\n\n-- Hardware\nhw.delay(ms)\nhw.millis()\nhw.free_heap()\nhw.led(0 or 1)\n\n-- Notify Claude\nnotify.set(\"message\")\n\n-- Script chaining\nluna.run(\"next_script_name\")\n```\n\n---\n\n## Hardware\n\n**LUNA OnStepNinja V2** — pre-built board available from the author:\n\n- Pre-flashed with LUNA v5.9.3\n- RS-232C connector (D-sub 9-pin) included\n- Power: 5V micro USB\n- Compatible with NS-5000, OnStep, and LX200-compatible mounts\n\n\u003e ⚠️ **Cable note:** Use a **straight RS-232C cable** between LUNA and a PC.\n\u003e Use a **cross cable** between LUNA and NS-5000 / OnStep.\n\nContact: [GitHub Issues](https://github.com/OnStepNinja/LUNA/issues)\n\n---\n\n## Documentation\n\n| Document | Description |\n|----------|-------------|\n| [LUNA_Quick_Setup_Guide.md](docs/LUNA_Quick_Setup_Guide.md) | First-time setup (3 steps) |\n| [LUNA_USER_MANUAL.md](docs/LUNA_USER_MANUAL.md) | Full reference manual |\n| [LUNA_Lua_Guide.md](docs/LUNA_Lua_Guide.md) | Lua scripting guide |\n\n📚 **[LUNA Docs on NotebookLM](https://notebooklm.google.com/notebook/f2ce997f-18c2-44c4-8738-973b204c190c)** — Ask questions about LUNA directly.\n\n---\n\n## License\n\nThe LUNA firmware binary is distributed under the [MIT License](LICENSE).\nSource code is proprietary and not published.\n\nCopyright © 2026 Nishioka Sadahiko\n\n---\n\n### Third-Party Licenses\n\nLUNA incorporates **Lua 5.1**, distributed under the MIT License:\n\n\u003e Copyright © 1994–2012 Lua.org, PUC-Rio.\n\u003e Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n\nSee also: https://www.lua.org/license.html\n\n---\n\n## Author\n\n**Nishioka Sadahiko**\nGitHub: [@OnStepNinja](https://github.com/OnStepNinja)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonstepninja%2Fluna","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonstepninja%2Fluna","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonstepninja%2Fluna/lists"}