Skip to main content

Sub-GHz RF Studio Power Automation

Sub-GHz RF Studio Power Automation (pikvm-studio)

This page details the wireless sub-GHz RF power control infrastructure in the studio, including the hardware transceiver, mathematical reverse-engineering of the 33-bit Princeton/Fosmon PWM protocol, complete device payload database, and CLI controller.


1. Hardware & Physical Setup

All lighting, outboard gear racks, monitor speakers, and peripherals in the studio are switched via 433.92 MHz RF wireless power relays controlled by a dedicated transceiver plugged into pikvm-studio.

  • Host Node: pikvm-studio (PiKVM V4 Plus, Raspberry Pi 4 Model B, Arch Linux ARM)
  • Transceiver: Great Scott Gadgets YARD Stick One
  • USB ID: 1d50:605b (OpenMoko / GSG RfCat CC1111)
  • Antenna: Sub-GHz vertical SMA whip antenna
  • Carrier Frequency: 433.92 MHz
  • Modulation: ASK / OOK (Amplitude Shift Keying / On-Off Keying)
+--------------------------------------------------------------------------------+
| Host: pikvm-studio (Arch Linux ARM)                                            |
|                                                                                |
|  [ studio-power CLI ] ---> [ RfCat / rflib ] ---> [ YARD Stick One (CC1111) ]  |
+-----------------------------------------------------------------------|--------+
                                                                        | 433.92 MHz ASK/OOK
                                                                        | (33-bit PWM)
                                                                        v
+------------------+  +------------------+  +------------------+  +------------------+
| Moroccan Lamp    |  | Recording Rack   |  | Studio Computer  |  | Subwoofer        |
| (Fosmon Outlet)  |  | (Fosmon Outlet)  |  | (Fosmon Outlet)  |  | (Fosmon Outlet)  |
+------------------+  +------------------+  +------------------+  +------------------+
+------------------+  +------------------+  +------------------+
| Main PA Speakers |  | TV Monitor       |  | Neewer LED Panels|
| (Fosmon Outlet)  |  | (Fosmon Outlet)  |  | (Fosmon Outlet)  |
+------------------+  +------------------+  +------------------+

2. Protocol Specification (Princeton / Fosmon 33-Bit PWM)

The wireless relays in the studio use the 33-bit Princeton / Fosmon Pulse-Width Modulation (PWM) encoding over a 433.92 MHz ASK/OOK carrier.

Timing & Waveform Structure

  • Fundamental Clock Tick Period ($T_e$): $291.75,\mu\text{s}$ ($\approx 3428\text{ baud}$)
  • Bit Symbol 0:
    • $1 T_e$ High ($292,\mu\text{s}$)
    • $3 T_e$ Low ($875,\mu\text{s}$)
    • OOK Bitstream Pattern: 1000 (4 ticks / $1.167\text{ ms}$)
  • Bit Symbol 1:
    • $3 T_e$ High ($875,\mu\text{s}$)
    • $1 T_e$ Low ($292,\mu\text{s}$)
    • OOK Bitstream Pattern: 1110 (4 ticks / $1.167\text{ ms}$)
  • Sync Pulse:
    • $1 T_e$ High ($292,\mu\text{s}$)
    • $31 T_e$ Low ($9044,\mu\text{s}$)
    • OOK Bitstream Pattern: 1 + 31 zeros (32 ticks / $9.336\text{ ms}$)
Bit '0':  +---+
          |   |___________________   (1 tick high, 3 ticks low)
          <Te><------ 3Te ------->

Bit '1':  +---------------+
          |               |_______   (3 ticks high, 1 tick low)
          <----- 3Te ----><--Te-->

Sync:     +---+
          |   |____________________________________________________  (1 tick high, 31 ticks low)
          <Te><---------------------- 31Te ----------------------->

Complete Frame Composition

Each command transmission consists of: $$\text{Frame} = 33 \text{ data bits} \times 4 \text{ ticks} + 32 \text{ sync ticks} = 164 \text{ ticks} = 47.85\text{ ms}$$

Transmissions are repeated 5 to 10 times consecutively to guarantee reliable reception across physical barriers.


3. Studio Device Payload Database

Every studio outlet has a dedicated 33-bit code for ON and OFF. Below is the complete, mathematically decoded bitstream database:

Device Key Device Name Description & Safety Notes State 33-Bit Binary Bitstream Hex Payload
mrc Moroccan Lamp Decorative ambient studio lighting ON
OFF
110100001100000100001011011110100
110100001100000100001010011110110
0x1a18216f4
0x1a18214f6
rack Recording Rack Preamp rack, compressors, FireWire interfaces ON
OFF
001011011010100100001011100110000
001011011010100100001010100110010
0x5b521730
0x5b521532
computer Studio Computer DAW PC power outlet (requires PiKVM wake) ON
OFF
001011011010100100001101100111110
001011011010100100001100100111100
0x5b521b3e
0x5b52193c
sub Subwoofer Studio active subwoofer monitor ON
OFF
010110100111010000001101000111000
010110100111010000001100000111010
0xb4e81a38
0xb4e8183a
pa Main PA Speakers Main active monitor speakers ON
OFF
010110100111010000001011000110100
010110100111010000001010000110110
0xb4e81634
0xb4e81436
tv TV Monitor Studio display monitor & Chromecast ON
OFF
010110100111010000001111000111100
010110100111010000001110000111110
0xb4e81e3c
0xb4e81c3e
neewer Neewer LED Lights Video and photography LED studio lighting ON
OFF
001010010110011000001111010101110
001010010110011000001110010101100
0x52cc1eae
0x52cc1cac

4. Signal Synthesis Implementation (Python)

To generate and transmit any command from scratch using rflib:

#!/usr/bin/env python3
import sys, time
sys.path.insert(0, "/tmp/rfcat")
import rflib

def synthesize_pwm(bit_string):
    """Converts a 33-bit code into a mathematically pure 3428-baud OOK payload."""
    raw_bits = ""
    for bit in bit_string:
        if bit == '1':
            raw_bits += "1110"
        elif bit == '0':
            raw_bits += "1000"
    # Append Sync: 1 tick high, 31 ticks low
    raw_bits += "1" + ("0" * 31)
    
    # Pad to byte boundary
    while len(raw_bits) % 8 != 0:
        raw_bits += "0"
        
    return bytes(int(raw_bits[i:i+8], 2) for i in range(0, len(raw_bits), 8))

def send_signal(bit_string, repeats=10):
    payload = synthesize_pwm(bit_string)
    d = rflib.RfCat()
    d.setFreq(433920000)
    d.setMdmModulation(rflib.MOD_ASK_OOK)
    d.setMdmDRate(3428)
    d.setMdmSyncMode(0)
    d.setMaxPower()
    d.RFxmit(payload * repeats)
    d.cleanup()

# Example: Turn ON Moroccan Lamp
send_signal("110100001100000100001011011110100", repeats=10)

5. CLI Tool: studio-power

The utility is permanently installed on pikvm-studio at /usr/local/bin/studio-power.

Command Syntax

# Toggle individual devices:
$ sudo studio-power mrc on
$ sudo studio-power mrc off

$ sudo studio-power rack on
$ sudo studio-power rack off

$ sudo studio-power computer on
$ sudo studio-power computer off

$ sudo studio-power sub on
$ sudo studio-power sub off

$ sudo studio-power pa on
$ sudo studio-power pa off

$ sudo studio-power tv on
$ sudo studio-power tv off

$ sudo studio-power neewer on
$ sudo studio-power neewer off

# Session management (turn entire studio on or off):
$ sudo studio-power all on
$ sudo studio-power all off

# List devices:
$ studio-power list