Latest commit

History

135 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

LUNA

An open Physical AI platform based on ESP32 & Lua that connects LLMs to telescopes, mounts, and legacy instruments for fully autonomous observation.

MCP Server + Lua Scripting Engine on ESP32

Let Claude AI control your telescope, camera, and entire observatory — in plain language.

VersionLicensePlatform


LUNA Docs (NotebookLM)

📚 LUNA Docs — Start here for setup guides, technical references, and FAQ. Ask questions directly inside NotebookLM and get answers from the official documentation. 👉 https://notebooklm.google.com/notebook/f2ce997f-18c2-44c4-8738-973b204c190c

💬 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. 👉 https://www.facebook.com/groups/1230935959149731


🚀 What's New in v8.9.7 2026-06-04

LUNA v8.9.7 is now officially released! This update introduces exciting wireless capabilities and major enhancements:

  • BLE 5.0 Support: Fully integrates Bluetooth Low Energy 5.0 for seamless wireless device connectivity.
  • LUNA Node (Sub Network): Introduces wireless sub-device support with no pairing limits—run autonomous Lua scripts remotely on child nodes!
  • Optimized Stability: Built on FreeRTOS dual-core architecture to ensure stable MCP and Lua execution.

⚠️Important: To ensure all features and APIs work correctly, please run the get_lua_guide tool immediately after connecting Claude to the LUNA MCP server.

For full flash binaries and auto-setup tools, check out the latest GitHub Releases.

What is LUNA?

LUNA is a firmware for ESP32 that turns it into an MCP (Model Context Protocol) server with a built-in Lua scripting engine.

Connect LUNA to your telescope or observatory equipment, then control everything through Claude AI — in plain language.

You ──→ Claude AI ──→ LUNA (ESP32) ──→ Telescope / Serial Device
"Go to M42" serial command 🔭 slews
You ──→ Claude AI ──→ LUNA (ESP32) ──→ NINA (PC) ──→ Camera / Focuser / Guider
"Image M42 tonight" HTTP API 🌟 full automation

LUNA runs Lua scripts autonomously on the ESP32. Claude writes the scripts, deploys them, and monitors results — all through the MCP protocol.

Hardware_Pinout_RS232C_Wiring_Guide

LUNA Observatory System v5.9.6


★ New in v5.9.3 — Vixen Mount Support (UDP)

LUNA 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.

MountProtocolConnection
Vixen Wireless Unit (AXD/SXP/SXD2/AP/SX2/AXJ/SXP2)UDP192.168.6.1 : 60023
Vixen STAR BOOK TENHTTP GET169.254.1.1 : 80
-- Example: slew Vixen Wireless Unit to a targetudp.begin(50000)
udp.connect("192.168.6.1", 60023)
udp.write("$MTTGT=1,83.82,−5.39,Orion Nebula\r\n")
udp.write("$MTMV2\r\n")
localresp=udp.read(2000)
udp.close()
log.write("GoTo response: " .. (respor"timeout"))

Claude knows the full Vixen command set internally via vixen_guide — just tell it where to point.


★ New in v5.9.2 — NINA Astrophotography Integration

LUNA now controls NINA (Nighttime Imaging 'N' Astronomy) — the world's most popular free astrophotography software — directly via its HTTP API.

What this means

Without LUNAWith LUNA + NINA
Build sequences manually (30–50 settings)Just tell Claude what you want to image
Start imaging manually"Image M42 at 3 min, 20 frames" — done
Configure each device separatelyClaude coordinates telescope, camera, focuser, guider, dome, and weather sensor together
Troubleshoot errors yourselfClaude explains what went wrong and suggests fixes

Verified working (2026-03-27)

✅ Camera connection and status
✅ Capture start / stop
✅ Autofocus
✅ Filter wheel control
✅ Sequence start / stop
✅ Guider start / stop
✅ ASCOM / Alpaca device control (switch, weather sensor)
✅ Stellarium integration

How it works

"Image M42 tonight"
① Check weather sensors → safe to observe? (LUNA + Alpaca)
② Slew telescope to M42 (Alpaca)
③ Run autofocus (NINA HTTP API)
④ Test exposure → plate solve → correct pointing (NINA HTTP API)
⑤ Start main imaging sequence (NINA HTTP API)
⑥ Re-focus periodically as temperature drops (NINA HTTP API)
⑦ Auto-abort if weather deteriorates (LUNA monitoring)

NINA is the "hands", Claude is the "brain", LUNA is the "nervous system."

Requirements for NINA integration

  • NINA v3.x — nighttime-imaging.eu (free)
  • NINA Advanced API plugin (free, installed from within NINA)
  • Port: 1888 (default), API Enabled: ON
  • LUNA and the NINA PC on the same WiFi network

Key Features

  • MCP Server — connects directly to Claude via the Model Context Protocol
  • Lua 5.1 scripting engine — write, save, and run scripts on the ESP32
  • Autonomous operation — scripts run independently; Claude monitors and intervenes as needed
  • Vixen mount support — Wireless Unit (UDP) and STAR BOOK TEN (HTTP) via new udp.* module (v5.9.3)
  • NINA integration — control astrophotography software via HTTP POST (v5.9.2)
  • http modulehttp.get / http.put / http.post for ASCOM/Alpaca, NINA Advanced API, and Vixen STAR BOOK TEN
  • udp moduleudp.begin / udp.connect / udp.write / udp.read / udp.close for Vixen Wireless Unit (v5.9.3)
  • MCP Resources — Claude reads device state naturally, like reading a gauge
  • Script-to-script data passinglog.save() / log.load() enable stateful workflows without Claude
  • Serial device control — full RS-232C control via serial.query(), serial.write(), serial.read()
  • FreeRTOS dual-core — MCP server and Lua engine run on separate cores; no blocking

Supported Devices

VariantBaud RateTarget Devices
LUNA Standard9,600 bpsMeade LX200, OnStep, LX200-compatible mounts
LUNA Temma219,200 bpsTakahashi Temma2

PC Software Integration (v5.9.2+)

SoftwareProtocolPort
NINA Advanced APIHTTP POST/GET1888
Stellarium Remote ControlHTTP POST/GET8090
ASCOM / Alpaca devicesHTTP GET/PUTvaries

Vixen Mount Integration (v5.9.3)

MountProtocolAddress
Vixen Wireless Unit (AXD/SXP/SXD2/AP/SX2/AXJ/SXP2)UDP192.168.6.1 : 60023
Vixen STAR BOOK TENHTTP GET169.254.1.1 : 80

LUNA works with any RS-232C serial device and any ASCOM/Alpaca-compatible device on your LAN.


Requirements

Hardware

  • ESP32 development board (ESP32-DevKitC or compatible)
  • RS-232C interface circuit (MAX3232 or equivalent)
  • Power: 5V via micro USB (power bank or USB charger)

Ready-to-use LUNA boards (LUNA OnStepNinja V2 — pre-wired, pre-flashed) are available from the author.

Software / Service

  • Claude Desktop (free)
  • MCP connector (included in the GitHub Releases download package)

Getting Started

Step 1 — Flash the Firmware

Download the firmware binary from GitHub Releases:

FileTarget
LUNA_v5.9.3_Standard.binLX200 / OnStep (9600 bps)
LUNA_v5.9.3_Temma2.binTakahashi Temma2 (19200 bps)

Flash to your ESP32 using esptool or ESP32 Flash Download Tool.

📄 See LUNA_Quick_Setup_Guide.md for full instructions.

Step 2 — Connect Claude Desktop to LUNA

Configure Claude Desktop using the MCP connector included in the download package.

📄 See LUNA_Quick_Setup_Guide.md for the 3-step setup.

Step 3 — Start talking to your telescope

You: "Go to M42"
Claude: → slews telescope to M42
You: "Image M42 tonight, 3 minutes per frame, 20 frames"
Claude: → autofocuses, plate solves, starts NINA sequence

Example: Full Observatory Automation

-- LUNA Lua script: check weather, then start NINA sequencelocalresp, code=http.get(
"http://192.168.x.x/api/v1/observingconditions/0/humidity", 2000)
ifcode==200thenlocalhumidity=-- parse respifhumidity<80thenhttp.post("http://192.168.x.x:1888/v2/api/sequence/start", "{}",
"application/json", 3000)
log.write("Sequence started. Humidity: " ..humidity.."%")
elsenotify.set("Humidity too high (" ..humidity.."%). Imaging skipped.")
endend

MCP Tools Available to Claude

ToolDescription
lua_execExecute a Lua script immediately
lua_saveSave a script to the ESP32 (SPIFFS)
lua_runRun a saved script asynchronously
lua_statusCheck execution state and results
lua_logRead the script log buffer
lua_stopStop a running script
lua_listList saved scripts
serial_querySend a command and read response
serial_writeSend a raw serial command
serial_readRead serial data
fs_readRead a file from ESP32 storage
fs_writeWrite a file to ESP32 storage
check_notifyReceive async notifications from Lua scripts

Lua API (inside scripts)

-- Serial controlserial.write(cmd)
serial.read(timeout_ms)
serial.query(cmd, timeout_ms)
-- HTTP (LAN only — ASCOM/Alpaca/NINA/Stellarium/Vixen STAR BOOK TEN)http.get(url, timeout_ms)
http.put(url, body, content_type, timeout_ms)
http.post(url, body, content_type, timeout_ms) -- v5.9.2-- UDP (Vixen Wireless Unit) -- v5.9.3udp.begin(local_port)
udp.connect(host, port)
udp.write(data)
udp.read([timeout_ms])
udp.close()
-- Logging & data passinglog.write(message)
log.read([n]) -- n omitted = latest linelog.save() -- persist to flashlog.load() -- restore from flash-- Hardwarehw.delay(ms)
hw.millis()
hw.free_heap()
hw.led(0or1)
-- Notify Claudenotify.set("message")
-- Script chainingluna.run("next_script_name")

Hardware

LUNA OnStepNinja V2 — pre-built board available from the author:

  • Pre-flashed with LUNA v5.9.3
  • RS-232C connector (D-sub 9-pin) included
  • Power: 5V micro USB
  • Compatible with NS-5000, OnStep, and LX200-compatible mounts

⚠️Cable note: Use a straight RS-232C cable between LUNA and a PC. Use a cross cable between LUNA and NS-5000 / OnStep.

Contact: GitHub Issues


Documentation

DocumentDescription
LUNA_Quick_Setup_Guide.mdFirst-time setup (3 steps)
LUNA_USER_MANUAL.mdFull reference manual
LUNA_Lua_Guide.mdLua scripting guide

📚 LUNA Docs on NotebookLM — Ask questions about LUNA directly.


License

The LUNA firmware binary is distributed under the MIT License. Source code is proprietary and not published.

Copyright © 2026 Nishioka Sadahiko


Third-Party Licenses

LUNA incorporates Lua 5.1, distributed under the MIT License:

Copyright © 1994–2012 Lua.org, PUC-Rio. 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.

See also: https://www.lua.org/license.html


Author

Nishioka Sadahiko GitHub: @OnStepNinja

About

LUNA — Physical AI Platform for Telescope & Observatory Automation

Topics

Resources

Stars

