Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESP32 + BTS7960 Rotor Controller (Yaesu G-450CDC) – GS-232(A) over Wi-Fi + Setup Portal

This sketch controls a Yaesu G-450CDC (DC motor) via ESP32 and a BTS7960/IBT-2 H-bridge.
It offers a GS-232(A) compatible Telnet interface (Port 23) and convenient service commands (calibration, brakes, filter, park).
New: Integrated Wi-Fi setup portal (AP + Captive portal) on first boot or if Wi-Fi fails.
New (2025): Multiple board support via build flags:

  • Classic ESP32 (DevKit / WROOM)
  • ESP32-C3 DevKitM-1
  • ESP32-C3 SuperMini

Wi-Fi Setup Portal

  • Starts automatically if no Wi-Fi credentials are stored or if connection fails within 20s.
  • The ESP32 opens an access point:
    • SSID: Rotor-Setup-XXXX (XXXX = last 2 MAC bytes)
    • Password: rotor1234
    • Portal: http://192.168.4.1 (captive portal via DNS redirect)
  • Enter SSID and password → stored in NVS → reboot → connect as STA.

The portal provides Wi-Fi scan, save, and reset functions.


Features

  • GS-232(A) over TCP (Telnet, Port 23) – compatible with HRD, PstRotator, rotctl, etc.
  • Azimuth control 0–360° or 0–450° (shortest path via 0°).
  • Soft start/stop, dead time when changing direction.
  • Brake modes:
    • B0 coast (free run)
    • B1 active brake (short circuit)
    • B2 PWM brake (gentle counter torque; recommended)
  • Park function (P, Pxxx)
  • Calibration (M adcMin adcMax) and angle range (L 0 360 / L 0 450)
  • Configurable ADC filter (F n samples) for stable position readings.
  • Persistent config: All settings stored in NVS (Preferences).

Hardware

  • ESP32 / ESP32-C3 (Arduino core)
  • BTS7960 / IBT-2 H-bridge motor driver (6–27 V, MOSFET, 3.3 V logic compatible)
  • Yaesu G-450CDC rotor (4-wire: 2x motor, 2x potentiometer)
  • 20–24 V DC power supply (fused) for motor

Pin Mapping by Board

Signal ESP32 Classic ESP32-C3 DevKitM-1 ESP32-C3 SuperMini
RPWM (CW) GPIO 25 GPIO 6 GPIO 4
LPWM (CCW) GPIO 26 GPIO 7 GPIO 5
R_EN GPIO 27 GPIO 4 GPIO 2
L_EN GPIO 14 GPIO 5 GPIO 3
ADC (pot) GPIO 34 GPIO 1 GPIO 0
Force AP GPIO 0 (BOOT) GPIO 9 (BOOT) GPIO 9 (BOOT)

Software – Build & Upload

PlatformIO

Board selection is done in platformio.ini via build_flags:

Build & upload with:

pio run -t upload -e esp32c3supermini

Quick Start

  1. Connect to AP Rotor-Setup-XXXX (password: rotor1234).
  2. Open http://192.168.4.1 → enter your Wi-Fi credentials → save.
  3. ESP32 reboots, connects as STA, starts GS-232 server on port 23.
  4. Test via Telnet: telnet <esp32-ip> 23.
  5. Send commands: C, A090, S, etc.

GS-232(A) + Service Commands

Standard GS-232

Command Description Example
C Report current azimuth AZ123 EL000
Axxx Rotate to azimuth xxx (000–360/450) A090
W<az> <el> Rotate to az only (EL ignored) W180 000
S Stop motion S

Extensions

Command Description Example
P Rotate to stored park position P
Pxxx Set new park pos & rotate immediately P180
M <min> <max> Calibrate ADC raw range M 123 4012
L <min> <max> Set logical azimuth range (360/450) L 0 360
B0/B1/B2 Brake mode (coast, active, PWM) B2
BP <val> PWM brake power (0..1023) BP 600
BT <ms> Brake time in ms BT 400
B? Report brake config B2 BP=600 BT=400
F <n> ADC filter window (1..64 samples) F 8
F? Report current filter F=8
R Report full config R

Safety Notes

  • Rotor has mechanical end stops – software limits are logical only.
  • Use twisted pair wiring for motor lines, add ferrite cores if possible.
  • Adjust PWM brake gently to avoid mechanical stress.
  • Separate supply for ESP32 (5 V) and motor recommended, GND tied together.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages