IR Protocol Analysis
Overview
The Snake-V1 leverages a dedicated infrared subsystem to interface with consumer electronics. By combining the Vishay TSOP38238 (Receiver) and the Vishay TSAL6400 (High-power Emitter), the device can decode, store, and replicate signals from almost any standard IR remote control.
The IR analysis module is designed to handle both standard modulated protocols and "Raw" captures for non-standard or proprietary signals.
IR Reception and Decoding
The system utilizes the TSOP38238, which is tuned to a 38kHz carrier frequency—the standard for the vast majority of consumer electronics.
Capturing Signals
To begin analysis, the device enters a listening state where it measures the timing between pulse transitions.
- Carrier Frequency: 38kHz (Optimized)
- Decoding Method: Pulse Distance Coding / Pulse Width Modulation
Supported Protocols
The firmware includes a built-in library for the most common IR protocols. When a signal is captured, the Snake-V1 attempts to map the timings to one of the following:
| Protocol | Description | Common Use Cases | | :--- | :--- | :--- | | NEC | 32-bit protocol (Address + Command) | Most modern TVs (Samsung, LG, etc.) | | Sony (SIRC) | 12, 15, or 20-bit versions | Sony TVs, Audio Systems | | Philips RC5/RC6 | Toggle-bit based protocol | European electronics, Set-top boxes | | Samsung | 32-bit variation of NEC | Samsung-specific smart devices |
IR Transmission (Replay)
Replaying captured signals is handled by the TSAL6400 transmitter. The Snake-V1 generates a 38kHz square wave carrier using the STM32's internal timers to ensure signal integrity and range.
Usage Example: Protocol-Based Replay
If the protocol was successfully decoded, you can re-emit the signal by providing the protocol type, address, and command.
/* Example: Sending an NEC Power Toggle Command */
IR_Signal power_cmd = {
.protocol = PROTOCOL_NEC,
.address = 0x04,
.command = 0x08,
.repeat = 0
};
IR_Transmit(&power_cmd);
Usage Example: Raw Replay
For unknown protocols, the Snake-V1 uses a "Raw" buffer containing the precise timing (in microseconds) of every IR pulse and gap.
/* Replaying a raw sequence of timings */
uint32_t raw_data[] = {9000, 4500, 560, 560, 560, 1690, ...};
IR_Transmit_Raw(raw_data, sizeof(raw_data)/sizeof(uint32_t));
Protocol Analysis Workflow
To analyze a new peripheral, follow this general workflow:
- Read Mode: Point the remote at the TSOP38238 receiver.
- Validation: The Snake-V1 validates the checksum (if applicable to the protocol).
- Visualization: The device displays the decoded Hex values (Address and Command) or the pulse-width graph for raw signals.
- Save/Replay: Decoded signals can be saved to the microSD card or retransmitted immediately to test the target device.
Hardware Considerations
- Range: The TSAL6400 is a high-power emitter. For best results, ensure a line-of-sight path to the target.
- Interference: High-intensity sunlight or plasma displays may introduce noise into the TSOP38238 receiver. If decoding fails, attempt capture in a shaded environment.