(void *) blog

Posted on by fortytwo_de


I spent the last weekend at EMF. It was a blast. Apart from the talks and “official” activities being just plain awesome, the atmosphere was fantastic as well.

One of the cool things I get to physically bring home from EMF is a pair of TiLDAs (one of them gifted to me by Jeremy (who, by the way, is working on an awesome project and you should all be keeping an eye on him)).

The TiLDA is EMF camp’s badge, something very common among hackcamps in general. This particular one, has two RGB LEDs, a 2.4GHz radio transceiver, a 1600mAh LiPo battery and a IR LED.

This is particularly interesting because you can do fun stuff like turning off televisions with it:

(sorry for the bad quality and vertical video)

However, there are some major and unexpected limitations: the ATmega 32u4 on which the Arduino Leonardo is based on (and by extension, the TiLDA) doesn’t have a Timer 2, which is needed to drive the PWM on pin 3.

There was a whole group of people much smarter than I trying to figure out a way to use one of the 32u4’s timers on pin 3, without much success, so I went down the easy route:

Hacking the hardware.

I basically bridged pin 9 to pin 3. This allows me to use the IRremote library.

However, I had to do some modifications to make it work - you can find the patch file at the end of the post.

Here is the sketch my TiLDA is running on that particular video:

#include <IRremote.h>

#include "pins.h"

IRsend irsend;

void TVB() {
  for(int i = 0; i < 3; i++) {
    irsend.sendNEC(0x20DF10EF, 32);
    delay(40);
  }
  delay(10);
}

void setup()
{
  pinMode(PIN_BUTTON, INPUT_PULLUP);
  attachInterrupt(INT_BUTTON, TVB, CHANGE);
}

void loop() {

}

Very simple, but it works. The sketch I used to figure out the “magic number” that turns on my monitor is the following:

#include <IRremote.h>

int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}

void loop() {
  if (irrecv.decode(&results)) {
      Serial.print(results.value, HEX);
      Serial.print(" ");
      Serial.print(results.decode_type, DEC);
      Serial.print(" ");
      Serial.println(results.bits, DEC);
      irrecv.resume(); // Receive the next value
  }
}

Posted on by fortytwo_de | Posted in C, Hardware, Programación


6 Responses to EMF2012, and TiLDAs

  1. Gaston Price says:


    Could you please provide a better example written in a more suitable language for this task. It is not very clear what the Serial does. I think VB6 would be a good language for this programming place.


  2. Lucasbuck says:


    Could you host your modified IRremoteInt.h, as when patching i get an error with hunk 5 :
    Hunk #5 FAILED at 452.
    1 out of 5 hunks FAILED

    Thanks!


  3. gadgets says:


    I loved up to you’ll obtain carried out proper here. The comic strip is attractive, your authored material stylish. nonetheless, you command get bought an edginess over that you would like be turning in the following. ill unquestionably come further in the past again as exactly the similar just about a lot often inside case you defend this increase.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>