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:
- - -
- GNDX X X
- +5 V. . .
- signal


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

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:
- User Code / Address:
0xfe01
- Data Code / Command:
0xfc03
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:
- transmits Power Up command
- waits 2 seconds
- transmits Change input command, it sets input from AU to PC
- powers the microcontroller down
The module was placed inside the speaker box and secured with a cable tie.