Skip to content

Hacking the Red Light (Part I)

Arduino layout
Two years ago, I decided to buy a Budweiser Red Light to enhance our hockey night experience. While the product is quite expensive for what it does, I couldn't be happier with the end result. You have to admit, every goal from your team feels and sounds worth jumping around shouting loudly.

This being said, while the product by itself is great, I couldn't resist the urge to hack it. One of my goal was to connect the house Hue lights to the Red Light so that they would shine red as goals were scored. Googling around, I found some ways of achieving this:

  • Sully Syed wrote about how the traffic from the Red Light could be sniffed to identify when a goal is triggered. While this sounds promising, I have no way to understand the packets, nor do I want to intercept everything that is going through my network
  • François Maillet had a different design, where machine learning could "hear" a goal on TV being scored, flashing the Hue lights accordingly. While this is an interesting approach, I fear this is too much complexity for my needs since I already have a device that is triggered when a goal is scored. In other words, I do not need to detect the sound of a horn with fuzzy logic, I just need to detect when the light is triggered.

Other solutions were using some kind of NHL feed or IFTTT plugins to achieve the same. The major issue in these cases were the delays of polling these APIs, having your Hue lights flash 30 seconds after the goal is actually scored.

With these not really covering my needs, I decided to hack around the light using external hardware. My goal was to leave the Red Light intact and not dismantling it playing with the ElectricImp card. Piggybacking on François' idea, I could just detect the Red Light flashing instead of analyzing the sound and act accordingly. This is what this post is about.

Using an Arduino (or Genuino) board, I could simply hook-up a red LED in reverse and detect a rise in brightness. The original idea can be found here where LEDs are used as a digital camera.

Connecting the circuit as the image above, I quickly discovered how accurate it could be. Using Arduino IDE, a simple sketch was created and uploaded on the board. When the light hitting the LED reached a certain threshold, I would send a character down the Serial interface. Since this setup is tethered (my machine is still connected to the board), I could simply listen on the serial port assigned to the board and launch a small script when data is received.

#define LED_N_SIDE 2
#define LED_P_SIDE 3

void setup() {
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // Set board LED as output, we will flash it at every loop
  pinMode(LED_BUILTIN, OUTPUT);

  // We are ready, let our computer know
  Serial.println("0");
}

void loop() {
  unsigned int j;

  // Apply reverse voltage, charge up the pin and led capacitance
  pinMode(LED_N_SIDE,OUTPUT);
  pinMode(LED_P_SIDE,OUTPUT);
  digitalWrite(LED_N_SIDE,HIGH);
  digitalWrite(LED_P_SIDE,LOW);

  // Isolate the pin 2 end of the diode
  pinMode(LED_N_SIDE,INPUT);
  digitalWrite(LED_N_SIDE,LOW);  // turn off internal pull-up resistor

  // Count how long it takes the diode to bleed back down to a logic zero
  for ( j = 0; j < 30000; j++) {
    if ( digitalRead(LED_N_SIDE)==0) break;
  }
  
  // If j is lower than 1500, we have detected enough light, we must have a goal
  if (j < 1500) {
    Serial.println("1");
    delay(8000); // Once a goal is detected, pause for 8 seconds
  }
  
  // Turn the board LED on and off
  digitalWrite(LED_BUILTIN, HIGH);
  delayMicroseconds(50000); // No need polling faster than this
  digitalWrite(LED_BUILTIN, LOW);
}

As of this writing, this setup works great. I have a small script loaded with a bunch of curl requests doing these for every goal:

  • Connecting to the Hue light bridge over the local network, grabbing all the lights and their current settings (hue and saturation)
  • Send to all lights a saturation of 254 and hue of 65535, in other words a bright red color.
  • Set all lights to "lselect" alert mode, this will make the lights flash. I add a small delay between each lights, so they seem to flash in rotation
  • After 10 seconds, I set back the original values so everything is back to a quiet normal

Next step will be adding an ESP8266 so that I can wirelessly connect to the bridge from the Arduino board. The ESPs are in the mail, can't wait to try this out.

Trackbacks

No Trackbacks

Comments

Display comments as Linear | Threaded

No comments

Add Comment

Form options