Arduino-IRremote library on Attiny85

As the title says I am trying to run the Arduino-IRremote on an Attiny85. Promising library in my opinion maintained on Github here.

The library comes with some definition already setup for Attiny85 (for timers in particular) so I guess it should be somehow ready for this MCU.

I got a basic sketch to simply read the IR signal then decode it and display on serial with softwareserial.

The first compilation complained about the size of the program being too large for the mcu which was an easy fix by disabling some unnecessary protocols in IRremote.h. (from line 31).

Second compilation worked really well. However I do not get any IR reading at all when testing my remotes on it. The hardware is not to be questioned here as it has been tested with other sort of sketches. Serial message works ok.

Now I wish I could enable debuging. There is provision for this from line 124 in IRremote.h. However it uses the function “Serial” which is no good for Attiny85. Could anyone advise how I could setup sofwareserial for the debug? At least that will allow me to see if the problem comes from acquisition or decoding.

Another thing which makes me think this library is probably not (yet) ready for attiny85 is the SYSCLOCK definition in IRremoteInt.h (line 102) being 16mhz. I changed it to 8mhz but not surprisingly still no luck. There might be other bits that need tuning somewhere else.

Any help greatly appreciated. The basic sketch for testing below.

#include <IRremote.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 0); //rx,tx
int RECV_PIN = 4;
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup()
{
  mySerial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
  mySerial.println("Attiny85 IR");
}

void loop() {
  if (irrecv.decode(&results)) {
    mySerial.println(results.value, HEX);
    irrecv.resume(); // Receive the next value
  }
  delay(100);
}

Here is my t85 IR receiver code IR detector MIM 5383H4 Original IR detection logic: pmalmsten's code

Been working well for a couple of years in several projects.

Ray

on ATtiny85 (internal 8 MHz clock) work ok. (fuse: high:DF low:E2 Ext:FE)

I added 2 line to the top in sketch

define F_CPU 8000000

define AVR_ATtiny85