13 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Latest commit

History

135 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

LUNA

An open Physical AI platform based on ESP32 & Lua that connects LLMs to telescopes, mounts, and legacy instruments for fully autonomous observation.

MCP Server + Lua Scripting Engine on ESP32

Let Claude AI control your telescope, camera, and entire observatory — in plain language.

VersionLicensePlatform


LUNA Docs (NotebookLM)

📚 LUNA Docs — Start here for setup guides, technical references, and FAQ. Ask questions directly inside NotebookLM and get answers from the official documentation. 👉 https://notebooklm.google.com/notebook/f2ce997f-18c2-44c4-8738-973b204c190c

💬 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. 👉 https://www.facebook.com/groups/1230935959149731


🚀 What's New in v8.9.7 2026-06-04

LUNA v8.9.7 is now officially released! This update introduces exciting wireless capabilities and major enhancements:

  • BLE 5.0 Support: Fully integrates Bluetooth Low Energy 5.0 for seamless wireless device connectivity.
  • LUNA Node (Sub Network): Introduces wireless sub-device support with no pairing limits—run autonomous Lua scripts remotely on child nodes!
  • Optimized Stability: Built on FreeRTOS dual-core architecture to ensure stable MCP and Lua execution.

⚠️Important: To ensure all features and APIs work correctly, please run the get_lua_guide tool immediately after connecting Claude to the LUNA MCP server.

For full flash binaries and auto-setup tools, check out the latest GitHub Releases.

What is LUNA?

LUNA is a firmware for ESP32 that turns it into an MCP (Model Context Protocol) server with a built-in Lua scripting engine.

Connect LUNA to your telescope or observatory equipment, then control everything through Claude AI — in plain language.

You ──→ Claude AI ──→ LUNA (ESP32) ──→ Telescope / Serial Device
"Go to M42" serial command 🔭 slews
You ──→ Claude AI ──→ LUNA (ESP32) ──→ NINA (PC) ──→ Camera / Focuser / Guider
"Image M42 tonight" HTTP API 🌟 full automation

LUNA runs Lua scripts autonomously on the ESP32. Claude writes the scripts, deploys them, and monitors results — all through the MCP protocol.

Hardware_Pinout_RS232C_Wiring_Guide

LUNA Observatory System v5.9.6


★ New in v5.9.3 — Vixen Mount Support (UDP)

LUNA 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.

MountProtocolConnection
Vixen Wireless Unit (AXD/SXP/SXD2/AP/SX2/AXJ/SXP2)UDP192.168.6.1 : 60023
Vixen STAR BOOK TENHTTP GET169.254.1.1 : 80
-- Example: slew Vixen Wireless Unit to a targetudp.begin(50000)
udp.connect("192.168.6.1", 60023)
udp.write("$MTTGT=1,83.82,−5.39,Orion Nebula\r\n")
udp.write("$MTMV2\r\n")
localresp=udp.read(2000)
udp.close()
log.write("GoTo response: " .. (respor"timeout"))

Claude knows the full Vixen command set internally via vixen_guide — just tell it where to point.


★ New in v5.9.2 — NINA Astrophotography Integration

LUNA now controls NINA (Nighttime Imaging 'N' Astronomy) — the world's most popular free astrophotography software — directly via its HTTP API.

What this means

Without LUNAWith LUNA + NINA
Build sequences manually (30–50 settings)Just tell Claude what you want to image
Start imaging manually"Image M42 at 3 min, 20 frames" — done
Configure each device separatelyClaude coordinates telescope, camera, focuser, guider, dome, and weather sensor together
Troubleshoot errors yourselfClaude explains what went wrong and suggests fixes

Verified working (2026-03-27)

✅ Camera connection and status
✅ Capture start / stop
✅ Autofocus
✅ Filter wheel control
✅ Sequence start / stop
✅ Guider start / stop
✅ ASCOM / Alpaca device control (switch, weather sensor)
✅ Stellarium integration

How it works

"Image M42 tonight"
① Check weather sensors → safe to observe? (LUNA + Alpaca)
② Slew telescope to M42 (Alpaca)
③ Run autofocus (NINA HTTP API)
④ Test exposure → plate solve → correct pointing (NINA HTTP API)
⑤ Start main imaging sequence (NINA HTTP API)
⑥ Re-focus periodically as temperature drops (NINA HTTP API)
⑦ Auto-abort if weather deteriorates (LUNA monitoring)

NINA is the "hands", Claude is the "brain", LUNA is the "nervous system."

Requirements for NINA integration

  • NINA v3.x — nighttime-imaging.eu (free)
  • NINA Advanced API plugin (free, installed from within NINA)
  • Port: 1888 (default), API Enabled: ON
  • LUNA and the NINA PC on the same WiFi network

Key Features

  • MCP Server — connects directly to Claude via the Model Context Protocol
  • Lua 5.1 scripting engine — write, save, and run scripts on the ESP32
  • Autonomous operation — scripts run independently; Claude monitors and intervenes as needed
  • Vixen mount support — Wireless Unit (UDP) and STAR BOOK TEN (HTTP) via new udp.* module (v5.9.3)
  • NINA integration — control astrophotography software via HTTP POST (v5.9.2)
  • http modulehttp.get / http.put / http.post for ASCOM/Alpaca, NINA Advanced API, and Vixen STAR BOOK TEN
  • udp moduleudp.begin / udp.connect / udp.write / udp.read / udp.close for Vixen Wireless Unit (v5.9.3)
  • MCP Resources — Claude reads device state naturally, like reading a gauge
  • Script-to-script data passinglog.save() / log.load() enable stateful workflows without Claude
  • Serial device control — full RS-232C control via serial.query(), serial.write(), serial.read()
  • FreeRTOS dual-core — MCP server and Lua engine run on separate cores; no blocking

Supported Devices

VariantBaud RateTarget Devices
LUNA Standard9,600 bpsMeade LX200, OnStep, LX200-compatible mounts
LUNA Temma219,200 bpsTakahashi Temma2

PC Software Integration (v5.9.2+)

SoftwareProtocolPort
NINA Advanced APIHTTP POST/GET1888
Stellarium Remote ControlHTTP POST/GET8090
ASCOM / Alpaca devicesHTTP GET/PUTvaries

Vixen Mount Integration (v5.9.3)

MountProtocolAddress
Vixen Wireless Unit (AXD/SXP/SXD2/AP/SX2/AXJ/SXP2)UDP192.168.6.1 : 60023
Vixen STAR BOOK TENHTTP GET169.254.1.1 : 80

LUNA works with any RS-232C serial device and any ASCOM/Alpaca-compatible device on your LAN.


Requirements

Hardware

  • ESP32 development board (ESP32-DevKitC or compatible)
  • RS-232C interface circuit (MAX3232 or equivalent)
  • Power: 5V via micro USB (power bank or USB charger)

Ready-to-use LUNA boards (LUNA OnStepNinja V2 — pre-wired, pre-flashed) are available from the author.

Software / Service

  • Claude Desktop (free)
  • MCP connector (included in the GitHub Releases download package)

Getting Started

Step 1 — Flash the Firmware

Download the firmware binary from GitHub Releases:

FileTarget
LUNA_v5.9.3_Standard.binLX200 / OnStep (9600 bps)
LUNA_v5.9.3_Temma2.binTakahashi Temma2 (19200 bps)

Flash to your ESP32 using esptool or ESP32 Flash Download Tool.

📄 See LUNA_Quick_Setup_Guide.md for full instructions.

Step 2 — Connect Claude Desktop to LUNA

Configure Claude Desktop using the MCP connector included in the download package.

📄 See LUNA_Quick_Setup_Guide.md for the 3-step setup.

Step 3 — Start talking to your telescope

You: "Go to M42"
Claude: → slews telescope to M42
You: "Image M42 tonight, 3 minutes per frame, 20 frames"
Claude: → autofocuses, plate solves, starts NINA sequence

Example: Full Observatory Automation

-- LUNA Lua script: check weather, then start NINA sequencelocalresp, code=http.get(
"http://192.168.x.x/api/v1/observingconditions/0/humidity", 2000)
ifcode==200thenlocalhumidity=-- parse respifhumidity<80thenhttp.post("http://192.168.x.x:1888/v2/api/sequence/start", "{}",
"application/json", 3000)
log.write("Sequence started. Humidity: " ..humidity.."%")
elsenotify.set("Humidity too high (" ..humidity.."%). Imaging skipped.")
endend

MCP Tools Available to Claude

ToolDescription
lua_execExecute a Lua script immediately
lua_saveSave a script to the ESP32 (SPIFFS)
lua_runRun a saved script asynchronously
lua_statusCheck execution state and results
lua_logRead the script log buffer
lua_stopStop a running script
lua_listList saved scripts
serial_querySend a command and read response
serial_writeSend a raw serial command
serial_readRead serial data
fs_readRead a file from ESP32 storage
fs_writeWrite a file to ESP32 storage
check_notifyReceive async notifications from Lua scripts

Lua API (inside scripts)

-- Serial controlserial.write(cmd)
serial.read(timeout_ms)
serial.query(cmd, timeout_ms)
-- HTTP (LAN only — ASCOM/Alpaca/NINA/Stellarium/Vixen STAR BOOK TEN)http.get(url, timeout_ms)
http.put(url, body, content_type, timeout_ms)
http.post(url, body, content_type, timeout_ms) -- v5.9.2-- UDP (Vixen Wireless Unit) -- v5.9.3udp.begin(local_port)
udp.connect(host, port)
udp.write(data)
udp.read([timeout_ms])
udp.close()
-- Logging & data passinglog.write(message)
log.read([n]) -- n omitted = latest linelog.save() -- persist to flashlog.load() -- restore from flash-- Hardwarehw.delay(ms)
hw.millis()
hw.free_heap()
hw.led(0or1)
-- Notify Claudenotify.set("message")
-- Script chainingluna.run("next_script_name")

Hardware

LUNA OnStepNinja V2 — pre-built board available from the author:

  • Pre-flashed with LUNA v5.9.3
  • RS-232C connector (D-sub 9-pin) included
  • Power: 5V micro USB
  • Compatible with NS-5000, OnStep, and LX200-compatible mounts

⚠️Cable note: Use a straight RS-232C cable between LUNA and a PC. Use a cross cable between LUNA and NS-5000 / OnStep.

Contact: GitHub Issues


Documentation

DocumentDescription
LUNA_Quick_Setup_Guide.mdFirst-time setup (3 steps)
LUNA_USER_MANUAL.mdFull reference manual
LUNA_Lua_Guide.mdLua scripting guide

📚 LUNA Docs on NotebookLM — Ask questions about LUNA directly.


License

The LUNA firmware binary is distributed under the MIT License. Source code is proprietary and not published.

Copyright © 2026 Nishioka Sadahiko


Third-Party Licenses

LUNA incorporates Lua 5.1, distributed under the MIT License:

Copyright © 1994–2012 Lua.org, PUC-Rio. 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.

See also: https://www.lua.org/license.html


Author

Nishioka Sadahiko GitHub: @OnStepNinja

About

LUNA — Physical AI Platform for Telescope & Observatory Automation

Topics

Resources

