Attiny85 IR code for Sony protocol
Attiny85 core files used:
You must select the correct “board” type… [email protected] (internal PLL)>9600 BAUD serial output comes out the ATtiny on physical pin# 7
Using a dedicated Attiny85 microcontroller to monitor and decode the IR detector (MIM5383H4) frees the main uC from having to do this nasty and inefficient job. This makes for nimble IR operation on the host microcontroller where only a serial port needs to be monitored for traffic which originates from the tiny85.
My implementation uses the Sony IR protocol which is available on almost every inexpensive Universal Remote Control. The algorithm for this decode was developed and put in the public domain by Arduino Forum member pmalmsten. Full links to his work is provided in my source code. This is an Open Source implementation, so you can easily change the tiny85 to decode NEC or other remote protocols by changing the decode algorithm – but you are on your own for this effort; however there are many IR decode algorithms freely available for the searching on Google.
The main program is more efficient and requires less resources because the IR polling and decoding is eliminated and the host simply receives the decoded digits and commands on the serial port at 9600 BAUD in my example. This solution is also microcontroller agnostic: I have used it for AVR and for PIC. You can even feed the serial output of the ATtiny85 to your PC over a USB/serial converter and host software on the PC to do magic stuff.
On the Arduino, all that is necessary is a single statement in the loop():
if (Serial1.available() > 0) >If nothing is in queue, then the host Arduino microcontroller does not need to be concerned about IR messages. It cannot get much simpler!
I have a full write-up of this technique on the main Arduino.cc Forum:
Read More: Infrared Dedicated Decoder