Path: Home =>>
Overview =>
Applications => IR-receiver switch
Self-learning IR remote receiver and 3 channel switch
Features
- Receives and analyzes IR remote control signals in a small ATtiny13 package.
- Switches three channel output pins on and off if correct switching codes are received,
- If at startup a certain portpin is held low, the chip enters the self learning mode:
- The first channel output blinks red.
- The chip waits for IR signals, if two signal bursts occur which have the same 16 bits at the
end, this combination is associated with the first channel's ON command,
- The association of this channel is confirmed by a 5 second long pause with this output pin
active.
- The second channel blinks yellow and waits for IR signal bursts. If two of those occur, the
second channel's ON combination is set and the five second long confirmation period occurs.
- In the same manner the codes for the ON combination of the third channel (green) and the three
OFF combinations for the channels are collected.
- All codes are stored in the EEPROM and read in at startup (if the key on PINB3 is clear).
- Active high or active low output pin characteristics can be selected by a software switch,
Hardware
The IR signals are detected with a standard receiver. Received signals are active low and cause INT0
interrupts in the ATtiny13. The resistor decouples programming signals from the IR receiver.
The key input is only sensed during startup and is connected to PINB3. This pin is driven high with
an internal pullup resistor.
The three output pins PORTB0, PORTB2 and PORTB4 drive red, yellow and green LEDs.
This shows how to connect a 5V relais to a channel output, with Active Low selected in the assembler
source code. The PNP transistor provides enough current to activate the relais.
Construction
This shows the construction on a simple breadboard.
Software
The software is written in AVR assembler. The asm source code is here,
html formatted source code here.
The generated code requires 290 words or 580 bytes of program memory. The output of my assembler:
gavrasm Gerd's AVR assembler version 3.5 (C)2015 by DG4FAC
----------------------------------------------------------
Source file: 12_IR-Rx_Switch.asm
Hex file: 12_IR-Rx_Switch.hex
Eeprom file: 12_IR-Rx_Switch.eep
Compiled: 23.11.2016, 23:23:05
Pass: 2
1: ;
2: ; ***************************************
3: ; * IR-Switch 3-Channel with ATtiny13 *
4: ; * (C)2016 by www.avr-asm-tutorial.net *
5: ; ***************************************
...
Program : 290 words.
Constants : 0 words.
Total program memory: 290 words.
Eeprom space : 13 bytes.
Data segment : 29 bytes.
Compilation completed, no errors.
Compilation ended 23.11.2016, 23:23:05
©2016 by http://www.avr-asm-tutorial.net