Stars

13 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

135 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

LUNA

An open Physical AI platform based on ESP32 & Lua that connects LLMs to telescopes, mounts, and legacy instruments for fully autonomous observation.

MCP Server + Lua Scripting Engine on ESP32

Let Claude AI control your telescope, camera, and entire observatory — in plain language.

VersionLicensePlatform


LUNA Docs (NotebookLM)

📚 LUNA Docs — Start here for setup guides, technical references, and FAQ. Ask questions directly inside NotebookLM and get answers from the official documentation. 👉 https://notebooklm.google.com/notebook/f2ce997f-18c2-44c4-8738-973b204c190c

💬 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. 👉 https://www.facebook.com/groups/1230935959149731


🚀 What's New in v8.9.7 2026-06-04

LUNA v8.9.7 is now officially released! This update introduces exciting wireless capabilities and major enhancements:

  • BLE 5.0 Support: Fully integrates Bluetooth Low Energy 5.0 for seamless wireless device connectivity.
  • LUNA Node (Sub Network): Introduces wireless sub-device support with no pairing limits—run autonomous Lua scripts remotely on child nodes!
  • Optimized Stability: Built on FreeRTOS dual-core architecture to ensure stable MCP and Lua execution.

⚠️Important: To ensure all features and APIs work correctly, please run the get_lua_guide tool immediately after connecting Claude to the LUNA MCP server.

For full flash binaries and auto-setup tools, check out the latest GitHub Releases.

What is LUNA?

LUNA is a firmware for ESP32 that turns it into an MCP (Model Context Protocol) server with a built-in Lua scripting engine.

Connect LUNA to your telescope or observatory equipment, then control everything through Claude AI — in plain language.

You ──→ Claude AI ──→ LUNA (ESP32) ──→ Telescope / Serial Device
"Go to M42" serial command 🔭 slews
You ──→ Claude AI ──→ LUNA (ESP32) ──→ NINA (PC) ──→ Camera / Focuser / Guider
"Image M42 tonight" HTTP API 🌟 full automation

LUNA runs Lua scripts autonomously on the ESP32. Claude writes the scripts, deploys them, and monitors results — all through the MCP protocol.

Hardware_Pinout_RS232C_Wiring_Guide

LUNA Observatory System v5.9.6


★ New in v5.9.3 — Vixen Mount Support (UDP)

LUNA 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.

MountProtocolConnection
Vixen Wireless Unit (AXD/SXP/SXD2/AP/SX2/AXJ/SXP2)UDP192.168.6.1 : 60023
Vixen STAR BOOK TENHTTP GET169.254.1.1 : 80
-- Example: slew Vixen Wireless Unit to a targetudp.begin(50000)
udp.connect("192.168.6.1", 60023)
udp.write("$MTTGT=1,83.82,−5.39,Orion Nebula\r\n")
udp.write("$MTMV2\r\n")
localresp=udp.read(2000)
udp.close()
log.write("GoTo response: " .. (respor"timeout"))

Claude knows the full Vixen command set internally via vixen_guide — just tell it where to point.


★ New in v5.9.2 — NINA Astrophotography Integration

LUNA now controls NINA (Nighttime Imaging 'N' Astronomy) — the world's most popular free astrophotography software — directly via its HTTP API.

What this means

Without LUNAWith LUNA + NINA
Build sequences manually (30–50 settings)Just tell Claude what you want to image
Start imaging manually"Image M42 at 3 min, 20 frames" — done
Configure each device separatelyClaude coordinates telescope, camera, focuser, guider, dome, and weather sensor together
Troubleshoot errors yourselfClaude explains what went wrong and suggests fixes

Verified working (2026-03-27)

✅ Camera connection and status
✅ Capture start / stop
✅ Autofocus
✅ Filter wheel control
✅ Sequence start / stop
✅ Guider start / stop
✅ ASCOM / Alpaca device control (switch, weather sensor)
✅ Stellarium integration

How it works

"Image M42 tonight"
① Check weather sensors → safe to observe? (LUNA + Alpaca)
② Slew telescope to M42 (Alpaca)
③ Run autofocus (NINA HTTP API)
④ Test exposure → plate solve → correct pointing (NINA HTTP API)
⑤ Start main imaging sequence (NINA HTTP API)
⑥ Re-focus periodically as temperature drops (NINA HTTP API)
⑦ Auto-abort if weather deteriorates (LUNA monitoring)

NINA is the "hands", Claude is the "brain", LUNA is the "nervous system."

Requirements for NINA integration

  • NINA v3.x — nighttime-imaging.eu (free)
  • NINA Advanced API plugin (free, installed from within NINA)
  • Port: 1888 (default), API Enabled: ON
  • LUNA and the NINA PC on the same WiFi network

Key Features

  • MCP Server — connects directly to Claude via the Model Context Protocol
  • Lua 5.1 scripting engine — write, save, and run scripts on the ESP32
  • Autonomous operation — scripts run independently; Claude monitors and intervenes as needed
  • Vixen mount support — Wireless Unit (UDP) and STAR BOOK TEN (HTTP) via new udp.* module (v5.9.3)
  • NINA integration — control astrophotography software via HTTP POST (v5.9.2)
  • http modulehttp.get / http.put / http.post for ASCOM/Alpaca, NINA Advanced API, and Vixen STAR BOOK TEN
  • udp moduleudp.begin / udp.connect / udp.write / udp.read / udp.close for Vixen Wireless Unit (v5.9.3)
  • MCP Resources — Claude reads device state naturally, like reading a gauge
  • Script-to-script data passinglog.save() / log.load() enable stateful workflows without Claude
  • Serial device control — full RS-232C control via serial.query(), serial.write(), serial.read()
  • FreeRTOS dual-core — MCP server and Lua engine run on separate cores; no blocking

Supported Devices

VariantBaud RateTarget Devices
LUNA Standard9,600 bpsMeade LX200, OnStep, LX200-compatible mounts
LUNA Temma219,200 bpsTakahashi Temma2

PC Software Integration (v5.9.2+)

SoftwareProtocolPort
NINA Advanced APIHTTP POST/GET1888
Stellarium Remote ControlHTTP POST/GET8090
ASCOM / Alpaca devicesHTTP GET/PUTvaries

Vixen Mount Integration (v5.9.3)

MountProtocolAddress
Vixen Wireless Unit (AXD/SXP/SXD2/AP/SX2/AXJ/SXP2)UDP192.168.6.1 : 60023
Vixen STAR BOOK TENHTTP GET169.254.1.1 : 80

LUNA works with any RS-232C serial device and any ASCOM/Alpaca-compatible device on your LAN.


Requirements

Hardware

  • ESP32 development board (ESP32-DevKitC or compatible)
  • RS-232C interface circuit (MAX3232 or equivalent)
  • Power: 5V via micro USB (power bank or USB charger)

Ready-to-use LUNA boards (LUNA OnStepNinja V2 — pre-wired, pre-flashed) are available from the author.

Software / Service

  • Claude Desktop (free)
  • MCP connector (included in the GitHub Releases download package)

Getting Started

Step 1 — Flash the Firmware

Download the firmware binary from GitHub Releases:

FileTarget
LUNA_v5.9.3_Standard.binLX200 / OnStep (9600 bps)
LUNA_v5.9.3_Temma2.binTakahashi Temma2 (19200 bps)

Flash to your ESP32 using esptool or ESP32 Flash Download Tool.

📄 See LUNA_Quick_Setup_Guide.md for full instructions.

Step 2 — Connect Claude Desktop to LUNA

Configure Claude Desktop using the MCP connector included in the download package.

📄 See LUNA_Quick_Setup_Guide.md for the 3-step setup.

Step 3 — Start talking to your telescope

You: "Go to M42"
Claude: → slews telescope to M42
You: "Image M42 tonight, 3 minutes per frame, 20 frames"
Claude: → autofocuses, plate solves, starts NINA sequence

Example: Full Observatory Automation

-- LUNA Lua script: check weather, then start NINA sequencelocalresp, code=http.get(
"http://192.168.x.x/api/v1/observingconditions/0/humidity", 2000)
ifcode==200thenlocalhumidity=-- parse respifhumidity<80thenhttp.post("http://192.168.x.x:1888/v2/api/sequence/start", "{}",
"application/json", 3000)
log.write("Sequence started. Humidity: " ..humidity.."%")
elsenotify.set("Humidity too high (" ..humidity.."%). Imaging skipped.")
endend

MCP Tools Available to Claude

ToolDescription
lua_execExecute a Lua script immediately
lua_saveSave a script to the ESP32 (SPIFFS)
lua_runRun a saved script asynchronously
lua_statusCheck execution state and results
lua_logRead the script log buffer
lua_stopStop a running script
lua_listList saved scripts
serial_querySend a command and read response
serial_writeSend a raw serial command
serial_readRead serial data
fs_readRead a file from ESP32 storage
fs_writeWrite a file to ESP32 storage
check_notifyReceive async notifications from Lua scripts

Lua API (inside scripts)

-- Serial controlserial.write(cmd)
serial.read(timeout_ms)
serial.query(cmd, timeout_ms)
-- HTTP (LAN only — ASCOM/Alpaca/NINA/Stellarium/Vixen STAR BOOK TEN)http.get(url, timeout_ms)
http.put(url, body, content_type, timeout_ms)
http.post(url, body, content_type, timeout_ms) -- v5.9.2-- UDP (Vixen Wireless Unit) -- v5.9.3udp.begin(local_port)
udp.connect(host, port)
udp.write(data)
udp.read([timeout_ms])
udp.close()
-- Logging & data passinglog.write(message)
log.read([n]) -- n omitted = latest linelog.save() -- persist to flashlog.load() -- restore from flash-- Hardwarehw.delay(ms)
hw.millis()
hw.free_heap()
hw.led(0or1)
-- Notify Claudenotify.set("message")
-- Script chainingluna.run("next_script_name")

Hardware

LUNA OnStepNinja V2 — pre-built board available from the author:

  • Pre-flashed with LUNA v5.9.3
  • RS-232C connector (D-sub 9-pin) included
  • Power: 5V micro USB
  • Compatible with NS-5000, OnStep, and LX200-compatible mounts

⚠️Cable note: Use a straight RS-232C cable between LUNA and a PC. Use a cross cable between LUNA and NS-5000 / OnStep.

Contact: GitHub Issues


Documentation

DocumentDescription
LUNA_Quick_Setup_Guide.mdFirst-time setup (3 steps)
LUNA_USER_MANUAL.mdFull reference manual
LUNA_Lua_Guide.mdLua scripting guide

📚 LUNA Docs on NotebookLM — Ask questions about LUNA directly.


License

The LUNA firmware binary is distributed under the MIT License. Source code is proprietary and not published.

Copyright © 2026 Nishioka Sadahiko


Third-Party Licenses

LUNA incorporates Lua 5.1, distributed under the MIT License:

Copyright © 1994–2012 Lua.org, PUC-Rio. 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.

See also: https://www.lua.org/license.html


Author

Nishioka Sadahiko GitHub: @OnStepNinja

About

LUNA — Physical AI Platform for Telescope & Observatory Automation

Topics

Resources

Stars

