Słomkowski's technical musings

Playing with software, hardware and touching the sky with a paraglider.

Microlab speaker IR remote hijack - autostart and input select

I use Digispark module to inject NEC infrared protocol commands to start Microlab 6C speakers and select sound source automatically at startup.

I use Microlab 6C as my desktop PC speakers. Despite low price, they look and sound nice. However, they draw a lot of power on standby (over 8 watts) so I’d prefer to disconnect them physically from mains when I turn the PC off.

Unfortunately, after I turn them back on, they stay on standby (-- on the display). Each time, I have to manually press buttons on the remote to turn them back on and select the appropriate input. This is quite irritating. I want them to be ready to play sound from the PC input without my intervention.

The idea is to connect a microcontroller to the infrared receiver inside the enclosure and simulate an incoming IR command. All integrated IR receivers (like TSOP1838 etc.) have open-drain outputs, so there’s no problem with connecting an additional MCU - both devices on the line simply drive it down to the ground.

IR protocol

I opened the enclosure and checked how the IR receiver is connected internally. Fortunately, it was connected to the main board by a three-wire cable. Using an oscilloscope, I identified the signals in the cable. Each line was distinctly marked:

I pressed some buttons on the remote and recorded the resulting waveform with the scope. An example is shown in the screenshot:

Oscilloscope capture of the signal from IR receiver. 9 ms pulse followed by 4.5 ms gap indicates NEC protocol.

When carrier is present, signal goes from +5 V to 0 V. Notice 9 ms carrier, then 4.5 ms silence - this indicates NEC IR protocol.

Having recorded the signal on the scope, it is possible to decode it by hand. However, I own a nifty Chinese component tester, which is able to decode NEC protocol and spare me the time:

As you can see, it displays decoded message, which consists of two 16-bit words: address and command. For some reason however, the tester switches the byte order of the words. The real code for Power Up command is:

Digispark module

I used Digispark module with ATtiny85 microcontroller. Output is connected to PB0. The program is extremely simple, since the device has only one job, I didn’t use timers at all, _delay_ms function was enough. The code is on GitHub.

The Digispark bootloader waits for 5 seconds before starting the main program. This is more than enough time to initialize the internals of the speaker, so the firmware basically:

The module was placed inside the speaker box and secured with a cable tie.