TRANSMIT raw IR codes with ATTINY85? IRLIB/IRREMOTE?

Hi,

I have four RAW IR signals I want to send. I can do it easily with irremote/irlib on the 328P.

I do NOT need to receive or encode/decode any protocols (only RAW).

I have four button inputs and one IR led output.

I want to use ATTINY85, but I cant find a way to do it. I think the major porting problems are to do with the RECIEVE part of the library.

Is there a way to slash the library down to RAW TRANSMIT ONLY and get it to work on ATTINY85?

I have spent a LOT of time trying to research this, but I'm getting nowhere. Any help would be appreciated!

-Michael.

Maybe this library will help though I have never used it. Also this writeup.

Tried adding this as new message but site refuses to accept a new post so…

DrAzzy:
In that case, isn’t it as simple as a chain of digitalWrite() and delay()? I’d think you could always half-ass it like that if you had to.

I have done this for a gate entry system that uses 433MHz RF but principle would be the same (just with a LED instead). Might need to put the sequences in flash though.

// High/Low microsecond timings, first value is high timing, the rest alternate low/high
const int hlUsTimings[] = {
380,440,700,800,360,440,720,780,380,440,700,800,360,460,700,780,380,440,700,800,360,800,360,460,720,13000};
const int hlUsSize = sizeof(hlUsTimings) / sizeof(hlUsTimings[0]);

const int pinChangeDelay = 0;                     // Value to subtract from numbers to compensate for instruction timings
const int outPin = 3;                             // Transmitter output pin
const int ledPin = 4;                             // LED output pin

void setup() {
  pinMode(ledPin,OUTPUT);
  pinMode(outPin,OUTPUT);
  digitalWrite(outPin,LOW);
  delayMicroseconds(13000);
}

void loop() {
  digitalWrite(ledPin,!digitalRead(ledPin));
  byte pinState = 0;
  noInterrupts();
  for (int y = 0; y < hlUsSize; y++){
    pinState = !pinState;
    digitalWrite(outPin,pinState);
    // if (pinState == 0){
      // delayMicroseconds(20);
    // }
    int z = hlUsTimings[y] - pinChangeDelay;
    delayMicroseconds(z);
  }
  interrupts();
}

4 RAW codes - that means you know the sequence of on/off, and how long it needs to stay in each state for?

In that case, isn't it as simple as a chain of digitalWrite() and delay()? I'd think you could always half-ass it like that if you had to.

It would be that simple, except IR pulses need to be modulated on a ~38khz carrier. So basically a PWM signal being switched off and on.

The attiny irremote library has been used for receiving IR, but as far as I can see, author of that tutorial basically dismisses the transmit side as irrelevant.

Sorry about that, I had not read the full story on the links I provided. :(

Maybe we can massage the library to TX on the tiny85 but this will probably involve using a dedicated pin (not sure which yet) to connect the IR LED to. I looked into the IR library in more detail and to use it with the tiny85 would mean taking over timer0 as timer1 cannot do the mode needed. Using timer0 will probably upset the Arduino core as it is used for timing delay and other stuff. This is probably why nobody has bothered with it before. I did find this but it is set to send JVC code but maybe it can be hacked to do raw instead.

38kHz on Attiny85 see: http://www.ernstc.dk/arduino/38khz_timer.htm

if you need it on 4 pins simultaneously, simple adjust the code to create interrupts at 76kHz and flip the bits inside the ISR manually using direct port mapping (not digitalWrite).

76kHz because you have to flip the bit twice in every 38kHz period.

That gets you an accurate modulated carrier.

To code your marks and spaces just set flags in the main loop accordingly for the ISR to know when the carrier is active(mark) or not(space) on any of the 4 pins.

This way you can send different IRsignals simultaneously on any free output pins you have available.