13 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

135 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

LUNA

An open Physical AI platform based on ESP32 & Lua that connects LLMs to telescopes, mounts, and legacy instruments for fully autonomous observation.

MCP Server + Lua Scripting Engine on ESP32

Let Claude AI control your telescope, camera, and entire observatory — in plain language.

VersionLicensePlatform


LUNA Docs (NotebookLM)

📚 LUNA Docs — Start here for setup guides, technical references, and FAQ. Ask questions directly inside NotebookLM and get answers from the official documentation. 👉 https://notebooklm.google.com/notebook/f2ce997f-18c2-44c4-8738-973b204c190c

💬 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. 👉 https://www.facebook.com/groups/1230935959149731


🚀 What's New in v8.9.7 2026-06-04

LUNA v8.9.7 is now officially released! This update introduces exciting wireless capabilities and major enhancements:

  • BLE 5.0 Support: Fully integrates Bluetooth Low Energy 5.0 for seamless wireless device connectivity.
  • LUNA Node (Sub Network): Introduces wireless sub-device support with no pairing limits—run autonomous Lua scripts remotely on child nodes!
  • Optimized Stability: Built on FreeRTOS dual-core architecture to ensure stable MCP and Lua execution.

⚠️Important: To ensure all features and APIs work correctly, please run the get_lua_guide tool immediately after connecting Claude to the LUNA MCP server.

For full flash binaries and auto-setup tools, check out the latest GitHub Releases.

What is LUNA?

LUNA is a firmware for ESP32 that turns it into an MCP (Model Context Protocol) server with a built-in Lua scripting engine.

Connect LUNA to your telescope or observatory equipment, then control everything through Claude AI — in plain language.

You ──→ Claude AI ──→ LUNA (ESP32) ──→ Telescope / Serial Device
"Go to M42" serial command 🔭 slews
You ──→ Claude AI ──→ LUNA (ESP32) ──→ NINA (PC) ──→ Camera / Focuser / Guider
"Image M42 tonight" HTTP API 🌟 full automation

LUNA runs Lua scripts autonomously on the ESP32. Claude writes the scripts, deploys them, and monitors results — all through the MCP protocol.

Hardware_Pinout_RS232C_Wiring_Guide

LUNA Observatory System v5.9.6


★ New in v5.9.3 — Vixen Mount Support (UDP)

LUNA 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.

MountProtocolConnection
Vixen Wireless Unit (AXD/SXP/SXD2/AP/SX2/AXJ/SXP2)UDP192.168.6.1 : 60023
Vixen STAR BOOK TENHTTP GET169.254.1.1 : 80
-- Example: slew Vixen Wireless Unit to a targetudp.begin(50000)
udp.connect("192.168.6.1", 60023)
udp.write("$MTTGT=1,83.82,−5.39,Orion Nebula\r\n")
udp.write("$MTMV2\r\n")
localresp=udp.read(2000)
udp.close()
log.write("GoTo response: " .. (respor"timeout"))

Claude knows the full Vixen command set internally via vixen_guide — just tell it where to point.


★ New in v5.9.2 — NINA Astrophotography Integration

LUNA now controls NINA (Nighttime Imaging 'N' Astronomy) — the world's most popular free astrophotography software — directly via its HTTP API.

What this means

Without LUNAWith LUNA + NINA
Build sequences manually (30–50 settings)Just tell Claude what you want to image
Start imaging manually"Image M42 at 3 min, 20 frames" — done
Configure each device separatelyClaude coordinates telescope, camera, focuser, guider, dome, and weather sensor together
Troubleshoot errors yourselfClaude explains what went wrong and suggests fixes

Verified working (2026-03-27)

✅ Camera connection and status
✅ Capture start / stop
✅ Autofocus
✅ Filter wheel control
✅ Sequence start / stop
✅ Guider start / stop
✅ ASCOM / Alpaca device control (switch, weather sensor)
✅ Stellarium integration

How it works

"Image M42 tonight"
① Check weather sensors → safe to observe? (LUNA + Alpaca)
② Slew telescope to M42 (Alpaca)
③ Run autofocus (NINA HTTP API)
④ Test exposure → plate solve → correct pointing (NINA HTTP API)
⑤ Start main imaging sequence (NINA HTTP API)
⑥ Re-focus periodically as temperature drops (NINA HTTP API)
⑦ Auto-abort if weather deteriorates (LUNA monitoring)

NINA is the "hands", Claude is the "brain", LUNA is the "nervous system."

Requirements for NINA integration

  • NINA v3.x — nighttime-imaging.eu (free)
  • NINA Advanced API plugin (free, installed from within NINA)
  • Port: 1888 (default), API Enabled: ON
  • LUNA and the NINA PC on the same WiFi network

Key Features

  • MCP Server — connects directly to Claude via the Model Context Protocol
  • Lua 5.1 scripting engine — write, save, and run scripts on the ESP32
  • Autonomous operation — scripts run independently; Claude monitors and intervenes as needed
  • Vixen mount support — Wireless Unit (UDP) and STAR BOOK TEN (HTTP) via new udp.* module (v5.9.3)
  • NINA integration — control astrophotography software via HTTP POST (v5.9.2)
  • http modulehttp.get / http.put / http.post for ASCOM/Alpaca, NINA Advanced API, and Vixen STAR BOOK TEN
  • udp moduleudp.begin / udp.connect / udp.write / udp.read / udp.close for Vixen Wireless Unit (v5.9.3)
  • MCP Resources — Claude reads device state naturally, like reading a gauge
  • Script-to-script data passinglog.save() / log.load() enable stateful workflows without Claude
  • Serial device control — full RS-232C control via serial.query(), serial.write(), serial.read()
  • FreeRTOS dual-core — MCP server and Lua engine run on separate cores; no blocking

Supported Devices

VariantBaud RateTarget Devices
LUNA Standard9,600 bpsMeade LX200, OnStep, LX200-compatible mounts
LUNA Temma219,200 bpsTakahashi Temma2

PC Software Integration (v5.9.2+)

SoftwareProtocolPort
NINA Advanced APIHTTP POST/GET1888
Stellarium Remote ControlHTTP POST/GET8090
ASCOM / Alpaca devicesHTTP GET/PUTvaries

Vixen Mount Integration (v5.9.3)

MountProtocolAddress
Vixen Wireless Unit (AXD/SXP/SXD2/AP/SX2/AXJ/SXP2)UDP192.168.6.1 : 60023
Vixen STAR BOOK TENHTTP GET169.254.1.1 : 80

LUNA works with any RS-232C serial device and any ASCOM/Alpaca-compatible device on your LAN.


Requirements

Hardware

  • ESP32 development board (ESP32-DevKitC or compatible)
  • RS-232C interface circuit (MAX3232 or equivalent)
  • Power: 5V via micro USB (power bank or USB charger)

Ready-to-use LUNA boards (LUNA OnStepNinja V2 — pre-wired, pre-flashed) are available from the author.

Software / Service

  • Claude Desktop (free)
  • MCP connector (included in the GitHub Releases download package)

Getting Started

Step 1 — Flash the Firmware

Download the firmware binary from GitHub Releases:

FileTarget
LUNA_v5.9.3_Standard.binLX200 / OnStep (9600 bps)
LUNA_v5.9.3_Temma2.binTakahashi Temma2 (19200 bps)

Flash to your ESP32 using esptool or ESP32 Flash Download Tool.

📄 See LUNA_Quick_Setup_Guide.md for full instructions.

Step 2 — Connect Claude Desktop to LUNA

Configure Claude Desktop using the MCP connector included in the download package.

📄 See LUNA_Quick_Setup_Guide.md for the 3-step setup.

Step 3 — Start talking to your telescope

You: "Go to M42"
Claude: → slews telescope to M42
You: "Image M42 tonight, 3 minutes per frame, 20 frames"
Claude: → autofocuses, plate solves, starts NINA sequence

Example: Full Observatory Automation

-- LUNA Lua script: check weather, then start NINA sequencelocalresp, code=http.get(
"http://192.168.x.x/api/v1/observingconditions/0/humidity", 2000)
ifcode==200thenlocalhumidity=-- parse respifhumidity<80thenhttp.post("http://192.168.x.x:1888/v2/api/sequence/start", "{}",
"application/json", 3000)
log.write("Sequence started. Humidity: " ..humidity.."%")
elsenotify.set("Humidity too high (" ..humidity.."%). Imaging skipped.")
endend

MCP Tools Available to Claude

ToolDescription
lua_execExecute a Lua script immediately
lua_saveSave a script to the ESP32 (SPIFFS)
lua_runRun a saved script asynchronously
lua_statusCheck execution state and results
lua_logRead the script log buffer
lua_stopStop a running script
lua_listList saved scripts
serial_querySend a command and read response
serial_writeSend a raw serial command
serial_readRead serial data
fs_readRead a file from ESP32 storage
fs_writeWrite a file to ESP32 storage
check_notifyReceive async notifications from Lua scripts

Lua API (inside scripts)

-- Serial controlserial.write(cmd)
serial.read(timeout_ms)
serial.query(cmd, timeout_ms)
-- HTTP (LAN only — ASCOM/Alpaca/NINA/Stellarium/Vixen STAR BOOK TEN)http.get(url, timeout_ms)
http.put(url, body, content_type, timeout_ms)
http.post(url, body, content_type, timeout_ms) -- v5.9.2-- UDP (Vixen Wireless Unit) -- v5.9.3udp.begin(local_port)
udp.connect(host, port)
udp.write(data)
udp.read([timeout_ms])
udp.close()
-- Logging & data passinglog.write(message)
log.read([n]) -- n omitted = latest linelog.save() -- persist to flashlog.load() -- restore from flash-- Hardwarehw.delay(ms)
hw.millis()
hw.free_heap()
hw.led(0or1)
-- Notify Claudenotify.set("message")
-- Script chainingluna.run("next_script_name")

Hardware

LUNA OnStepNinja V2 — pre-built board available from the author:

  • Pre-flashed with LUNA v5.9.3
  • RS-232C connector (D-sub 9-pin) included
  • Power: 5V micro USB
  • Compatible with NS-5000, OnStep, and LX200-compatible mounts

⚠️Cable note: Use a straight RS-232C cable between LUNA and a PC. Use a cross cable between LUNA and NS-5000 / OnStep.

Contact: GitHub Issues


Documentation

DocumentDescription
LUNA_Quick_Setup_Guide.mdFirst-time setup (3 steps)
LUNA_USER_MANUAL.mdFull reference manual
LUNA_Lua_Guide.mdLua scripting guide

📚 LUNA Docs on NotebookLM — Ask questions about LUNA directly.


License

The LUNA firmware binary is distributed under the MIT License. Source code is proprietary and not published.

Copyright © 2026 Nishioka Sadahiko


Third-Party Licenses

LUNA incorporates Lua 5.1, distributed under the MIT License:

Copyright © 1994–2012 Lua.org, PUC-Rio. 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.

See also: https://www.lua.org/license.html


Author

Nishioka Sadahiko GitHub: @OnStepNinja

About

LUNA — Physical AI Platform for Telescope & Observatory Automation

Topics

Resources

Stars

