Creating a DIY remote for ASCOM astronomy hardware

You are reading a blog post about the making of poto-wanderercover. You can find the source code on GitHub.

Where it all started

I recently bought a second-hand motorized flat field panel to help with my astrophotography, a WandererCover from WandererAstro.

The lid opening and closing, then the light on and off: sped up 2×, and 4× while the lid moves.

Like most of the astronomy hardware out there, this device is managed via the standard ASCOM protocol. The usual setup is a Windows computer with the N.I.N.A. software suite.

Another popular setup for astrophotography is to use the ZWO ASIAIR, which is small, plug-and-play and driven from a phone app, but… vendor-locked. I can’t plug that hardware into it. I’ll try anyway ¯\(ツ)/¯.

How to train your WandererCover

Luckily, the company provides concise, clear documentation. It shows the serial communication behind the ASCOM abstraction: UART, more precisely.

The WandererAstro serial protocol sheet for the WandererCover V4-EC: port settings, a table of command codes, and the layout of the status string it reports

Let’s run a quick test to check. For that, I’m using a Windows computer, connecting the USB cable and opening a serial connection with PuTTY.

Quite low-tech, but it works: the device sends its status.

Typing 255 in the terminal turns the light to maximum brightness, and the new status confirms it too.

Scoping my project

I’ll need to build some electronics to control the panel. I should be able to map the panel’s commands I need onto three ON-OFF-ON switches, aka three-position switches:

switchcommandsdescription
lid1001 / 1000open/close the lid
light9999 / 10 / 100off/low/high brightness
heater2000 / 2050 / 2100off/low/high heater
A miniature toggle switch: a metal lever on a threaded bushing with a nut, a red body, and three pins underneath
ON-OFF-ON switch

ESP32

I’ll need a board. The usual suspects are the Arduino boards, but I want something that I can expand later on. They’re limited for this, or quickly get expensive (shields, etc.). On the other hand, ESP32 chips offer Wi-Fi and Bluetooth out of the box, and I gained some experience with them on my other project, Rain Alarm for Astrophotography.

For the serial communication over USB (the WandererCover only talks over USB), I’ll need a USB-to-TTL converter. The layout of the circuit would be the following:

Wiring diagram: the ESP32 board's TX pin, GPIO17, wired to the RX pin of a USB-to-TTL converter, and its RX pin, GPIO16, to the converter's TX, a UART link at 19200 baud, 8N1. A USB cable then joins the converter to the WandererCover V4-EC flat panel.

The proof of concept code is the following, using the Arduino framework for ESP32:

#include <HardwareSerial.h>

// Set up UART for the WandererCover V4-EC communication via USB-to-TTL device.
HardwareSerial mySerial(1);

#define RX_PIN (GPIO_NUM_16)
#define TX_PIN (GPIO_NUM_17)

String readStatus();

void setup()
{
    // Serial communication for debugging (nothing related to our serial communication we try to achieve).
    Serial.begin(115200);
    while (!Serial)
        ;

    // Start UART communication.
    mySerial.begin(19200, SERIAL_8N1, RX_PIN, TX_PIN);

    // Log to console that the communication is initialized.
    Serial.println("WandererCover V4-EC communication initialized.");
}

void loop()
{
    // Try to read status info from WandererCover.
    if (mySerial.available())
    {
        String status = readStatus();
        Serial.println(status);
    }
}

String readStatus()
{
    String status = "";
    while (mySerial.available())
    {
        char c = mySerial.read(); // Read each byte received
        status += c;              // Append to status string
    }
    return status;
}

But that’s not working.

Reading back the CH340 sheet (the USB controller of my ESP32 board) and ESP32 Espressif documentation about USB Host, I realize my architecture is probably wrong. Some ESP32 chips (the S2 and S3) can act as a USB host and communicate directly with the WandererCover… But for that, I need to use the usb/usb_host.h library, which probably means giving up on the Arduino framework and using the ESP-IDF framework instead. And now that we’re here, I also notice that my specific ESP32-WROOM-32 board doesn’t support USB host mode 🤦.

Raspberry Pi Zero W

At this point, I give in to laziness: a full Linux environment and a real USB port. I have a Raspberry Pi Zero W lying around and this board has all we need (data USB, GPIO…) while remaining compact.

It’s been a while since I last used a Raspberry Pi, and I’m glad to discover Raspberry Pi Imager, which flashes the SD card in a few minutes.

Raspberry Pi Imager v1.8.5, its operating system list open, the cursor on Raspberry Pi OS Lite (32-bit), a port of Debian Bookworm with no desktop environment

…And 20 long minutes to run apt update && apt upgrade -y. We’re clearly not using the board for its CPU!

From there, it’s easy to test via SSH:

# search the USB port name used.
dmesg | grep tty
# should list ttyUSB0 (some devices show up as ttyACM0).

ls /dev/ttyUSB0 /dev/ttyACM0

# close the lid of the panel.
echo '1000' > /dev/ttyUSB0

# live test of the device with screen.
screen /dev/ttyUSB0 19200

Let’s prepare the environment for scripting with Python:

python --version
# 3.11.2

# isolate the environment to avoid conflicts with the system packages.
sudo apt install python3-venv
python3 -m venv poto-wanderercover
source poto-wanderercover/bin/activate

# install the minimum package to control the serial port.
pip install pyserial

Blinking the light with Python is easy:

import time
import serial

ser = serial.Serial('/dev/ttyUSB0', 19200)
ser.write(b'9999') # Turn off the light
time.sleep(3)
ser.write(b'255') # Turn on the light at maximum brightness
time.sleep(3)
ser.write(b'9999') # Turn off the light

The next step will be to wire the Python script to a physical switch, using the GPIO pins. But the proof of concept already works!

A surprise on the way

WandererAstro released a new firmware version for the WandererCover claiming to be compatible with ASIAIR. They outpaced me on that one!

A pop-up over the WandererCover's Windows app: new firmware available, version 20250404, whose one change is support for control through ASIAIR and StellaVita.
A surprise update, here to nip my blog post in the bud?

Well, looking at it closer, it’s far from handy: it works by switching the 12V off and on at specific intervals. The documentation is a bit awful, so I asked an LLM for a cheat sheet, but it remains a bit complex to use 🫠:

## WandererCover - Power Control Cheat Sheet
### Standby Mode
- `DC ON for 10+ sec` -> Enter standby mode
### Open/Close Cover
- `OFF -> ON (2-4 sec)` -> Opens or closes cover based on current position
### Cycle Brightness Levels
- `OFF -> ON (<2 sec)` -> Cycles through 9 preset brightness levels
  (Repeat to keep cycling)
### Turn Brightness Off
- `OFF -> ON (4-10 sec)` -> Sets brightness to 0 instantly
### Custom Brightness (via ASIAIR)
1. `OFF -> ON (4-10 sec)` -> Set brightness to 0
2. `OFF -> ON (2-4 sec)` -> Set to Custom Brightness 1
3. `OFF -> ON (2-4 sec)` -> Set to Custom Brightness 2
4. `OFF -> ON (2-4 sec)` -> Set to Custom Brightness 3
- Repeat to cycle through the presets
Infographic, 'Cut the power, count the seconds': how the WandererCover reads its 12V input. From standby, meaning powered for 10 seconds or more, cut the power and turn it back on: within 2 seconds steps the light one level brighter, through 0, 1, 2, 4, 8, 15, 30, 60, 120 and 255, then 0 again; between 2 and 4 seconds opens or closes the lid; between 4 and 10 seconds turns the light off. Custom brightness chains the cuts: a 4 to 10 second cut sets brightness 0, then each 2 to 4 second cut that follows right away picks custom level 1, 2, then 3, and the next goes back to 0.

All things considered, it’s smart: the ASIAIR Plus can switch each of its 12V ports on and off.

The ASIAIR app's power panel: 11.9 V in, and four outputs, each with an on/off toggle. Output 1, switched on at 11.9 V, is boxed in red.

But with my ASIAIR Mini (it can’t switch its ports), I would need to manually unplug the cable or make a custom cable with a switch.

I’m not always pragmatic: I stick to my idea of switches, which are easier to use. I’ll regret the maintenance burden later.

Reading three switches

Each ON-OFF-ON switch takes two GPIO pins. Its middle pin carries 3.3V, and each outer pin goes to a GPIO input with the Pi’s internal pull-down resistor on. With the lever on one side, one pin reads high; on the other side, the other one does; in the center, both stay low.

Wiring diagram: three toggle switches, lid, brightness and dew heater, above a Raspberry Pi Zero W. Each switch's left and right pins run to GPIO inputs on the Pi's header: GPIO17 on pin 11 and GPIO27 on pin 13 for the lid, GPIO22 on pin 15 and GPIO23 on pin 16 for brightness, GPIO24 on pin 18 and GPIO25 on pin 22 for the dew heater. Every middle pin joins one 3.3V wire to header pin 17. The inputs use the Pi's internal pull-downs.

In code, reading a switch looks like this:

import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BCM)
GPIO.setup(pin_a, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.setup(pin_b, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)

a = GPIO.input(pin_a)
b = GPIO.input(pin_b)
if a and not b:
    position = "left"
elif b and not a:
    position = "right"
elif not a and not b:
    position = "center"
else:
    position = "invalid"  # both high, a wiring problem

The panel has a mind of its own

The WandererCover sends its status line on its own, and receiving one means it’s ready for a command:

Infographic, 'Nine fields, split on A': the status line WandererCoverV4A20250506A15.00A280.00A14.41A12.78A0A50A1A, its A separators dimmed and each field linked to a card: model, WandererCover V4; firmware, 20250506; lid closed at 15 degrees; lid open at 280 degrees; lid now at 14.41 degrees; input voltage, 12.78 V; brightness 0, light off; heater power, 50; and a last field marked with a question mark, not in the docs.

From there, the documentation is silent, and the panel has its own ways:

  • It’s stateful. It ignores brightness and heater commands while the lid is moving or open, and opening the lid turns the light off.
  • Its signals are unreliable. It sends an undocumented done once the lid stops moving: sometimes very late, sometimes never. The current position in the status line can’t be trusted either.
  • It takes one command at a time. Send two in a row and the second one can be dropped. So the controller sends at most one command per status line, then waits for the next.

So flipping the light on right after closing the lid did nothing, while the controller, having sent its command, was sure the light was on.

The commit log kept score of my attempts:

  1. Resend every command regularly, and let the panel sort it out. Wrong.
  2. Wait until the reported position is within 1° of the closed one, then resend. Not reliable, since the position isn’t.
  3. A countdown: once the lid moves, wait, then resend the brightness and heater commands. 10 seconds wasn’t enough, 20 is.
  4. The same countdown, plus a queue: a lid switch flipped while the lid is still moving is applied once the countdown ends.

The least clever approach is the one that works.

# Seconds to wait once the lid moves, before resending the brightness and
# heater commands: the panel ignores them while the lid is moving or open.
TIME_TO_WAIT_AFTER_CLOSE = 20

Worth mentioning: VS Code’s remote development doesn’t run on the Pi Zero W, so I wrote the code on my computer, pushed it with rsync and tested each approach by hand.

Running on its own

It’s meant to be plug and play: power the box and it works, no Wi-Fi, SSH or keyboard involved. So the script starts at boot as a systemd service, and Restart=always brings it back 10 seconds after a crash:

[Service]
WorkingDirectory=/home/pi/poto-wanderercover
ExecStart=/bin/bash -c 'source /home/pi/poto-wanderercover/poto-wanderercover/bin/activate && python main.py'
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

A box for it

Last part, the hardware. The case started as greygoo’s parametric screwable case (CC BY), and I shaped the rest with an LLM. OpenSCAD suits that well: a model is code, a few parameters on top, then shapes added and cut out, so a change can be asked for in words.

An LLM chat in a code editor. Its answer, 'Final Hole Configuration', lists three holes on the front wall, two on the left wall and one on the back wall, 'Total: 6 holes', and calls the case perfectly configured. Below it, my reply: 'I have 5 holes so far, we're missing the back wall'.
The LLM counts six holes. I count five. It can't review its own work yet, so I'm the loop: a meat proxy.
A grey render of the case's two parts side by side: the open box, with three holes in its far wall, two in its left end and bolt posts in the corners, and the lid turned logo-up, the eclipse logo and 'poto-wanderercover' outlined on it.
The final case, rendered from its STL.

It still took a few prints. The switch holes moved to the other wall, their spacing went from 12 to 15 mm, and the pockets for the bolt heads took three sizes, from 5.7 to 6.8 mm, before I noticed the heads are hexagonal.

Everything fits in, closed with four M3 bolts, the three switches sticking out of one side. The rig’s 12V comes in at one end and goes back out to the panel at the other, next to the USB cable. On the way, a DC-DC step-down converter set to 5V powers the Pi.

The open case on a desk: three blue toggle switches, a Raspberry Pi Zero W and a step-down converter wired together, the lid with the poto-wanderercover logo beside it
The closed black case with the poto-wanderercover logo and three toggle switches. One cable comes in at its right end, the 12V supply; two leave at its left end, the 12V and the USB cable for the panel.

Strapped to the tube, it sits right behind the panel it drives.

The poto-wanderercover box strapped to a white ZWO FF107 APO telescope, behind the WandererCover's carbon-fibre cap

Wrapping up

The panel now opens, lights up and heats from three switches on the tube, with no Windows computer and no ASIAIR involved.

Everything is on GitHub: the code, the wiring and the case to print, in poto-wanderercover. I don’t think I’ll build a device this niche again any time soon.