TUESDAY PLAN — Turntable Hacking Updated: 2026-06-30 (Tuesday morning) ======================================================================= MONDAY UART EXPLORATION — COMPLETE, ALL RESULTS ======================================================================= All four STC UART headers tested at 115200 baud (confirmed VCC = 3.3V): UART2 → 0x23 0x23 0x23 ("###") 1Hz heartbeat. No state info. UART3 → 0x23 0x23 0x23 ("###") 1Hz heartbeat. No state info. Same output as UART2 — likely same firmware signal on both. UART4 → Silent. Both middle pins tried. Unused by firmware. UART1 → ISP/bootloader port on P3.0/P3.1. Not located on board. Would require stcgal + power-cycle timing to access. CONCLUSION: ComXim firmware outputs no useful telemetry over any accessible UART. The ### heartbeat is a fixed keepalive only. Also confirmed during testing: - New IR codes captured: CCW=0x41, CW=0x44, Stop/Start=0x42 - UART3 VCC confirmed 3.3V (square via = VCC, leftmost = GND) - HC-08 Bluetooth header present on board but no BT connection exists - Chip under heatsink is almost certainly L298N in POWERSO-20 package (confirmed by: R500 current sense resistor, 35V/470µF bulk cap, large square exposed thermal pad on PCB underside, 4-wire motor connector output, heatsink required for continuous operation) ======================================================================= STC 8H8K64U — VERIFIED DATASHEET SPECS Source: https://www.stcmicro.com/stc/stc8h8k64u.html https://www.stcmicro.com/datasheet/STC8H8K64U_Features.pdf https://www.stcmicro.com/datasheet/STC8H-en.pdf ======================================================================= Flash: 64KB SRAM: 8.2KB (128 direct + 128 indirect + 8192 extended) Operating V: 1.9V – 5.5V UARTs: 4 confirmed — UART1=ISP, UART2/3=### heartbeat, UART4=silent Package: LQFP32 (32-pin, NOT the 64-pin variant) ======================================================================= HARDWARE ASSESSMENT — COMXIM MOTOR DRIVE ======================================================================= From photos (Stepper Heat Sink and Wires.jpg, stepper view under heatsink.jpg, comXim Bottom steppers.jpg): - Single L298N (POWERSO-20) under the large heatsink drives BOTH 50BYJ46-20 motors in parallel from the same H-bridge outputs - Both motors share one 4-pin connector (W/R/B/Y wires) - Motor wire colors: White, Red, Black, Yellow - ComXim needed heatsink because parallel motors double the current For the replacement build: - Use 2× L298N boards (one per motor) — correct decision - Each motor gets its own dedicated H-bridge: no parallel wiring, half the thermal load per board, cleaner independent control - No heatsink needed on HiLetgo boards at slow sweep speeds ======================================================================= STEP 1 — IDENTIFY MOTOR COIL PAIRS (before disconnecting anything) ======================================================================= Tools: digital multimeter set to RESISTANCE (Ω) mode IMPORTANT: Do this before unplugging anything from the ComXim. Both motors have the same 4 wire colors: White, Red, Black, Yellow. There are 6 possible pairs. Exactly 2 will show resistance (the coils). The other 4 will read OL (open circuit / no connection). --- MOTOR 1 READINGS (fill in) --- Pair 1: White — Red = _________ Ω Pair 2: White — Black = _________ Ω Pair 3: White — Yellow = _________ Ω Pair 4: Red — Black = _________ Ω Pair 5: Red — Yellow = _________ Ω Pair 6: Black — Yellow = _________ Ω --- MOTOR 2 READINGS (fill in) --- Pair 1: White — Red = _________ Ω Pair 2: White — Black = _________ Ω Pair 3: White — Yellow = _________ Ω Pair 4: Red — Black = _________ Ω Pair 5: Red — Yellow = _________ Ω Pair 6: Black — Yellow = _________ Ω --- INTERPRETING THE READINGS --- The two pairs that show a resistance value (not OL) are your two coils. Expected coil resistance for 50BYJ46-20 at 15V: roughly 10–30Ω. Both motors should give identical results (same model). Example interpretation: If White–Red = 18Ω and Black–Yellow = 18Ω, all others OL: Coil A = White (+) and Red (-) Coil B = Black (+) and Yellow (-) If White–Yellow = 18Ω and Red–Black = 18Ω, all others OL: Coil A = White (+) and Yellow (-) Coil B = Red (+) and Black (-) The +/- polarity within each coil determines step direction. If the motor runs backwards, swap A+ and A- (or swap B+ and B-) in wiring or invert the step sequence in firmware. Do not guess — note the actual readings above and assign coil labels before wiring. Both motors MUST be wired identically (same color → same L298N output) because they share a gear ring and must always move in lock-step. ======================================================================= STEP 2 — WIRE SINGLE L298N BOARD (both motors in parallel) ======================================================================= DECISION: One L298N drives both motors wired in parallel. REASON: Both motors share the same internal gear ring — they are mechanically locked and must ALWAYS move together. Running them independently would strip the gear profile. This is identical to how the ComXim drove them (single L298N, parallel wiring). CURRENT NOTE: Each 50BYJ46-20 coil draws ~1A at 15V (15V / ~15Ω). Two motors in parallel = ~2A per H-bridge output, at the L298N continuous limit. At slow sweep speeds with discrete steps this is fine — average current is a fraction of peak. The HiLetgo board has a small heatsink; monitor temperature during first test runs. Wiring (both motors share one L298N): Motor 1 Coil A (+) ─┬─→ L298N OUT1 Motor 2 Coil A (+) ─┘ Motor 1 Coil A (-) ─┬─→ L298N OUT2 Motor 2 Coil A (-) ─┘ Motor 1 Coil B (+) ─┬─→ L298N OUT3 Motor 2 Coil B (+) ─┘ Motor 1 Coil B (-) ─┬─→ L298N OUT4 Motor 2 Coil B (-) ─┘ 15V supply → L298N VS (motor power) GND → L298N GND (shared with ESP32 GND) +5V (ESP32 3.3V ok) → L298N VSS (logic power) GPIO assignments (4 pins total): IN1 = GPIO1 IN2 = GPIO2 IN3 = GPIO3 IN4 = GPIO4 (Avoid: GPIO0=boot, GPIO5/6=encoder, GPIO16=IR, GPIO17/18=UART, GPIO19/20=USB, GPIO35-37=PSRAM) L298N ENABLE pins: ENA jumper ON (OUT1/OUT2 always enabled) ENB jumper ON (OUT3/OUT4 always enabled) Remove jumpers later if PWM speed control is added. ======================================================================= STEP 3 — FIRMWARE: ADD STEP SEQUENCER TO src/main.cpp ======================================================================= Full-step sequence for bipolar stepper (4 steps, repeating): Step IN1 IN2 IN3 IN4 0 1 0 1 0 (A+ B+) 1 0 1 1 0 (A- B+) 2 0 1 0 1 (A- B-) 3 1 0 0 1 (A+ B-) Add to main.cpp: - Define 8 GPIO pins (IN1-IN4 for each motor) - Accept serial command: "STEP " where n=steps, dir=1/-1 - Advance both motors in sync one step at a time - Step rate = controlled by delay between steps (speed control) - Keep existing encoder ISR and IR decoder unchanged Serial command format (from Python → ESP32): "STEP 1 1\n" = one step forward "STEP 1 -1\n" = one step backward "STEP 0 0\n" = hold (coils energized, no movement) "RELEASE\n" = de-energize all coils ======================================================================= STEP 4 — PYTHON: slow_sweep_v2.py ======================================================================= Replace IR-based control with direct serial step commands: - Send "STEP 1 1\n" to ESP32 for each microstep - Wait encoder feedback to confirm movement - Same closed-loop logic as slow_sweep.py - No beep listener needed (no ComXim, no audio feedback) - Encoder ISR still on GPIO5/6 — unchanged Step size is now exact: 1 full step = 1.8° / 33 (gear ratio) = 0.055° At 2400 counts/rev encoder: ~0.36 counts per motor step Use encoder to accumulate to target rather than counting motor steps ======================================================================= STEP 5 — TEST SEQUENCE ======================================================================= 1. Power up with motors disconnected — verify GPIO1-4 outputs with DMM 2. Connect both motors in parallel to L298N, apply 15V 3. Manually send step commands from serial terminal, confirm rotation 4. Verify encoder counts increase with each step 5. Confirm both motors move together (listen/feel for sync) 6. Run slow_sweep_v2.py for a short arc (30°), verify accuracy 7. Full revolution test, check L298N temperature after 5 minutes ======================================================================= PRIORITY ORDER FOR TUESDAY ======================================================================= 1. Multimeter coil ID on both motors (before disconnecting ComXim) — fill in the reading tables in Step 1 above 2. Wire both motors in parallel to single L298N (coils to OUT1-4) 3. Wire 15V supply to L298N VS, GND shared with ESP32 4. Wire ESP32 GPIO1-4 to L298N IN1-4 (4 wires) 5. Update src/main.cpp with step sequencer 6. Flash ESP32, test step commands manually via serial 7. Write slow_sweep_v2.py 8. Run test sweep, monitor L298N temperature ======================================================================= REFERENCE ======================================================================= MCU: STC 8H8K64U (LQFP32, 1.9-5.5V, 64KB flash, 8.2KB SRAM) Board: ComXim MTxM_V6.01 — being bypassed Motors: 50BYJ46-20 bipolar steppers (15V, 1:33 gear ratio) x2 Wire colors: White, Red, Black, Yellow Encoder: LPD3806-600BM-G5-24C (600 PPR, 2400 counts/rev) — kept ESP32: ESP32-S3-WROOM-1 N16R8 on /dev/ttyACM0 ATOM S3: IR transmitter on /dev/ttyACM1 — NOT NEEDED, leave unplugged L298N: HiLetgo 4-pack, using 1× (both motors in parallel) Motor supply: 15V. Logic supply: 5V (onboard reg). Max current: 2A continuous per channel (~2A expected at 15V) Monitor temperature during first runs. UART results: UART2=###, UART3=###, UART4=silent, UART1=ISP (untested) STC docs: https://www.stcmicro.com/stc/stc8h8k64u.html stcgal: https://github.com/grigorig/stcgal (if ISP ever attempted) Photos on disk: Stepper Heat Sink and Wires.jpg — motor connector and heatsink stepper view under heatsink.jpg — side view, cap, package type comXim Bottom steppers.jpg — underside thermal pad (L298N) UARTS.jpg — all UART header locations UART3-Investigation.jpg — UART3 pin annotations