13 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Latest commit

History

135 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

LUNA

An open Physical AI platform based on ESP32 & Lua that connects LLMs to telescopes, mounts, and legacy instruments for fully autonomous observation.

MCP Server + Lua Scripting Engine on ESP32

Let Claude AI control your telescope, camera, and entire observatory — in plain language.

VersionLicensePlatform


LUNA Docs (NotebookLM)

📚 LUNA Docs — Start here for setup guides, technical references, and FAQ. Ask questions directly inside NotebookLM and get answers from the official documentation. 👉 https://notebooklm.google.com/notebook/f2ce997f-18c2-44c4-8738-973b204c190c

💬 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. 👉 https://www.facebook.com/groups/1230935959149731


🚀 What's New in v8.9.7 2026-06-04

LUNA v8.9.7 is now officially released! This update introduces exciting wireless capabilities and major enhancements:

  • BLE 5.0 Support: Fully integrates Bluetooth Low Energy 5.0 for seamless wireless device connectivity.
  • LUNA Node (Sub Network): Introduces wireless sub-device support with no pairing limits—run autonomous Lua scripts remotely on child nodes!
  • Optimized Stability: Built on FreeRTOS dual-core architecture to ensure stable MCP and Lua execution.

⚠️Important: To ensure all features and APIs work correctly, please run the get_lua_guide tool immediately after connecting Claude to the LUNA MCP server.

For full flash binaries and auto-setup tools, check out the latest GitHub Releases.

What is LUNA?

LUNA is a firmware for ESP32 that turns it into an MCP (Model Context Protocol) server with a built-in Lua scripting engine.

Connect LUNA to your telescope or observatory equipment, then control everything through Claude AI — in plain language.

You ──→ Claude AI ──→ LUNA (ESP32) ──→ Telescope / Serial Device
"Go to M42" serial command 🔭 slews
You ──→ Claude AI ──→ LUNA (ESP32) ──→ NINA (PC) ──→ Camera / Focuser / Guider
"Image M42 tonight" HTTP API 🌟 full automation

LUNA runs Lua scripts autonomously on the ESP32. Claude writes the scripts, deploys them, and monitors results — all through the MCP protocol.

Hardware_Pinout_RS232C_Wiring_Guide

LUNA Observatory System v5.9.6


★ New in v5.9.3 — Vixen Mount Support (UDP)

LUNA 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.

MountProtocolConnection
Vixen Wireless Unit (AXD/SXP/SXD2/AP/SX2/AXJ/SXP2)UDP192.168.6.1 : 60023
Vixen STAR BOOK TENHTTP GET169.254.1.1 : 80
-- Example: slew Vixen Wireless Unit to a targetudp.begin(50000)
udp.connect("192.168.6.1", 60023)
udp.write("$MTTGT=1,83.82,−5.39,Orion Nebula\r\n")
udp.write("$MTMV2\r\n")
localresp=udp.read(2000)
udp.close()
log.write("GoTo response: " .. (respor"timeout"))

Claude knows the full Vixen command set internally via vixen_guide — just tell it where to point.


★ New in v5.9.2 — NINA Astrophotography Integration

LUNA now controls NINA (Nighttime Imaging 'N' Astronomy) — the world's most popular free astrophotography software — directly via its HTTP API.

What this means

Without LUNAWith LUNA + NINA
Build sequences manually (30–50 settings)Just tell Claude what you want to image
Start imaging manually"Image M42 at 3 min, 20 frames" — done
Configure each device separatelyClaude coordinates telescope, camera, focuser, guider, dome, and weather sensor together
Troubleshoot errors yourselfClaude explains what went wrong and suggests fixes

Verified working (2026-03-27)

✅ Camera connection and status
✅ Capture start / stop
✅ Autofocus
✅ Filter wheel control
✅ Sequence start / stop
✅ Guider start / stop
✅ ASCOM / Alpaca device control (switch, weather sensor)
✅ Stellarium integration

How it works

"Image M42 tonight"
① Check weather sensors → safe to observe? (LUNA + Alpaca)
② Slew telescope to M42 (Alpaca)
③ Run autofocus (NINA HTTP API)
④ Test exposure → plate solve → correct pointing (NINA HTTP API)
⑤ Start main imaging sequence (NINA HTTP API)
⑥ Re-focus periodically as temperature drops (NINA HTTP API)
⑦ Auto-abort if weather deteriorates (LUNA monitoring)

NINA is the "hands", Claude is the "brain", LUNA is the "nervous system."

Requirements for NINA integration

  • NINA v3.x — nighttime-imaging.eu (free)
  • NINA Advanced API plugin (free, installed from within NINA)
  • Port: 1888 (default), API Enabled: ON
  • LUNA and the NINA PC on the same WiFi network

Key Features

  • MCP Server — connects directly to Claude via the Model Context Protocol
  • Lua 5.1 scripting engine — write, save, and run scripts on the ESP32
  • Autonomous operation — scripts run independently; Claude monitors and intervenes as needed
  • Vixen mount support — Wireless Unit (UDP) and STAR BOOK TEN (HTTP) via new udp.* module (v5.9.3)
  • NINA integration — control astrophotography software via HTTP POST (v5.9.2)
  • http modulehttp.get / http.put / http.post for ASCOM/Alpaca, NINA Advanced API, and Vixen STAR BOOK TEN
  • udp moduleudp.begin / udp.connect / udp.write / udp.read / udp.close for Vixen Wireless Unit (v5.9.3)
  • MCP Resources — Claude reads device state naturally, like reading a gauge
  • Script-to-script data passinglog.save() / log.load() enable stateful workflows without Claude
  • Serial device control — full RS-232C control via serial.query(), serial.write(), serial.read()
  • FreeRTOS dual-core — MCP server and Lua engine run on separate cores; no blocking

Supported Devices

VariantBaud RateTarget Devices
LUNA Standard9,600 bpsMeade LX200, OnStep, LX200-compatible mounts
LUNA Temma219,200 bpsTakahashi Temma2

PC Software Integration (v5.9.2+)

SoftwareProtocolPort
NINA Advanced APIHTTP POST/GET1888
Stellarium Remote ControlHTTP POST/GET8090
ASCOM / Alpaca devicesHTTP GET/PUTvaries

Vixen Mount Integration (v5.9.3)

MountProtocolAddress
Vixen Wireless Unit (AXD/SXP/SXD2/AP/SX2/AXJ/SXP2)UDP192.168.6.1 : 60023
Vixen STAR BOOK TENHTTP GET169.254.1.1 : 80

LUNA works with any RS-232C serial device and any ASCOM/Alpaca-compatible device on your LAN.


Requirements

Hardware

  • ESP32 development board (ESP32-DevKitC or compatible)
  • RS-232C interface circuit (MAX3232 or equivalent)
  • Power: 5V via micro USB (power bank or USB charger)

Ready-to-use LUNA boards (LUNA OnStepNinja V2 — pre-wired, pre-flashed) are available from the author.

Software / Service

  • Claude Desktop (free)
  • MCP connector (included in the GitHub Releases download package)

Getting Started

Step 1 — Flash the Firmware

Download the firmware binary from GitHub Releases:

FileTarget
LUNA_v5.9.3_Standard.binLX200 / OnStep (9600 bps)
LUNA_v5.9.3_Temma2.binTakahashi Temma2 (19200 bps)

Flash to your ESP32 using esptool or ESP32 Flash Download Tool.

📄 See LUNA_Quick_Setup_Guide.md for full instructions.

Step 2 — Connect Claude Desktop to LUNA

Configure Claude Desktop using the MCP connector included in the download package.

📄 See LUNA_Quick_Setup_Guide.md for the 3-step setup.

Step 3 — Start talking to your telescope

You: "Go to M42"
Claude: → slews telescope to M42
You: "Image M42 tonight, 3 minutes per frame, 20 frames"
Claude: → autofocuses, plate solves, starts NINA sequence

Example: Full Observatory Automation

-- LUNA Lua script: check weather, then start NINA sequencelocalresp, code=http.get(
"http://192.168.x.x/api/v1/observingconditions/0/humidity", 2000)
ifcode==200thenlocalhumidity=-- parse respifhumidity<80thenhttp.post("http://192.168.x.x:1888/v2/api/sequence/start", "{}",
"application/json", 3000)
log.write("Sequence started. Humidity: " ..humidity.."%")
elsenotify.set("Humidity too high (" ..humidity.."%). Imaging skipped.")
endend

MCP Tools Available to Claude

ToolDescription
lua_execExecute a Lua script immediately
lua_saveSave a script to the ESP32 (SPIFFS)
lua_runRun a saved script asynchronously
lua_statusCheck execution state and results
lua_logRead the script log buffer
lua_stopStop a running script
lua_listList saved scripts
serial_querySend a command and read response
serial_writeSend a raw serial command
serial_readRead serial data
fs_readRead a file from ESP32 storage
fs_writeWrite a file to ESP32 storage
check_notifyReceive async notifications from Lua scripts

Lua API (inside scripts)

-- Serial controlserial.write(cmd)
serial.read(timeout_ms)
serial.query(cmd, timeout_ms)
-- HTTP (LAN only — ASCOM/Alpaca/NINA/Stellarium/Vixen STAR BOOK TEN)http.get(url, timeout_ms)
http.put(url, body, content_type, timeout_ms)
http.post(url, body, content_type, timeout_ms) -- v5.9.2-- UDP (Vixen Wireless Unit) -- v5.9.3udp.begin(local_port)
udp.connect(host, port)
udp.write(data)
udp.read([timeout_ms])
udp.close()
-- Logging & data passinglog.write(message)
log.read([n]) -- n omitted = latest linelog.save() -- persist to flashlog.load() -- restore from flash-- Hardwarehw.delay(ms)
hw.millis()
hw.free_heap()
hw.led(0or1)
-- Notify Claudenotify.set("message")
-- Script chainingluna.run("next_script_name")

Hardware

LUNA OnStepNinja V2 — pre-built board available from the author:

  • Pre-flashed with LUNA v5.9.3
  • RS-232C connector (D-sub 9-pin) included
  • Power: 5V micro USB
  • Compatible with NS-5000, OnStep, and LX200-compatible mounts

⚠️Cable note: Use a straight RS-232C cable between LUNA and a PC. Use a cross cable between LUNA and NS-5000 / OnStep.

Contact: GitHub Issues


Documentation

DocumentDescription
LUNA_Quick_Setup_Guide.mdFirst-time setup (3 steps)
LUNA_USER_MANUAL.mdFull reference manual
LUNA_Lua_Guide.mdLua scripting guide

📚 LUNA Docs on NotebookLM — Ask questions about LUNA directly.


License

The LUNA firmware binary is distributed under the MIT License. Source code is proprietary and not published.

Copyright © 2026 Nishioka Sadahiko


Third-Party Licenses

LUNA incorporates Lua 5.1, distributed under the MIT License:

Copyright © 1994–2012 Lua.org, PUC-Rio. 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.

See also: https://www.lua.org/license.html


Author

Nishioka Sadahiko GitHub: @OnStepNinja

About

LUNA — Physical AI Platform for Telescope & Observatory Automation

Topics

Resources

Stars

13 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

135 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

LUNA

An open Physical AI platform based on ESP32 & Lua that connects LLMs to telescopes, mounts, and legacy instruments for fully autonomous observation.

MCP Server + Lua Scripting Engine on ESP32

Let Claude AI control your telescope, camera, and entire observatory — in plain language.

VersionLicensePlatform


LUNA Docs (NotebookLM)

📚 LUNA Docs — Start here for setup guides, technical references, and FAQ. Ask questions directly inside NotebookLM and get answers from the official documentation. 👉 https://notebooklm.google.com/notebook/f2ce997f-18c2-44c4-8738-973b204c190c

💬 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. 👉 https://www.facebook.com/groups/1230935959149731


🚀 What's New in v8.9.7 2026-06-04

LUNA v8.9.7 is now officially released! This update introduces exciting wireless capabilities and major enhancements:

  • BLE 5.0 Support: Fully integrates Bluetooth Low Energy 5.0 for seamless wireless device connectivity.
  • LUNA Node (Sub Network): Introduces wireless sub-device support with no pairing limits—run autonomous Lua scripts remotely on child nodes!
  • Optimized Stability: Built on FreeRTOS dual-core architecture to ensure stable MCP and Lua execution.

⚠️Important: To ensure all features and APIs work correctly, please run the get_lua_guide tool immediately after connecting Claude to the LUNA MCP server.

For full flash binaries and auto-setup tools, check out the latest GitHub Releases.

What is LUNA?

LUNA is a firmware for ESP32 that turns it into an MCP (Model Context Protocol) server with a built-in Lua scripting engine.

Connect LUNA to your telescope or observatory equipment, then control everything through Claude AI — in plain language.

You ──→ Claude AI ──→ LUNA (ESP32) ──→ Telescope / Serial Device
"Go to M42" serial command 🔭 slews
You ──→ Claude AI ──→ LUNA (ESP32) ──→ NINA (PC) ──→ Camera / Focuser / Guider
"Image M42 tonight" HTTP API 🌟 full automation

LUNA runs Lua scripts autonomously on the ESP32. Claude writes the scripts, deploys them, and monitors results — all through the MCP protocol.

Hardware_Pinout_RS232C_Wiring_Guide

LUNA Observatory System v5.9.6


★ New in v5.9.3 — Vixen Mount Support (UDP)

LUNA 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.

MountProtocolConnection
Vixen Wireless Unit (AXD/SXP/SXD2/AP/SX2/AXJ/SXP2)UDP192.168.6.1 : 60023
Vixen STAR BOOK TENHTTP GET169.254.1.1 : 80
-- Example: slew Vixen Wireless Unit to a targetudp.begin(50000)
udp.connect("192.168.6.1", 60023)
udp.write("$MTTGT=1,83.82,−5.39,Orion Nebula\r\n")
udp.write("$MTMV2\r\n")
localresp=udp.read(2000)
udp.close()
log.write("GoTo response: " .. (respor"timeout"))

Claude knows the full Vixen command set internally via vixen_guide — just tell it where to point.


★ New in v5.9.2 — NINA Astrophotography Integration

LUNA now controls NINA (Nighttime Imaging 'N' Astronomy) — the world's most popular free astrophotography software — directly via its HTTP API.

What this means

Without LUNAWith LUNA + NINA
Build sequences manually (30–50 settings)Just tell Claude what you want to image
Start imaging manually"Image M42 at 3 min, 20 frames" — done
Configure each device separatelyClaude coordinates telescope, camera, focuser, guider, dome, and weather sensor together
Troubleshoot errors yourselfClaude explains what went wrong and suggests fixes

Verified working (2026-03-27)

✅ Camera connection and status
✅ Capture start / stop
✅ Autofocus
✅ Filter wheel control
✅ Sequence start / stop
✅ Guider start / stop
✅ ASCOM / Alpaca device control (switch, weather sensor)
✅ Stellarium integration

How it works

"Image M42 tonight"
① Check weather sensors → safe to observe? (LUNA + Alpaca)
② Slew telescope to M42 (Alpaca)
③ Run autofocus (NINA HTTP API)
④ Test exposure → plate solve → correct pointing (NINA HTTP API)
⑤ Start main imaging sequence (NINA HTTP API)
⑥ Re-focus periodically as temperature drops (NINA HTTP API)
⑦ Auto-abort if weather deteriorates (LUNA monitoring)

NINA is the "hands", Claude is the "brain", LUNA is the "nervous system."

Requirements for NINA integration

  • NINA v3.x — nighttime-imaging.eu (free)
  • NINA Advanced API plugin (free, installed from within NINA)
  • Port: 1888 (default), API Enabled: ON
  • LUNA and the NINA PC on the same WiFi network

Key Features

  • MCP Server — connects directly to Claude via the Model Context Protocol
  • Lua 5.1 scripting engine — write, save, and run scripts on the ESP32
  • Autonomous operation — scripts run independently; Claude monitors and intervenes as needed
  • Vixen mount support — Wireless Unit (UDP) and STAR BOOK TEN (HTTP) via new udp.* module (v5.9.3)
  • NINA integration — control astrophotography software via HTTP POST (v5.9.2)
  • http modulehttp.get / http.put / http.post for ASCOM/Alpaca, NINA Advanced API, and Vixen STAR BOOK TEN
  • udp moduleudp.begin / udp.connect / udp.write / udp.read / udp.close for Vixen Wireless Unit (v5.9.3)
  • MCP Resources — Claude reads device state naturally, like reading a gauge
  • Script-to-script data passinglog.save() / log.load() enable stateful workflows without Claude
  • Serial device control — full RS-232C control via serial.query(), serial.write(), serial.read()
  • FreeRTOS dual-core — MCP server and Lua engine run on separate cores; no blocking

Supported Devices

VariantBaud RateTarget Devices
LUNA Standard9,600 bpsMeade LX200, OnStep, LX200-compatible mounts
LUNA Temma219,200 bpsTakahashi Temma2

PC Software Integration (v5.9.2+)

SoftwareProtocolPort
NINA Advanced APIHTTP POST/GET1888
Stellarium Remote ControlHTTP POST/GET8090
ASCOM / Alpaca devicesHTTP GET/PUTvaries

Vixen Mount Integration (v5.9.3)

MountProtocolAddress
Vixen Wireless Unit (AXD/SXP/SXD2/AP/SX2/AXJ/SXP2)UDP192.168.6.1 : 60023
Vixen STAR BOOK TENHTTP GET169.254.1.1 : 80

LUNA works with any RS-232C serial device and any ASCOM/Alpaca-compatible device on your LAN.


Requirements

Hardware

  • ESP32 development board (ESP32-DevKitC or compatible)
  • RS-232C interface circuit (MAX3232 or equivalent)
  • Power: 5V via micro USB (power bank or USB charger)

Ready-to-use LUNA boards (LUNA OnStepNinja V2 — pre-wired, pre-flashed) are available from the author.

Software / Service

  • Claude Desktop (free)
  • MCP connector (included in the GitHub Releases download package)

Getting Started

Step 1 — Flash the Firmware

Download the firmware binary from GitHub Releases:

FileTarget
LUNA_v5.9.3_Standard.binLX200 / OnStep (9600 bps)
LUNA_v5.9.3_Temma2.binTakahashi Temma2 (19200 bps)

Flash to your ESP32 using esptool or ESP32 Flash Download Tool.

📄 See LUNA_Quick_Setup_Guide.md for full instructions.

Step 2 — Connect Claude Desktop to LUNA

Configure Claude Desktop using the MCP connector included in the download package.

📄 See LUNA_Quick_Setup_Guide.md for the 3-step setup.

Step 3 — Start talking to your telescope

You: "Go to M42"
Claude: → slews telescope to M42
You: "Image M42 tonight, 3 minutes per frame, 20 frames"
Claude: → autofocuses, plate solves, starts NINA sequence

Example: Full Observatory Automation

-- LUNA Lua script: check weather, then start NINA sequencelocalresp, code=http.get(
"http://192.168.x.x/api/v1/observingconditions/0/humidity", 2000)
ifcode==200thenlocalhumidity=-- parse respifhumidity<80thenhttp.post("http://192.168.x.x:1888/v2/api/sequence/start", "{}",
"application/json", 3000)
log.write("Sequence started. Humidity: " ..humidity.."%")
elsenotify.set("Humidity too high (" ..humidity.."%). Imaging skipped.")
endend

MCP Tools Available to Claude

ToolDescription
lua_execExecute a Lua script immediately
lua_saveSave a script to the ESP32 (SPIFFS)
lua_runRun a saved script asynchronously
lua_statusCheck execution state and results
lua_logRead the script log buffer
lua_stopStop a running script
lua_listList saved scripts
serial_querySend a command and read response
serial_writeSend a raw serial command
serial_readRead serial data
fs_readRead a file from ESP32 storage
fs_writeWrite a file to ESP32 storage
check_notifyReceive async notifications from Lua scripts

Lua API (inside scripts)

-- Serial controlserial.write(cmd)
serial.read(timeout_ms)
serial.query(cmd, timeout_ms)
-- HTTP (LAN only — ASCOM/Alpaca/NINA/Stellarium/Vixen STAR BOOK TEN)http.get(url, timeout_ms)
http.put(url, body, content_type, timeout_ms)
http.post(url, body, content_type, timeout_ms) -- v5.9.2-- UDP (Vixen Wireless Unit) -- v5.9.3udp.begin(local_port)
udp.connect(host, port)
udp.write(data)
udp.read([timeout_ms])
udp.close()
-- Logging & data passinglog.write(message)
log.read([n]) -- n omitted = latest linelog.save() -- persist to flashlog.load() -- restore from flash-- Hardwarehw.delay(ms)
hw.millis()
hw.free_heap()
hw.led(0or1)
-- Notify Claudenotify.set("message")
-- Script chainingluna.run("next_script_name")

Hardware

LUNA OnStepNinja V2 — pre-built board available from the author:

  • Pre-flashed with LUNA v5.9.3
  • RS-232C connector (D-sub 9-pin) included
  • Power: 5V micro USB
  • Compatible with NS-5000, OnStep, and LX200-compatible mounts

⚠️Cable note: Use a straight RS-232C cable between LUNA and a PC. Use a cross cable between LUNA and NS-5000 / OnStep.

Contact: GitHub Issues


Documentation

DocumentDescription
LUNA_Quick_Setup_Guide.mdFirst-time setup (3 steps)
LUNA_USER_MANUAL.mdFull reference manual
LUNA_Lua_Guide.mdLua scripting guide

📚 LUNA Docs on NotebookLM — Ask questions about LUNA directly.


License

The LUNA firmware binary is distributed under the MIT License. Source code is proprietary and not published.

Copyright © 2026 Nishioka Sadahiko


Third-Party Licenses

LUNA incorporates Lua 5.1, distributed under the MIT License:

Copyright © 1994–2012 Lua.org, PUC-Rio. 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.

See also: https://www.lua.org/license.html


Author

Nishioka Sadahiko GitHub: @OnStepNinja

About

LUNA — Physical AI Platform for Telescope & Observatory Automation

Topics

Resources

Stars

13 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

