Skip to content

v5.9.8 — LUNA Lab Edition: ADC/DAC Analog I/O

Choose a tag to compare

@OnStepNinja OnStepNinja released this 01 May 12:26
· 49 commits to main since this release
85be718

AiBridgeMCP v5.9.8 — LUNA Lab Edition 🔬

From AI Bridge to AI Bridge & Platform.
LUNA is no longer just a bridge between Claude and your instruments —
it is becoming a programmable AI-native platform for physical computing.


🆕 What's New in v5.9.8

adc module — Analog Input (ESP32 ADC1)

Read real-world analog voltages directly from Lua scripts.

Function Description
adc.atten(pin, db) Set measurement range: 0=0–950mV / 1=0–1250mV / 2=0–1750mV / 3=0–3100mV
adc.read(pin) Raw 12-bit value (0–4095)
adc.read_mv(pin) Calibrated millivolts (eFuse correction applied)
adc.read_avg(pin, n) Average of n readings in mV — reduces noise (recommended n ≥ 16)

Supported pins: GPIO32–35 (recommended). GPIO36(VP), GPIO39(VN) are reserved — avoid.
⚠ ADC2 pins conflict with WiFi — use ADC1 only.


dac module — Analog Output (ESP32 hardware DAC)

Output true analog voltages — no RC filter required.

Function Description
dac.write(pin, value) Output 0–255 → 0V to 3.3V. GPIO25 (DAC1) or GPIO26 (DAC2) only.
dac.stop(pin) Disable DAC output

Supported pins: GPIO25 (DAC1), GPIO26 (DAC2, shared with Output 4 on OnStepNinja V2).
⚠ ESP32-S3 has no hardware DAC. Use gpio.pwm() + RC filter as a pseudo-DAC.
⚠ Do not use DAC and PWM simultaneously on the same pin.


💡 Verified on Hardware

All functions confirmed on ESP32-D0WD-V3:

  • adc.read_mv(34) → 3145 mV ✅ (calibrated, stable)
  • dac.write(26, 128) → 1.72V measured (expected 1.647V, +4.4% — within spec) ✅
  • dac.write(25, 0–255) → Smooth LED fade confirmed ✅
  • Invalid pin rejection (ADC2 / non-DAC pins) → correct error returned ✅

🌉 From AI Bridge to AI Bridge & Platform

When LUNA first launched, it was designed as a bridge
connecting Claude AI to telescopes, serial instruments, and local networks via MCP.

With v5.9.8, LUNA takes a step further.

By adding true analog I/O (adc / dac) alongside existing modules
(gpio, sensor, tcp, udp, http, json, ntp, ui, log, ble...),
LUNA is evolving into an AI-native physical computing platform
where Claude can not only communicate with devices,
but sense, measure, and directly control the physical world,
all through natural conversation and Lua scripts.

Telescope control → Sensor logging → Analog experiments → BLE mesh networks.
One device. One platform. Driven by AI.

This opens the door to applications in:

  • 🔭 Amateur astronomy automation
  • 🧪 Lab & bioscience experiments (voltage stimulus / response measurement)
  • 🌱 Environmental monitoring
  • 🤖 AI-driven robotics and physical computing

📦 How to Use

  1. Flash AiBridgeMCP_v5_9_8.ino via Arduino IDE (ESP32 board, Huge APP partition)
  2. Connect to WiFi via the setup page
  3. Add to Claude Desktop claude_desktop_config.json
  4. Ask Claude to get_lua_guide — then start experimenting!

❤️ Support the Project on BOOTH

This firmware is free and open — always will be.

If LUNA has been useful to you, the same firmware (pre-compiled binary, ready to flash)
is available on BOOTH as a pay-what-you-feel download:

👉 https://onstepninja.booth.pm/

Your support — however small — directly funds continued development.
New modules, new editions, new ideas.
Every download is a vote for the next version. Thank you. 🙏


📄 Changelog

  • FIRMWARE_VERSION: 5.9.7 → 5.9.8
  • EDITION_NAME: "LUNA" → "LUNA Lab"
  • Added: adc module (atten / read / read_mv / read_avg)
  • Added: dac module (write / stop)
  • Changed: FILE_MANAGER_LED_PIN GPIO25 → GPIO33 (frees GPIO25 for DAC1)
  • Updated: lua_exec description, luna_guide (adc/dac sections)
  • Fixed: Lua guide — corrected GPIO25 LED note, GPIO36/39 warning, GPIO26 DAC/PWM caution

LUNA — AI Bridge & Platform for the Physical World.
Solo indie project by Nishioka Sadahiko.