Initial release v1.1.0 — ESP32 automated telescope flat panel

Firmware (Arduino Nano ESP32 / PlatformIO):
- Native ASCOM Alpaca CoverCalibrator REST API on port 11111
- Alnitak serial protocol on USB at 9600 baud (simultaneous with WiFi)
- MG995 servo cover mechanism with non-blocking state machine (D9)
- LED brightness PWM via IRLZ44N MOSFET, LEDC channel 0 (D3)
- 12V dew heater PWM via IRLZ44N MOSFET, LEDC channel 1 (D5)
- mDNS + UDP Alpaca discovery, WiFi watchdog reconnect
- SERIAL_DEBUG flag to silence debug output in USB-only mode

INDI driver (C++ / libcurl / nlohmann-json):
- WiFi mode: HTTP Alpaca via libcurl
- USB mode: Alnitak serial via POSIX termios
- LightBoxInterface + DustCapInterface + dew heater number property

Python controller (PyQt6):
- Dark-themed desktop app for direct manual control
- AlpacaBackend (requests) + AlnitakBackend (pyserial)
- PollWorker QThread; cover, brightness, dew heater panels
- QSettings persistence; auto serial port discovery

Docs:
- system-diagram.svg, wiring-diagram.svg (browser-renderable SVG)
- BUILD_NOTES.md with BOM, LM2596 calibration, power-on checklist
- WIRING.md quick-reference, README.md, CHANGELOG.md
This commit is contained in:
Laurence 2026-05-17 08:51:29 +01:00
commit c32f00a2be
15 changed files with 3653 additions and 0 deletions

282
docs/system-diagram.svg Normal file
View file

@ -0,0 +1,282 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="860" height="520" viewBox="0 0 860 520">
<defs>
<!-- Arrow markers -->
<marker id="arr-blue" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
<polygon points="0 0, 10 3.5, 0 7" fill="#1565c0"/>
</marker>
<marker id="arr-green" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
<polygon points="0 0, 10 3.5, 0 7" fill="#2e7d32"/>
</marker>
<marker id="arr-grey" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
<polygon points="0 0, 10 3.5, 0 7" fill="#607d8b"/>
</marker>
<marker id="arr-red" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
<polygon points="0 0, 10 3.5, 0 7" fill="#c62828"/>
</marker>
<marker id="arr-orange" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
<polygon points="0 0, 10 3.5, 0 7" fill="#e65100"/>
</marker>
</defs>
<!-- Background -->
<rect width="860" height="520" fill="#fafafa"/>
<!-- Title -->
<text x="430" y="32" text-anchor="middle" font-family="Segoe UI, Arial, sans-serif"
font-size="17" font-weight="bold" fill="#212121">
ESP32 FlatPanel — System Architecture
</text>
<!-- ══════════════════════════════════════════════════════════════════════ -->
<!-- PC Software block -->
<!-- ══════════════════════════════════════════════════════════════════════ -->
<rect x="20" y="55" width="230" height="230" rx="10"
fill="#e3f2fd" stroke="#1565c0" stroke-width="2"/>
<text x="135" y="79" text-anchor="middle"
font-family="Segoe UI, Arial, sans-serif" font-size="13" font-weight="bold" fill="#0d47a1">
PC Software
</text>
<!-- N.I.N.A / ASCOM sub-box -->
<rect x="38" y="90" width="194" height="58" rx="6"
fill="#bbdefb" stroke="#1565c0" stroke-width="1"/>
<text x="135" y="114" text-anchor="middle"
font-family="Segoe UI, Arial, sans-serif" font-size="11" font-weight="bold" fill="#0d47a1">
N.I.N.A. / SGPro / KStars
</text>
<text x="135" y="132" text-anchor="middle"
font-family="Segoe UI, Arial, sans-serif" font-size="10" fill="#1565c0">
via ASCOM Remote / INDI driver
</text>
<!-- Controller sub-box (highlighted) -->
<rect x="38" y="162" width="194" height="58" rx="6"
fill="#1565c0" stroke="#0d47a1" stroke-width="1.5"/>
<text x="135" y="186" text-anchor="middle"
font-family="Segoe UI, Arial, sans-serif" font-size="12" font-weight="bold" fill="white">
FlatPanel Controller
</text>
<text x="135" y="204" text-anchor="middle"
font-family="Segoe UI, Arial, sans-serif" font-size="10" fill="#bbdefb">
flatpanel_controller.py
</text>
<!-- OS label -->
<text x="135" y="258" text-anchor="middle"
font-family="Segoe UI, Arial, sans-serif" font-size="10" fill="#555">
Windows / Linux / macOS
</text>
<!-- ══════════════════════════════════════════════════════════════════════ -->
<!-- ESP32 central block -->
<!-- ══════════════════════════════════════════════════════════════════════ -->
<rect x="300" y="130" width="210" height="230" rx="12"
fill="#f3e5f5" stroke="#6a1b9a" stroke-width="2.5"/>
<text x="405" y="157" text-anchor="middle"
font-family="Segoe UI, Arial, sans-serif" font-size="13" font-weight="bold" fill="#4a148c">
Arduino Nano ESP32
</text>
<!-- Pin labels inside ESP32 box -->
<text x="405" y="181" text-anchor="middle"
font-family="Courier New, monospace" font-size="10" fill="#6a1b9a">
WiFi • USB CDC
</text>
<line x1="320" y1="192" x2="490" y2="192" stroke="#ce93d8" stroke-width="1"/>
<text x="405" y="211" text-anchor="middle"
font-family="Courier New, monospace" font-size="10" fill="#555">
Alpaca REST :11111
</text>
<text x="405" y="228" text-anchor="middle"
font-family="Courier New, monospace" font-size="10" fill="#555">
Alnitak serial 9600 baud
</text>
<line x1="320" y1="238" x2="490" y2="238" stroke="#ce93d8" stroke-width="1"/>
<text x="405" y="257" text-anchor="middle"
font-family="Courier New, monospace" font-size="10" fill="#555">
D9 → servo PWM
</text>
<text x="405" y="273" text-anchor="middle"
font-family="Courier New, monospace" font-size="10" fill="#555">
D3 → LED brightness PWM
</text>
<text x="405" y="289" text-anchor="middle"
font-family="Courier New, monospace" font-size="10" fill="#555">
D5 → dew heater PWM
</text>
<text x="405" y="305" text-anchor="middle"
font-family="Courier New, monospace" font-size="10" fill="#555">
VIN ← 5V (LM2596)
</text>
<text x="405" y="321" text-anchor="middle"
font-family="Courier New, monospace" font-size="10" fill="#555">
GND → common ground
</text>
<!-- ══════════════════════════════════════════════════════════════════════ -->
<!-- Output blocks (right column) -->
<!-- ══════════════════════════════════════════════════════════════════════ -->
<!-- MG995 Servo -->
<rect x="580" y="55" width="200" height="70" rx="8"
fill="#e8f5e9" stroke="#2e7d32" stroke-width="1.8"/>
<text x="680" y="82" text-anchor="middle"
font-family="Segoe UI, Arial, sans-serif" font-size="12" font-weight="bold" fill="#1b5e20">
MG995 Servo
</text>
<text x="680" y="100" text-anchor="middle"
font-family="Segoe UI, Arial, sans-serif" font-size="10" fill="#388e3c">
Cover open / close mechanism
</text>
<text x="680" y="115" text-anchor="middle"
font-family="Segoe UI, Arial, sans-serif" font-size="10" fill="#388e3c">
5V supply via LM2596
</text>
<!-- LED MOSFET + Panel -->
<rect x="580" y="150" width="200" height="70" rx="8"
fill="#fffde7" stroke="#f9a825" stroke-width="1.8"/>
<text x="680" y="177" text-anchor="middle"
font-family="Segoe UI, Arial, sans-serif" font-size="12" font-weight="bold" fill="#e65100">
IRLZ44N MOSFET-A
</text>
<text x="680" y="195" text-anchor="middle"
font-family="Segoe UI, Arial, sans-serif" font-size="10" fill="#bf360c">
→ White LED Panel (12V)
</text>
<text x="680" y="211" text-anchor="middle"
font-family="Segoe UI, Arial, sans-serif" font-size="10" fill="#bf360c">
PWM brightness 0255
</text>
<!-- Dew Heater MOSFET -->
<rect x="580" y="245" width="200" height="70" rx="8"
fill="#fce4ec" stroke="#c62828" stroke-width="1.8"/>
<text x="680" y="272" text-anchor="middle"
font-family="Segoe UI, Arial, sans-serif" font-size="12" font-weight="bold" fill="#b71c1c">
IRLZ44N MOSFET-B
</text>
<text x="680" y="290" text-anchor="middle"
font-family="Segoe UI, Arial, sans-serif" font-size="10" fill="#c62828">
→ Dew Heater Element (12V)
</text>
<text x="680" y="306" text-anchor="middle"
font-family="Segoe UI, Arial, sans-serif" font-size="10" fill="#c62828">
PWM power 0100 %
</text>
<!-- PSU + Buck -->
<rect x="580" y="340" width="200" height="90" rx="8"
fill="#ede7f6" stroke="#6a1b9a" stroke-width="1.8"/>
<text x="680" y="367" text-anchor="middle"
font-family="Segoe UI, Arial, sans-serif" font-size="12" font-weight="bold" fill="#4a148c">
12V PSU (≥4A)
</text>
<text x="680" y="386" text-anchor="middle"
font-family="Segoe UI, Arial, sans-serif" font-size="10" fill="#6a1b9a">
→ 12V rail: LED + dew heater
</text>
<text x="680" y="402" text-anchor="middle"
font-family="Segoe UI, Arial, sans-serif" font-size="10" fill="#6a1b9a">
→ LM2596 buck → 5V rail
</text>
<text x="680" y="418" text-anchor="middle"
font-family="Segoe UI, Arial, sans-serif" font-size="10" fill="#6a1b9a">
→ 5V: ESP32 VIN + servo
</text>
<!-- ══════════════════════════════════════════════════════════════════════ -->
<!-- Connection arrows: PC → ESP32 -->
<!-- ══════════════════════════════════════════════════════════════════════ -->
<!-- WiFi (dashed blue) -->
<path d="M 250 119 C 280 119 275 185 300 185"
fill="none" stroke="#1565c0" stroke-width="2" stroke-dasharray="7,4"
marker-end="url(#arr-blue)"/>
<text x="263" y="153" font-family="Segoe UI, Arial, sans-serif"
font-size="10" fill="#1565c0" transform="rotate(-10, 263, 153)">
HTTP / Alpaca
</text>
<text x="263" y="165" font-family="Segoe UI, Arial, sans-serif"
font-size="9" fill="#1565c0" transform="rotate(-10, 263, 165)">
WiFi :11111
</text>
<!-- USB (solid green) -->
<path d="M 250 191 C 278 191 275 230 300 230"
fill="none" stroke="#2e7d32" stroke-width="2"
marker-end="url(#arr-green)"/>
<text x="258" y="223" font-family="Segoe UI, Arial, sans-serif"
font-size="10" fill="#2e7d32" transform="rotate(5, 258, 223)">
USB / Alnitak
</text>
<text x="258" y="235" font-family="Segoe UI, Arial, sans-serif"
font-size="9" fill="#2e7d32" transform="rotate(5, 258, 235)">
9600 baud serial
</text>
<!-- ══════════════════════════════════════════════════════════════════════ -->
<!-- ESP32 → outputs -->
<!-- ══════════════════════════════════════════════════════════════════════ -->
<!-- → MG995 (D9) -->
<path d="M 510 185 C 545 185 545 90 580 90"
fill="none" stroke="#2e7d32" stroke-width="1.8"
marker-end="url(#arr-green)"/>
<text x="534" y="130" font-family="Segoe UI, Arial, sans-serif"
font-size="9" fill="#2e7d32">D9</text>
<!-- → LED MOSFET (D3) -->
<line x1="510" y1="220" x2="580" y2="185"
stroke="#f9a825" stroke-width="1.8" marker-end="url(#arr-orange)"/>
<text x="532" y="210" font-family="Segoe UI, Arial, sans-serif"
font-size="9" fill="#e65100">D3 PWM</text>
<!-- → Dew MOSFET (D5) -->
<line x1="510" y1="270" x2="580" y2="280"
stroke="#c62828" stroke-width="1.8" marker-end="url(#arr-red)"/>
<text x="522" y="268" font-family="Segoe UI, Arial, sans-serif"
font-size="9" fill="#c62828">D5 PWM</text>
<!-- PSU → ESP32 VIN (5V) -->
<path d="M 580 385 C 520 385 495 340 510 335"
fill="none" stroke="#e65100" stroke-width="1.8" stroke-dasharray="5,3"
marker-end="url(#arr-orange)"/>
<text x="490" y="373" font-family="Segoe UI, Arial, sans-serif"
font-size="9" fill="#e65100">5V VIN</text>
<!-- ══════════════════════════════════════════════════════════════════════ -->
<!-- Legend -->
<!-- ══════════════════════════════════════════════════════════════════════ -->
<rect x="22" y="310" width="230" height="130" rx="6"
fill="#f5f5f5" stroke="#ccc" stroke-width="1"/>
<text x="35" y="330" font-family="Segoe UI, Arial, sans-serif"
font-size="11" font-weight="bold" fill="#333">Legend</text>
<line x1="35" y1="348" x2="80" y2="348" stroke="#1565c0" stroke-width="2" stroke-dasharray="7,4"/>
<text x="88" y="352" font-family="Segoe UI, Arial, sans-serif" font-size="10" fill="#333">WiFi / Alpaca (HTTP)</text>
<line x1="35" y1="368" x2="80" y2="368" stroke="#2e7d32" stroke-width="2"/>
<text x="88" y="372" font-family="Segoe UI, Arial, sans-serif" font-size="10" fill="#333">USB / Alnitak (serial)</text>
<line x1="35" y1="388" x2="80" y2="388" stroke="#f9a825" stroke-width="2"/>
<text x="88" y="392" font-family="Segoe UI, Arial, sans-serif" font-size="10" fill="#333">GPIO / PWM signal</text>
<line x1="35" y1="408" x2="80" y2="408" stroke="#e65100" stroke-width="2" stroke-dasharray="5,3"/>
<text x="88" y="412" font-family="Segoe UI, Arial, sans-serif" font-size="10" fill="#333">Power supply (5V)</text>
<text x="35" y="432" font-family="Segoe UI, Arial, sans-serif" font-size="9" fill="#777">
Both WiFi and USB active simultaneously
</text>
<!-- Version / note -->
<text x="430" y="505" text-anchor="middle"
font-family="Segoe UI, Arial, sans-serif" font-size="9" fill="#999">
ESP32 FlatPanel v1.1 — github.com / your-repo
</text>
</svg>

After

Width:  |  Height:  |  Size: 14 KiB