135 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

LUNA

An open Physical AI platform based on ESP32 & Lua that connects LLMs to telescopes, mounts, and legacy instruments for fully autonomous observation.

MCP Server + Lua Scripting Engine on ESP32

Let Claude AI control your telescope, camera, and entire observatory — in plain language.

VersionLicensePlatform


LUNA Docs (NotebookLM)

📚 LUNA Docs — Start here for setup guides, technical references, and FAQ. Ask questions directly inside NotebookLM and get answers from the official documentation. 👉 https://notebooklm.google.com/notebook/f2ce997f-18c2-44c4-8738-973b204c190c

💬 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. 👉 https://www.facebook.com/groups/1230935959149731


🚀 What's New in v8.9.7 2026-06-04

LUNA v8.9.7 is now officially released! This update introduces exciting wireless capabilities and major enhancements:

  • BLE 5.0 Support: Fully integrates Bluetooth Low Energy 5.0 for seamless wireless device connectivity.
  • LUNA Node (Sub Network): Introduces wireless sub-device support with no pairing limits—run autonomous Lua scripts remotely on child nodes!
  • Optimized Stability: Built on FreeRTOS dual-core architecture to ensure stable MCP and Lua execution.

⚠️Important: To ensure all features and APIs work correctly, please run the get_lua_guide tool immediately after connecting Claude to the LUNA MCP server.

For full flash binaries and auto-setup tools, check out the latest GitHub Releases.

What is LUNA?

LUNA is a firmware for ESP32 that turns it into an MCP (Model Context Protocol) server with a built-in Lua scripting engine.

Connect LUNA to your telescope or observatory equipment, then control everything through Claude AI — in plain language.

You ──→ Claude AI ──→ LUNA (ESP32) ──→ Telescope / Serial Device
"Go to M42" serial command 🔭 slews
You ──→ Claude AI ──→ LUNA (ESP32) ──→ NINA (PC) ──→ Camera / Focuser / Guider
"Image M42 tonight" HTTP API 🌟 full automation

LUNA runs Lua scripts autonomously on the ESP32. Claude writes the scripts, deploys them, and monitors results — all through the MCP protocol.

Hardware_Pinout_RS232C_Wiring_Guide

LUNA Observatory System v5.9.6


★ New in v5.9.3 — Vixen Mount Support (UDP)

LUNA 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.

MountProtocolConnection
Vixen Wireless Unit (AXD/SXP/SXD2/AP/SX2/AXJ/SXP2)UDP192.168.6.1 : 60023
Vixen STAR BOOK TENHTTP GET169.254.1.1 : 80
-- Example: slew Vixen Wireless Unit to a targetudp.begin(50000)
udp.connect("192.168.6.1", 60023)
udp.write("$MTTGT=1,83.82,−5.39,Orion Nebula\r\n")
udp.write("$MTMV2\r\n")
localresp=udp.read(2000)
udp.close()
log.write("GoTo response: " .. (respor"timeout"))

Claude knows the full Vixen command set internally via vixen_guide — just tell it where to point.


★ New in v5.9.2 — NINA Astrophotography Integration

LUNA now controls NINA (Nighttime Imaging 'N' Astronomy) — the world's most popular free astrophotography software — directly via its HTTP API.

What this means

Without LUNAWith LUNA + NINA
Build sequences manually (30–50 settings)Just tell Claude what you want to image
Start imaging manually"Image M42 at 3 min, 20 frames" — done
Configure each device separatelyClaude coordinates telescope, camera, focuser, guider, dome, and weather sensor together
Troubleshoot errors yourselfClaude explains what went wrong and suggests fixes

Verified working (2026-03-27)

✅ Camera connection and status
✅ Capture start / stop
✅ Autofocus
✅ Filter wheel control
✅ Sequence start / stop
✅ Guider start / stop
✅ ASCOM / Alpaca device control (switch, weather sensor)
✅ Stellarium integration

How it works

"Image M42 tonight"
① Check weather sensors → safe to observe? (LUNA + Alpaca)
② Slew telescope to M42 (Alpaca)
③ Run autofocus (NINA HTTP API)
④ Test exposure → plate solve → correct pointing (NINA HTTP API)
⑤ Start main imaging sequence (NINA HTTP API)
⑥ Re-focus periodically as temperature drops (NINA HTTP API)
⑦ Auto-abort if weather deteriorates (LUNA monitoring)

NINA is the "hands", Claude is the "brain", LUNA is the "nervous system."

Requirements for NINA integration

  • NINA v3.x — nighttime-imaging.eu (free)
  • NINA Advanced API plugin (free, installed from within NINA)
  • Port: 1888 (default), API Enabled: ON
  • LUNA and the NINA PC on the same WiFi network

Key Features

  • MCP Server — connects directly to Claude via the Model Context Protocol
  • Lua 5.1 scripting engine — write, save, and run scripts on the ESP32
  • Autonomous operation — scripts run independently; Claude monitors and intervenes as needed
  • Vixen mount support — Wireless Unit (UDP) and STAR BOOK TEN (HTTP) via new udp.* module (v5.9.3)
  • NINA integration — control astrophotography software via HTTP POST (v5.9.2)
  • http modulehttp.get / http.put / http.post for ASCOM/Alpaca, NINA Advanced API, and Vixen STAR BOOK TEN
  • udp moduleudp.begin / udp.connect / udp.write / udp.read / udp.close for Vixen Wireless Unit (v5.9.3)
  • MCP Resources — Claude reads device state naturally, like reading a gauge
  • Script-to-script data passinglog.save() / log.load() enable stateful workflows without Claude
  • Serial device control — full RS-232C control via serial.query(), serial.write(), serial.read()
  • FreeRTOS dual-core — MCP server and Lua engine run on separate cores; no blocking

Supported Devices

VariantBaud RateTarget Devices
LUNA Standard9,600 bpsMeade LX200, OnStep, LX200-compatible mounts
LUNA Temma219,200 bpsTakahashi Temma2

PC Software Integration (v5.9.2+)

SoftwareProtocolPort
NINA Advanced APIHTTP POST/GET1888
Stellarium Remote ControlHTTP POST/GET8090
ASCOM / Alpaca devicesHTTP GET/PUTvaries

Vixen Mount Integration (v5.9.3)

MountProtocolAddress
Vixen Wireless Unit (AXD/SXP/SXD2/AP/SX2/AXJ/SXP2)UDP192.168.6.1 : 60023
Vixen STAR BOOK TENHTTP GET169.254.1.1 : 80

LUNA works with any RS-232C serial device and any ASCOM/Alpaca-compatible device on your LAN.


Requirements

Hardware

  • ESP32 development board (ESP32-DevKitC or compatible)
  • RS-232C interface circuit (MAX3232 or equivalent)
  • Power: 5V via micro USB (power bank or USB charger)

Ready-to-use LUNA boards (LUNA OnStepNinja V2 — pre-wired, pre-flashed) are available from the author.

Software / Service

  • Claude Desktop (free)
  • MCP connector (included in the GitHub Releases download package)

Getting Started

Step 1 — Flash the Firmware

Download the firmware binary from GitHub Releases:

FileTarget
LUNA_v5.9.3_Standard.binLX200 / OnStep (9600 bps)
LUNA_v5.9.3_Temma2.binTakahashi Temma2 (19200 bps)

Flash to your ESP32 using esptool or ESP32 Flash Download Tool.

📄 See LUNA_Quick_Setup_Guide.md for full instructions.

Step 2 — Connect Claude Desktop to LUNA

Configure Claude Desktop using the MCP connector included in the download package.

📄 See LUNA_Quick_Setup_Guide.md for the 3-step setup.

Step 3 — Start talking to your telescope

You: "Go to M42"
Claude: → slews telescope to M42
You: "Image M42 tonight, 3 minutes per frame, 20 frames"
Claude: → autofocuses, plate solves, starts NINA sequence

Example: Full Observatory Automation

-- LUNA Lua script: check weather, then start NINA sequencelocalresp, code=http.get(
"http://192.168.x.x/api/v1/observingconditions/0/humidity", 2000)
ifcode==200thenlocalhumidity=-- parse respifhumidity<80thenhttp.post("http://192.168.x.x:1888/v2/api/sequence/start", "{}",
"application/json", 3000)
log.write("Sequence started. Humidity: " ..humidity.."%")
elsenotify.set("Humidity too high (" ..humidity.."%). Imaging skipped.")
endend

MCP Tools Available to Claude

ToolDescription
lua_execExecute a Lua script immediately
lua_saveSave a script to the ESP32 (SPIFFS)
lua_runRun a saved script asynchronously
lua_statusCheck execution state and results
lua_logRead the script log buffer
lua_stopStop a running script
lua_listList saved scripts
serial_querySend a command and read response
serial_writeSend a raw serial command
serial_readRead serial data
fs_readRead a file from ESP32 storage
fs_writeWrite a file to ESP32 storage
check_notifyReceive async notifications from Lua scripts

Lua API (inside scripts)

-- Serial controlserial.write(cmd)
serial.read(timeout_ms)
serial.query(cmd, timeout_ms)
-- HTTP (LAN only — ASCOM/Alpaca/NINA/Stellarium/Vixen STAR BOOK TEN)http.get(url, timeout_ms)
http.put(url, body, content_type, timeout_ms)
http.post(url, body, content_type, timeout_ms) -- v5.9.2-- UDP (Vixen Wireless Unit) -- v5.9.3udp.begin(local_port)
udp.connect(host, port)
udp.write(data)
udp.read([timeout_ms])
udp.close()
-- Logging & data passinglog.write(message)
log.read([n]) -- n omitted = latest linelog.save() -- persist to flashlog.load() -- restore from flash-- Hardwarehw.delay(ms)
hw.millis()
hw.free_heap()
hw.led(0or1)
-- Notify Claudenotify.set("message")
-- Script chainingluna.run("next_script_name")

Hardware

LUNA OnStepNinja V2 — pre-built board available from the author:

  • Pre-flashed with LUNA v5.9.3
  • RS-232C connector (D-sub 9-pin) included
  • Power: 5V micro USB
  • Compatible with NS-5000, OnStep, and LX200-compatible mounts

⚠️Cable note: Use a straight RS-232C cable between LUNA and a PC. Use a cross cable between LUNA and NS-5000 / OnStep.

Contact: GitHub Issues


Documentation

DocumentDescription
LUNA_Quick_Setup_Guide.mdFirst-time setup (3 steps)
LUNA_USER_MANUAL.mdFull reference manual
LUNA_Lua_Guide.mdLua scripting guide

📚 LUNA Docs on NotebookLM — Ask questions about LUNA directly.


License

The LUNA firmware binary is distributed under the MIT License. Source code is proprietary and not published.

Copyright © 2026 Nishioka Sadahiko


Third-Party Licenses

LUNA incorporates Lua 5.1, distributed under the MIT License:

Copyright © 1994–2012 Lua.org, PUC-Rio. 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.

See also: https://www.lua.org/license.html


Author

Nishioka Sadahiko GitHub: @OnStepNinja

About

LUNA — Physical AI Platform for Telescope & Observatory Automation

Topics

Resources

Stars

13 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Latest commit

