This is a replacement firmware for the Svbony SV241 Pro. DISCLAIMER: This firmware is provided "as-is" without any warranty. Use it at your own risk. The author is not responsible for any damage to your device.
This is a hobby project. If you find it useful and would like to support a good cause, consider donating via betterplace.org—all donations go directly to Doctors Without Borders.
- Project Overview
- Quick Start Guide
- The ASCOM Alpaca Proxy
- Advanced: Serial Command Interface
- Troubleshooting
This project consists of two main components:
- Custom Firmware: A replacement firmware for the ESP32-based Svbony SV241 Pro controller. It unlocks advanced control over power outputs and dew heaters.
- ASCOM Alpaca Proxy: A standalone application that runs on your computer. It connects to the controller via USB and exposes its functions as standard ASCOM devices. It should work with any ASCOM Alpaca compatible astronomy software (tested with NINA, validated with Conform Universal). For software without native Alpaca support, the installer includes a helper script to register a classic ASCOM driver (see Driver Installation).
- Control for 5 DC outputs, 2 USB groups, and 1 adjustable voltage output (0-15V, powered by a Southchip SC8903 buck-boost converter).
- Advanced dew heater control:
- Manual Mode: Variable 0-100% PWM control.
- PID Mode: Automatic temperature regulation using a lens temperature sensor and configurable target temperature above dew point.
- Ambient Tracking: Sensorless power adjustment based on ambient temperature and humidity.
In PID Mode, the controller automatically adjusts heater power to maintain the lens temperature at a safe level above the dew point:
- Lens Temp: The current temperature of the lens, measured by an external sensor.
- Target Temp / Minimum Temp: The desired temperature offset above the ambient dew point. A typical value is 3-5°C.
The controller calculates the dew point from ambient temperature and humidity, adds the target offset, and adjusts heater power to maintain that temperature.
Important: The lens temperature sensor (labeled TEMP on the SV241) must be positioned under or adjacent to the dew heater strap. This ensures the sensor measures the heated area and provides accurate feedback for the PID controller.
- On-board sensor suite for monitoring power, ambient temperature/humidity, and lens temperature. The firmware is resilient to sensor failures.
- Experimental automatic drying cycle for the SHT40 humidity sensor.
- Configuration persistence across reboots.
- A powerful JSON-based serial command interface for direct control and integration.
Follow these steps to get up and running quickly.
- Download the latest installer (
SV241-AscomAlpacaProxy-Setup-x.x.exe) from the project's releases page. - Run the installer. It's recommended to allow the proxy to start automatically with Windows.
- Once running, an icon will appear in your system tray. Right-click it and select "Open Setup Page" to access the web interface.
Note: The web flasher requires a modern browser with Web Serial API support (Chrome or Edge).
On first startup, the proxy will display a First-Run Wizard that guides you through the firmware installation:
- Connect the SV241 controller to your computer via USB.
- The wizard will automatically check for compatible firmware.
- If no firmware is detected, click "Flash Firmware" to open the integrated web flasher.
- Select the correct COM port and follow the on-screen instructions.
Warning: Make sure you select the correct COM port! If you have other ESP32 devices connected, their firmware will be overwritten without further confirmation.
Alternative: Use the standalone SV241-Unbound Web Flasher directly.
- Open your ASCOM-compatible astronomy software (e.g., NINA).
- Go to the equipment or hardware section.
- When choosing a Switch or ObservingConditions device, open the ASCOM chooser.
- You should see "SV241 Power Switch" and "SV241 Environment" listed under the Alpaca section. Select them.
You can now control the power outputs and read sensor data directly from your main software!
The proxy application is a crucial part of the system, translating the device's serial commands into standard ASCOM Alpaca APIs. It runs on your computer, connects to the controller via USB, and exposes its functions to astronomy software.
It includes features like auto-detection and custom ASCOM actions.
Key Features:
- Rich Web Interface: A modern, responsive dark-themed dashboard for full control and configuration.
- Telemetry History: Built-in interactive charts for analyzing power and environmental data over time.
For detailed information on its features, configuration, and usage, please see the dedicated documentation:
ASCOM Alpaca Proxy Documentation
Click to expand the detailed Serial Command Reference
The controller communicates over serial at 115200 baud. Commands are sent as JSON strings, terminated by a newline character (\n).
Important: All JSON commands must be sent as a single, continuous line of text without any line breaks, followed by a single newline character (
\n) to execute the command.
- Request:
{"get": "sensors"} - Response: A JSON object with the latest sensor readings.
v: Input Voltage (V),i: Input Current (mA),p: Input Power (W)t_amb: Ambient Temp (°C),h_amb: Ambient Humidity (%),d: Dew Point (°C)t_lens: Lens Temp (°C),pwm1/pwm2: Heater Power (%)hf,hmf,hma,hs: Heap memory statistics (Bytes)
- Request:
{"get": "status"} - Response: A JSON object with the on/off state (
1/0) of all outputs.- Example:
{"status":{"d1":1,"d2":1,"d3":0,...},"dm":[0,1]} dm: Dew heater modes array (0: Manual, 1: PID, 2: Ambient Tracking, 3: PID-Sync, 4: Min Temp, 5: Disabled)
- Example:
- Request:
{"set": {"<output_name>": <state>, ...}} <output_name>:d1-d5,u12,u34,adj,pwm1,pwm2, orall.<state>:1ortruefor ON,0orfalsefor OFF.- Response: The new power status JSON, reflecting the state after the change has been applied.
- Reboot:
{"command": "reboot"} - Factory Reset:
{"command": "factory_reset"} - Manual Sensor Drying:
{"command": "dry_sensor"}- Triggers the SHT40 internal heater to remove condensation. This is a blocking operation.
- Get Firmware Version:
{"get": "version"}- Response: A JSON object containing the firmware version (e.g.,
{"version": "1.0.0"}).
- Response: A JSON object containing the firmware version (e.g.,
- Get Config Request:
{"get": "config"} - Set Config Request:
{"sc": { ... }} - Response (for both): The complete configuration JSON, reflecting the state after the change has been applied.
- Parameter Breakdown: The body of the request is a JSON object containing one or more of the following top-level keys. You only need to send the keys for the settings you wish to change.
For numerical parameters without explicit ranges, typical values are expected. Refer to the firmware's source code for precise limits if needed.
| Key | Description | Value Type |
|---|---|---|
so |
Sensor Offsets: Sets calibration offsets for sensor readings. | object |
ui |
Update Intervals: Sets the update frequency for sensors. | object |
ps |
Power Startup: Defines the on/off state of outputs at boot. | object |
ac |
Averaging Counts: Controls the samples for the median filter. | object |
av |
Adjustable Voltage: Sets the preset voltage for the converter. | float |
ad |
Auto Dry: Configures the automatic sensor drying feature. | object |
dh |
Dew Heaters: Configures the two dew heaters. | array |
| Sub-Key | Description | Value Type |
|---|---|---|
st |
SHT40 Temperature offset (°C) | float |
sh |
SHT40 Humidity offset (%) | float |
dt |
DS18B20 Temperature offset (°C) | float |
iv |
INA219 Voltage offset (V) | float |
ic |
INA219 Current offset (mA) | float |
| Sub-Key | Description | Value Type |
|---|---|---|
i |
INA219 (Power) interval (ms) | unsigned long |
s |
SHT40 (Ambient) interval (ms) | unsigned long |
d |
DS18B20 (Lens) interval (ms) | unsigned long |
| Sub-Key | Description | Value Type |
|---|---|---|
d1-d5 |
Startup state for DC Outputs 1-5 | boolean |
u12 |
Startup state for USB Group 1/2 | boolean |
u34 |
Startup state for USB Group 3/4/5 | boolean |
adj |
Startup state for the Adjustable Voltage Converter | boolean |
| Sub-Key | Description | Value Type |
|---|---|---|
st |
Sample count for SHT40 temperature | int |
sh |
Sample count for SHT40 humidity | int |
dt |
Sample count for DS18B20 temperature | int |
iv |
Sample count for INA219 voltage | int |
ic |
Sample count for INA219 current | int |
| Sub-Key | Description | Value Type |
|---|---|---|
en |
Enable the auto-dry feature (true/false). |
boolean |
ht |
Humidity Threshold: The humidity (%) above which the trigger timer starts (e.g., 99.0). |
float |
td |
Trigger Duration: The time in seconds the humidity must stay above the threshold to trigger the heater (e.g., 300 for 5 minutes). |
unsigned long |
This is an array that can contain up to two heater configuration objects. To update a specific heater, you place its configuration object at the corresponding index (0 for PWM1, 1 for PWM2).
Common Heater Properties:
| Key | Description | Value Type |
|---|---|---|
n |
Name of the heater (e.g., "PWM1"). This is read-only. | string |
en |
Enabled on startup: true to enable the heater on boot. |
boolean |
m |
Mode: Sets the control mode for the heater (0: Manual, 1: PID, 2: Ambient Tracking, 3: PID-Sync, 4: Minimum Temperature, 5: Disabled). | int |
Mode-Specific Properties:
-
Mode 0: Manual
Key Description Value Type mpManual Power (0-100%). int(0-100) -
Mode 1: PID (Lens Sensor)
Key Description Value Type toTarget Offset: Desired temperature difference above the dew point (e.g., 3.0for 3°C warmer).floatkpProportional gain: Reacts proportionally to the current temperature error. Higher values lead to a stronger, faster reaction. doublekiIntegral gain: Accumulates past errors to correct small, constant offsets over time. Helps eliminate steady-state errors. doublekdDerivative gain: Reacts to the rate of temperature change. Helps to dampen overshoot and oscillations. double -
Mode 2: Ambient Tracking (Sensorless)
Key Description Value Type sdStart Delta: Temp difference (Ambient - Dew Point) at which heating begins. floatedEnd Delta: Temp difference at which the heater reaches its maximum configured power. floatxpMax Power (0-100%): The maximum power the heater is allowed to use in this mode. int(0-100) -
Mode 3: PID-Sync (Follower) This mode allows a heater (the "follower") to mirror the power output of another heater running in PID mode (the "leader"). It is ideal for a guidescope heater that should follow the main scope's heater without needing its own sensor.
Key Description Value Type psfPID Sync Factor: A multiplier for the leader's power (e.g., 0.8means the follower runs at 80% of the leader's power).float -
Mode 4: Minimum Temperature This mode works like PID mode, but ensures the lens temperature never drops below a configured minimum, regardless of the dew point.
Key Description Value Type toTarget Offset: Desired temperature difference above the dew point (same as PID mode). floatmtMinimum Temperature: The absolute minimum lens temperature to maintain (e.g., 5.0for 5°C).floatkp,ki,kdPID tuning parameters (same as Mode 1). double -
Mode 5: Disabled This mode completely disables the heater output and hides it from the ASCOM interface. Useful if you don't use one of the heater channels.
-
Examples:
-
Change Adjustable Converter Voltage:
{"sc": {"av": 9.5}} -
Set Heater 1 (PWM1) to Manual 50% power:
{"sc": {"dh": [{"m": 0, "mp": 50}]}}(Note:
[{"m":...}]targets the first heater. The array index matters.) -
Configure Heater 2 (PWM2) for Ambient Tracking:
{"sc": {"dh": [null, {"m": 2, "sd": 6.0, "ed": 1.5, "xp": 75}]}}(Note:
nullis used as a placeholder to indicate that Heater 1's configuration should not be changed.) -
Comprehensive Example: Change multiple settings at once: This example sets the startup state for DC1 to ON, changes the voltage preset, and configures Heater 1 for PID control.
{"sc":{"ps":{"d1":true},"av":8.5,"dh":[{"m":1,"to":2.5,"kp":150}]}}
-
You can send commands directly to the controller via PowerShell without the proxy. Replace COM9 with your actual COM port.
Generic Template:
$port = New-Object System.IO.Ports.SerialPort "COM9", 115200
$port.Open()
$port.WriteLine('{"get": "sensors"}') # Your command here
Start-Sleep -Milliseconds 200
$port.ReadExisting()
$port.Close()Example: Read Sensor Data
$port.WriteLine('{"get": "sensors"}')
# Response: {"v":12.8,"i":802,"p":10.3,"t_amb":18.5,"h_amb":65,...}Example: Turn DC1 On
$port.WriteLine('{"set": {"d1": true}}')
# Response: {"status":{"d1":1,"d2":0,...}}Example: Set Heater 1 to Manual 50%
$port.WriteLine('{"sc": {"dh": [{"m": 0, "mp": 50}]}}')
# Response: Full config JSONTip: For interactive testing, use a serial terminal like PuTTY (115200 baud) or the Arduino IDE Serial Monitor.
Hardware SV241 Pro
- Model: ESP32-PICO-D4 (Espressif Systems)
- Architecture: Xtensa LX6 Dual-Core up to 240 MHz
- Flash Memory: 4 MB Embedded
- Connectivity: Wi-Fi / Bluetooth (Hardware capability only; software uses USB-only communication)
| GPIO | Function | Description |
|---|---|---|
| 12 | DC2 | 12V Switched Output |
| 13 | DC1 | 12V Switched Output |
| 14 | DC3 | 12V Switched Output |
| 18 | USB 3/4/5 | USB-A Ports |
| 19 | USB-C 1/2 | USB-C Ports |
| 21 | I2C SDA | Data Line (Sensors) |
| 22 | I2C SCL | Clock Line (Sensors) |
| 23 | OneWire | DS18B20 Lens Sensor |
| 25 | Adj. Voltage | PWM for Southchip SC8903 (Adjustable Output) |
| 26 | DC5 | 12V Switched Output |
| 27 | DC4 | 12V Switched Output |
| 32 | PWM2 | Dew Heater 2 |
| 33 | PWM1 | Dew Heater 1 |