IR Receivers - johnosbb/Automation GitHub Wiki
Key | Code |
---|---|
PWR | FF629D |
CH | FFE21D |
|<< | FF22DD |
>| | FFC23D |
>>| | FF02FD |
- | FFE01F |
Plus | FFA857 |
EQ | FF906F |
0 | FF6897 |
100 | FF9867 |
200 | FFB04F |
1 | FF30CF |
2 | FF18E7 |
3 | FF7A85 |
4 | FF10EF |
5 | FF38C7 |
6 | FF5AA5 |
7 | FF42BD |
8 | FF48B5 |
9 | FF52AD |
Key | Code |
---|---|
PWR | FD00FF |
VOL | FD807F |
FUNC/STOP | FD40BF |
|<< | FD20DF |
>| | FDA05F |
>>| | FD609F |
DOWN | FD10EF |
VOL | FD906F |
UP | FD50AF |
0 | FD30CF |
EQ | FDB04F |
ST/REPT | FD708F |
1 | FD08F7 |
2 | FD8877 |
3 | FD48B7 |
4 | FD28D7 |
5 | FDA857 |
6 | FD6897 |
7 | FD18E7 |
8 | FD9867 |
9 | FD58A7 |
- Pin 1 is signal
- Pin 2 positive power
- Pin 3 is ground
Different Models have different pinouts. The raw vs18388 part has
Pinout Reminder (for VS1838B):
#include <Arduino.h>
#include <IRremote.h>
#define IR_RECEIVE_PIN 36
IRrecv IRReceiver(R_RECEIVE_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
IRReceiver.enableIRIn();
}
void loop() {
if(IRReceiver.decode(&results)) {
Serial.println(results.value, HEX);
IRReceiver.resume();
}
}
00000000111111110110100010010
00000000111111110110
The NEC protocol follows a specific timing pattern:
Header:
MARK: ~9000µs
SPACE: ~4500µs
32-bit Data (8-bit Address, 8-bit Inverted Address, 8-bit Command, 8-bit Inverted Command):
Each bit consists of:
MARK (~560µs)
SPACE (~560µs for 0, ~1600µs for 1)
End Signal:
MARK (~560µs)
Final SPACE (~40ms, if the key is held, FFFFFFFF is sent)
Observed pattern on Oscilliscope
Signal Type | Low Duration (µs) | High Duration (µs) |
---|---|---|
Start (Leader Code) | ~9200 | ~4500 |
Bit Start (for each bit) | ~600 | Varies |
First 8 Bits (Address?) | ~600 | ~500 |
Following Bits (Data?) | ~600 | ~1500 |
Leader Code (Start Frame)
LOW for ~9200µs, then HIGH for ~4500µs Indicates the start of an IR transmission.
Bit Encoding
Every bit starts with a LOW pulse (~560-600µs). The following HIGH pulse determines if the bit is 0 or 1: Short HIGH (~500-600µs) → 0 Long HIGH (~1500-1700µs) → 1
00000000 11111111 01101000 10010111
Byte | Binary | Hex | Meaning |
---|---|---|---|
Address | 00000000 | 0x00 | Address Byte |
Address Inverse | 11111111 | 0xFF | Address Complement |
Command | 01101000 | 0x68 | Command Byte |
Command Inverse | 10010111 | 0x97 | Command Complement |
Holding the Key
Instead of repeating the full command, the remote sends a repeat signal every 108ms.
The repeat signal consists of:
9ms LOW (MARK)
2.25ms HIGH (SPACE)
560µs LOW (MARK)
97ms HIGH (SPACE)
Key Release
No further signals are sent after the final repeat signal.