History

135 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

LUNA

An open Physical AI platform based on ESP32 & Lua that connects LLMs to telescopes, mounts, and legacy instruments for fully autonomous observation.

MCP Server + Lua Scripting Engine on ESP32

Let Claude AI control your telescope, camera, and entire observatory — in plain language.

VersionLicensePlatform


LUNA Docs (NotebookLM)

📚 LUNA Docs — Start here for setup guides, technical references, and FAQ. Ask questions directly inside NotebookLM and get answers from the official documentation. 👉 https://notebooklm.google.com/notebook/f2ce997f-18c2-44c4-8738-973b204c190c

💬 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. 👉 https://www.facebook.com/groups/1230935959149731


🚀 What's New in v8.9.7 2026-06-04

LUNA v8.9.7 is now officially released! This update introduces exciting wireless capabilities and major enhancements:

  • BLE 5.0 Support: Fully integrates Bluetooth Low Energy 5.0 for seamless wireless device connectivity.
  • LUNA Node (Sub Network): Introduces wireless sub-device support with no pairing limits—run autonomous Lua scripts remotely on child nodes!
  • Optimized Stability: Built on FreeRTOS dual-core architecture to ensure stable MCP and Lua execution.

⚠️Important: To ensure all features and APIs work correctly, please run the get_lua_guide tool immediately after connecting Claude to the LUNA MCP server.

For full flash binaries and auto-setup tools, check out the latest GitHub Releases.

What is LUNA?

LUNA is a firmware for ESP32 that turns it into an MCP (Model Context Protocol) server with a built-in Lua scripting engine.

Connect LUNA to your telescope or observatory equipment, then control everything through Claude AI — in plain language.

You ──→ Claude AI ──→ LUNA (ESP32) ──→ Telescope / Serial Device
"Go to M42" serial command 🔭 slews
You ──→ Claude AI ──→ LUNA (ESP32) ──→ NINA (PC) ──→ Camera / Focuser / Guider
"Image M42 tonight" HTTP API 🌟 full automation

LUNA runs Lua scripts autonomously on the ESP32. Claude writes the scripts, deploys them, and monitors results — all through the MCP protocol.

Hardware_Pinout_RS232C_Wiring_Guide

LUNA Observatory System v5.9.6


★ New in v5.9.3 — Vixen Mount Support (UDP)

LUNA 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.

MountProtocolConnection
Vixen Wireless Unit (AXD/SXP/SXD2/AP/SX2/AXJ/SXP2)UDP192.168.6.1 : 60023
Vixen STAR BOOK TENHTTP GET169.254.1.1 : 80
-- Example: slew Vixen Wireless Unit to a targetudp.begin(50000)
udp.connect("192.168.6.1", 60023)
udp.write("$MTTGT=1,83.82,−5.39,Orion Nebula\r\n")
udp.write("$MTMV2\r\n")
localresp=udp.read(2000)
udp.close()
log.write("GoTo response: " .. (respor"timeout"))

Claude knows the full Vixen command set internally via vixen_guide — just tell it where to point.


★ New in v5.9.2 — NINA Astrophotography Integration

LUNA now controls NINA (Nighttime Imaging 'N' Astronomy) — the world's most popular free astrophotography software — directly via its HTTP API.

What this means

Without LUNAWith LUNA + NINA
Build sequences manually (30–50 settings)Just tell Claude what you want to image
Start imaging manually"Image M42 at 3 min, 20 frames" — done
Configure each device separatelyClaude coordinates telescope, camera, focuser, guider, dome, and weather sensor together
Troubleshoot errors yourselfClaude explains what went wrong and suggests fixes

Verified working (2026-03-27)

✅ Camera connection and status
✅ Capture start / stop
✅ Autofocus
✅ Filter wheel control
✅ Sequence start / stop
✅ Guider start / stop
✅ ASCOM / Alpaca device control (switch, weather sensor)
✅ Stellarium integration

How it works

"Image M42 tonight"
① Check weather sensors → safe to observe? (LUNA + Alpaca)
② Slew telescope to M42 (Alpaca)
③ Run autofocus (NINA HTTP API)
④ Test exposure → plate solve → correct pointing (NINA HTTP API)
⑤ Start main imaging sequence (NINA HTTP API)
⑥ Re-focus periodically as temperature drops (NINA HTTP API)
⑦ Auto-abort if weather deteriorates (LUNA monitoring)

NINA is the "hands", Claude is the "brain", LUNA is the "nervous system."

Requirements for NINA integration

  • NINA v3.x — nighttime-imaging.eu (free)
  • NINA Advanced API plugin (free, installed from within NINA)
  • Port: 1888 (default), API Enabled: ON
  • LUNA and the NINA PC on the same WiFi network

Key Features

  • MCP Server — connects directly to Claude via the Model Context Protocol
  • Lua 5.1 scripting engine — write, save, and run scripts on the ESP32
  • Autonomous operation — scripts run independently; Claude monitors and intervenes as needed
  • Vixen mount support — Wireless Unit (UDP) and STAR BOOK TEN (HTTP) via new udp.* module (v5.9.3)
  • NINA integration — control astrophotography software via HTTP POST (v5.9.2)
  • http modulehttp.get / http.put / http.post for ASCOM/Alpaca, NINA Advanced API, and Vixen STAR BOOK TEN
  • udp moduleudp.begin / udp.connect / udp.write / udp.read / udp.close for Vixen Wireless Unit (v5.9.3)
  • MCP Resources — Claude reads device state naturally, like reading a gauge
  • Script-to-script data passinglog.save() / log.load() enable stateful workflows without Claude
  • Serial device control — full RS-232C control via serial.query(), serial.write(), serial.read()
  • FreeRTOS dual-core — MCP server and Lua engine run on separate cores; no blocking

Supported Devices

VariantBaud RateTarget Devices
LUNA Standard9,600 bpsMeade LX200, OnStep, LX200-compatible mounts
LUNA Temma219,200 bpsTakahashi Temma2

PC Software Integration (v5.9.2+)

SoftwareProtocolPort
NINA Advanced APIHTTP POST/GET1888
Stellarium Remote ControlHTTP POST/GET8090
ASCOM / Alpaca devicesHTTP GET/PUTvaries

Vixen Mount Integration (v5.9.3)

MountProtocolAddress
Vixen Wireless Unit (AXD/SXP/SXD2/AP/SX2/AXJ/SXP2)UDP192.168.6.1 : 60023
Vixen STAR BOOK TENHTTP GET169.254.1.1 : 80

LUNA works with any RS-232C serial device and any ASCOM/Alpaca-compatible device on your LAN.


Requirements

Hardware

  • ESP32 development board (ESP32-DevKitC or compatible)
  • RS-232C interface circuit (MAX3232 or equivalent)
  • Power: 5V via micro USB (power bank or USB charger)

Ready-to-use LUNA boards (LUNA OnStepNinja V2 — pre-wired, pre-flashed) are available from the author.

Software / Service

  • Claude Desktop (free)
  • MCP connector (included in the GitHub Releases download package)

Getting Started

Step 1 — Flash the Firmware

Download the firmware binary from GitHub Releases:

FileTarget
LUNA_v5.9.3_Standard.binLX200 / OnStep (9600 bps)
LUNA_v5.9.3_Temma2.binTakahashi Temma2 (19200 bps)

Flash to your ESP32 using esptool or ESP32 Flash Download Tool.

📄 See LUNA_Quick_Setup_Guide.md for full instructions.

Step 2 — Connect Claude Desktop to LUNA

Configure Claude Desktop using the MCP connector included in the download package.

📄 See LUNA_Quick_Setup_Guide.md for the 3-step setup.

Step 3 — Start talking to your telescope

You: "Go to M42"
Claude: → slews telescope to M42
You: "Image M42 tonight, 3 minutes per frame, 20 frames"
Claude: → autofocuses, plate solves, starts NINA sequence

Example: Full Observatory Automation

-- LUNA Lua script: check weather, then start NINA sequencelocalresp, code=http.get(
"http://192.168.x.x/api/v1/observingconditions/0/humidity", 2000)
ifcode==200thenlocalhumidity=-- parse respifhumidity<80thenhttp.post("http://192.168.x.x:1888/v2/api/sequence/start", "{}",
"application/json", 3000)
log.write("Sequence started. Humidity: " ..humidity.."%")
elsenotify.set("Humidity too high (" ..humidity.."%). Imaging skipped.")
endend

MCP Tools Available to Claude

ToolDescription
lua_execExecute a Lua script immediately
lua_saveSave a script to the ESP32 (SPIFFS)
lua_runRun a saved script asynchronously
lua_statusCheck execution state and results
lua_logRead the script log buffer
lua_stopStop a running script
lua_listList saved scripts
serial_querySend a command and read response
serial_writeSend a raw serial command
serial_readRead serial data
fs_readRead a file from ESP32 storage
fs_writeWrite a file to ESP32 storage
check_notifyReceive async notifications from Lua scripts

Lua API (inside scripts)

-- Serial controlserial.write(cmd)
serial.read(timeout_ms)
serial.query(cmd, timeout_ms)
-- HTTP (LAN only — ASCOM/Alpaca/NINA/Stellarium/Vixen STAR BOOK TEN)http.get(url, timeout_ms)
http.put(url, body, content_type, timeout_ms)
http.post(url, body, content_type, timeout_ms) -- v5.9.2-- UDP (Vixen Wireless Unit) -- v5.9.3udp.begin(local_port)
udp.connect(host, port)
udp.write(data)
udp.read([timeout_ms])
udp.close()
-- Logging & data passinglog.write(message)
log.read([n]) -- n omitted = latest linelog.save() -- persist to flashlog.load() -- restore from flash-- Hardwarehw.delay(ms)
hw.millis()
hw.free_heap()
hw.led(0or1)
-- Notify Claudenotify.set("message")
-- Script chainingluna.run("next_script_name")

Hardware

LUNA OnStepNinja V2 — pre-built board available from the author:

  • Pre-flashed with LUNA v5.9.3
  • RS-232C connector (D-sub 9-pin) included
  • Power: 5V micro USB
  • Compatible with NS-5000, OnStep, and LX200-compatible mounts

⚠️Cable note: Use a straight RS-232C cable between LUNA and a PC. Use a cross cable between LUNA and NS-5000 / OnStep.

Contact: GitHub Issues


Documentation

DocumentDescription
LUNA_Quick_Setup_Guide.mdFirst-time setup (3 steps)
LUNA_USER_MANUAL.mdFull reference manual
LUNA_Lua_Guide.mdLua scripting guide

📚 LUNA Docs on NotebookLM — Ask questions about LUNA directly.


License

The LUNA firmware binary is distributed under the MIT License. Source code is proprietary and not published.

Copyright © 2026 Nishioka Sadahiko


Third-Party Licenses

LUNA incorporates Lua 5.1, distributed under the MIT License:

Copyright © 1994–2012 Lua.org, PUC-Rio. 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.

See also: https://www.lua.org/license.html


Author

Nishioka Sadahiko GitHub: @OnStepNinja

About

LUNA — Physical AI Platform for Telescope & Observatory Automation

Topics

Resources

Stars

13 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors