REF-04 // IR CONTROL

ATmega2560 Universal
IR Control System

Replacing plastic junk with a custom-engineered, lithium-powered ATmega2560 command module.

Custom PCB Design

The core of the SkyRemote is a custom-designed Printed Circuit Board (PCB) built around the ATmega2560. Unlike hobbyist kits, this was designed for daily reliability.

POWER SYSTEM

Integrated Lithium-Ion charging circuit with a 5V boost converter, allowing USB-C recharging and consistent logic levels regardless of battery voltage.

INTERFACE

3x4 tactile switch matrix directly routed to the ATmega's GPIOs (Pins 22-28), optimized for rapid polling.

Interrupt-Driven Architecture

To ensure zero latency, I bypassed the standard Arduino loop() polling for the keypad. Instead, I configured Timer 1 to trigger an Interrupt Service Routine (ISR) at exactly 50Hz.

ISR(TIMER1_COMPA_vect) {
  // Scan Columns
  for (int c = 0; c < NUM_COLS; c++) {
    digitalWrite(COL_PINS[c], HIGH);

    // Check Rows
    for (int r = 0; r < NUM_ROWS; r++) {
      int reading = digitalRead(ROW_PINS[r]);
      
      // Software Debounce Logic
      if (reading == 1) {
         stableCount[r][c]++;
      }
      
      // Trigger Command
      if (stableCount[r][c] == STABLE_THRESHOLD) {
         sendCmdRequest = true;
      }
    }
    digitalWrite(COL_PINS[c], LOW);
  }
}

This approach allows the processor to sleep or handle other tasks, only waking up to scan the matrix. It also implements software de-bouncing and "Hold-to-Repeat" logic for volume control.

Samsung IR Integration

The system utilizes the IRremote.hpp library to modulate the 38kHz carrier wave required by Samsung televisions.

ADDR: 0x7

Target Device Address

CMD: 0x02

Function: Power Toggle

CMD: 0x07

Function: Volume Up (+Repeat)