How I Turned an Old TV into a PC Display Controlled by a Single Remote in 10 Hours

    This article walks through a weekend project that repurposes a cheap, non-smart TV with HDMI input into a couch-friendly display for a desktop PC. It covers the full pipeline: an infrared remote, a Wi-Fi microcontroller that decodes key presses, and a computer-side daemon that maps key codes to local playback and system actions. You will find the minimal hardware list, a two-step approach to infrared protocol decoding, the trade-offs between TCP/WebSocket and UDP, practical daemon design notes, and a checklist of common pitfalls. The key takeaway is a method: define the friction point precisely, automate it with the smallest possible pipeline, and keep the volatile parts in software.

    1. Where It Started: Treating “Getting Up” as an Optimization Problem

    A developer with years of programming experience had a cheap old TV at home. It had no network module and none of the app ecosystem you get on a smart TV, but it kept the one capability that mattered most: an HDMI input. Once connected to a desktop, the couch became the viewing spot.

    The problem was in the interaction path. To watch something, he had to get up, walk to the PC, wake the second monitor, launch the player, drag the window onto the right screen, and switch to fullscreen. By the time he got back to the couch, he realized the wireless keyboard was still on the desk, so he made another trip. A single action had been broken into six or seven steps that all required him to be physically present.

    What is worth learning here is not the tinkering itself, but how he translated a vague sense of discomfort into a measurable engineering problem: the input device and the display device are spatially separated, so every content switch incurs a fixed physical movement cost. Once the problem is defined this way, the direction of the solution becomes obvious: bring the input back to the couch.

    2. Solution Overview: A Three-Stage Pipeline

    The final architecture can be abstracted as a one-way event stream:

    1. Remote button press → IR carrier signal → microcontroller decode → Wi-Fi report → PC-side daemon → local playback/system command

    The design principle behind this pipeline is single responsibility and clear boundaries: the microcontroller only figures out which key was pressed, and the PC only decides what that key should do. Putting the semantics on the computer rather than in the hardware means that remapping keys or adding features later never requires reflashing the firmware. This was the least painful decision in the whole project.

    3. Hardware Layer: The Minimum Viable Circuit

    The bill of materials was deliberately kept to the bare minimum: a set of IR emitter and receiver pair, a microcontroller dev board with Wi-Fi and Bluetooth Low Energy, a mini breadboard, and some jumper wires.

    Wiring notes:

    • Connect the IR receiver’s signal pin to a GPIO; wire power and ground per the module’s markings. The receiver is sensitive to power-supply ripple, so keep it on a separate supply from motors and high-power components.
    • If you later want “reverse control” (for example, making the TV respond to commands), add an IR emitter with a transistor driver, since a GPIO cannot drive an IR LED with enough power and the effective range is very short.
    • A breadboard is only suitable for the prototyping phase. For long-term use, move to perfboard or a custom PCB. Poor jumper-wire contact is the most common source of “spooky” failures in projects like this.

    4. Protocol Layer: From Raw Waveform to Key Semantics

    An IR remote is not a simple high/low level; it is “carrier + encoding.” Common industry protocols like the RC-5 family use Manchester encoding with a fixed period, where each key maps to a stable bit sequence and includes address and repeat bits to distinguish devices and long presses.

    The recommended parsing path is two steps, rather than writing a state machine right away:

    1. Capture the raw timing first. Use the microcontroller’s input-capture feature to record the timestamps of level transitions, print them out, and confirm the carrier period and the duration ratio of logic “0/1.”
    2. Then decode and debounce. Reconstruct the address and command codes bit by bit, and throttle consecutive repeated frames to avoid a command storm on the PC from a long press.

    Illustrative decoding logic (pseudocode, showing the flow only):

    1. // After capturing the transition timestamps of one frame
    2. uint8_t decode(uint32_t *edges, uint8_t n) {
    3. if (n < EXPECTED_EDGES) return 0xFF; // incomplete frame, discard
    4. uint16_t addr = 0, cmd = 0;
    5. if (!unpack(edges, n, &addr, &cmd)) return 0xFF;
    6. if (addr != TARGET_ADDR) return 0xFF; // only care about the target device
    7. if (cmd == last_cmd && now() - last_ts < THROTTLE_MS)
    8. return 0xFF; // long-press debounce
    9. last_cmd = cmd; last_ts = now();
    10. return cmd;
    11. }

    In practice, it is strongly recommended to keep the “key code → action” mapping table in a config file on the PC, with the hardware only reporting numbers. Adding a “pause/resume” feature then becomes a one-line config change.

    5. Communication Layer and the PC Side: Making Commands Actually Land

    The microcontroller joins the home network over Wi-Fi and establishes a lightweight connection with the PC. There are two common trade-offs here:

    • Persistent connection (TCP/WebSocket): low latency and bidirectional, suitable for scenarios that need state feedback, but you must handle reconnection and heartbeats.
    • Connectionless reporting (single UDP packet): the simplest to implement, and losing a frame is fine (the user will just press again), suitable for purely one-way remote control.

    The PC-side daemon’s job is to translate numeric commands into actions. Three things to note:

    1. Commands must target the correct session. In a graphical environment, “switch to fullscreen” and “pause” should be sent to the current foreground window rather than firing global hotkeys blindly, which can easily trigger other applications.
    2. Least privilege. The daemon does not need admin rights; request only the capabilities required to control its own playback window.
    3. Observability. Write each reported key code, timestamp, and execution result to a local log, so when something goes wrong you can quickly tell whether the hardware did not receive it, the network dropped it, or the PC failed to execute.

    6. The Real Change Brought by an AI Coding Assistant

    For this project, the encoding/decoding and scripting were mainly done by an AI coding assistant. Its value is not in “coming up with the architecture for you,” but in compressing three kinds of low-value time: looking up register and pin definitions in chip datasheets, turning timing data into a decoding state machine, and filling in error handling and reconnection logic for scripts.

    One practical tip: state all the constraints up front (chip model, available peripherals, protocol type, target OS, expected log format) rather than adding descriptions back and forth. At the same time, any code involving hardware timing must be verified yourself with an oscilloscope or logging, because the model cannot sense the real levels on your board.

    7. Extension Directions and a Pitfall Checklist

    To move this toy project toward a multi-user, multi-device household scenario, you can bring in general cloud capabilities for support: the device side reports key events through a message queue, config and key mappings live in object storage, runtime logs go through a logging service, and unexpected disconnects are covered by monitoring alerts. Platforms such as Baidu AI Cloud provide exactly these general-purpose categories; the specific choice still depends on scale and cost constraints.

    Common pitfalls:

    • The IR receiver is disturbed by sunlight or energy-saving lamps, showing up as random “ghost key presses”; add a shade or a software whitelist.
    • Decoding without throttling, so a long press produces a flood of commands.
    • Hardcoding key mappings in firmware, so every feature change means flashing the board again.
    • The connection drops after the PC sleeps, with no reconnection mechanism.

    8. Closing Thoughts

    The total cost of this project was ten hours and a few breadboards; the payoff is that the dozens of times he got up each day are gone for good. Its real significance is the methodology: define the friction point precisely, then automate it with the smallest possible pipeline, and keep the volatile parts in the software layer. Laziness is the driving force, but the ability to abstract is what turns laziness into productivity.