Reverse Engineering the Logitech Z906 Remote


I wanted to automate my Logitech Z906 speakers.

The direct route into the speaker console looked complicated. The infrared remote was easier.

So I captured every button, decoded the protocol, built a wired replacement controller and then moved the same commands onto an ESP8266 with MQTT.

Seven infrared commands

On 5 January 2020 I connected an infrared receiver to a logic analyzer, captured the Z906 remote in Saleae Logic and decoded the captures in PulseView.

The seven buttons I cared about were input, power, mute, level, effect, volume down and volume up.

PulseView decoded them as 32-bit NEC frames. All seven shared the 16-bit extended NEC prefix 0x02A0 (PulseView’s decoder still labelled the second byte Address#, even though 0xA0 is not the bitwise inverse of 0x02), followed by an 8-bit command and the command’s inverse. Holding a button produced the expected NEC repeat frames after the initial command.

PulseView IR NEC decode of the Logitech Z906 power button showing Leader code, Address 0x02, Address# 0xA0, Command 0x80 and Command# 0x7F.

I also forked Marcus10110’s copy of LiveOverflow’s Saleae NECAnalyzer to build on my Linux machine, fixing the Analyzer SDK paths and selecting libAnalyzer64.so on 64-bit Linux. The final preserved button decoding came from PulseView, so the fork was useful tooling work rather than the source of the captures.

The same bits in a different order

The hex values displayed by PulseView did not match what the contemporary Arduino IRremote and IRremoteESP8266 APIs expected.

NEC transmits each byte least-significant bit first, and PulseView decoded each byte into its logical value (0x02, 0xA0, 0x08, 0xF7). sendNEC(data, 32), on the other hand, shifted the 32-bit integer out most-significant bit first. The four bytes stayed in the same order, but the eight bits inside each byte had to be reversed:

#define FLIP_BIT(from,to,n) ((((n >> (31-from)) & 1) << (31-to)) | (((n >> (31-to)) & 1) << (31-from)))
// Example: my capture: 0x02A008F7, what the library wants: 0x400510EF
#define CONV(n) (\
  FLIP_BIT(0, 7, n) | FLIP_BIT(1, 6, n) | FLIP_BIT(2, 5, n) | FLIP_BIT(3, 4, n) | \
  FLIP_BIT(8, 15, n) | FLIP_BIT(9, 14, n) | FLIP_BIT(10, 13, n) | FLIP_BIT(11, 12, n) | \
  FLIP_BIT(16, 23, n) | FLIP_BIT(17, 22, n) | FLIP_BIT(18, 21, n) | FLIP_BIT(19, 20, n) | \
  FLIP_BIT(24, 31, n) | FLIP_BIT(25, 30, n) | FLIP_BIT(26, 29, n) | FLIP_BIT(27, 28, n))

That gave the full table of Z906 codes:

Button PulseView capture sendNEC (CONV)
Input 0x02A008F7 0x400510EF
Power 0x02A0807F 0x400501FE
Mute 0x02A0EA15 0x400557A8
Level 0x02A00AF5 0x400550AF
Effect 0x02A00EF1 0x4005708F
Volume down 0x02A06A95 0x400556A9
Volume up 0x02A0AA55 0x400555AA

By 16 January I had a working record-and-replay prototype on a Digispark ATtiny85 clone.

The Nano which was not a Nano V3

In February I built the first physical replacement controller on a board marked BTE14-01B on the back and NANO 3 on the front. It had the shape and pinout of an Arduino Nano, but the microcontroller on it was an ATmega168V paired with a CH340G USB-serial bridge rather than the ATmega328 of a real Nano V3.

Close-up of the BTE14-01B board showing the NANO 3 silkscreen next to an Atmel MEGA168V microcontroller and a WCH CH340G USB-serial chip.

Flashing it as a Nano V3 failed, and I initially assumed it had no bootloader at all. Checking the chip markings cleared it up: the right PlatformIO target was nanoatmega168.

This is a small example of why reading the actual parts matters. The board was perfectly usable once configured as the thing it actually was. Treating the silkscreen as a specification made it look defective.

The controller mapped seven physical buttons on pins D6–D12 to the seven NEC transmissions. The KiCad schematic wired the Nano-format board to seven push buttons with 10 kΩ pull-down resistors and a CQY99 infrared LED with a 150 Ω series resistor.

The PCB layout was never routed. This was a schematic and wired build rather than a finished manufactured board, and the code and schematic are in Logitech-Z906-Remote.

MQTT replaces seven wires

On 15 March 2020 I published espRemote, an ESP8266 (NodeMCU v2) continuation of the same work.

It reused the seven captured frames and the exact same CONV macro with IRremoteESP8266 and PubSubClient. Instead of seven local buttons, it subscribed to logitech-remote/* MQTT topics for each Z906 action (plus logitech-remote/led for the onboard LED) and sent the corresponding infrared command.

The board also read a DHT temperature and humidity sensor and published those values to MQTT (living-room/temperature and living-room/humidity).

The single commit describes it as a working board with remote and environmental sensors. There was no enclosure, release or later maintenance.

Wi-Fi and broker credentials were injected from the desktop keyring via secret-tool during the PlatformIO build rather than committed. The old firmware did hardcode a private broker address, which is not reproduced here.

Automating the interface which already exists

I had looked at reverse engineering the Z906 console’s internal serial interface, and my one-line note on it was TL;DR: led is easier. Infrared was easier because Logitech had already defined a stable command boundary and shipped a transmitter demonstrating it.

Reverse engineering the remote did not require understanding the amplifier firmware, display or internal state machine. It required learning seven packets and reproducing their timing.

The result is not as elegant as a documented network API. Infrared is one-way and gives no confirmation that a command took effect.

It was still the right layer for the project. The speakers remained unmodified, and MQTT made their existing controls scriptable. Years later the Z906 ended up in an Xbox-controlled media chain, where the Xbox itself toggles it over infrared.