Arduino IR Blaster

Comcast STB IR Blaster

This page is an archival of my older blog, if anything doesn't display properly please let me know at cobookman (at) gmail (dot) com

This project requires the following components

The device completely finished (still needs a bit of refining):
The finished device

What the remote controller webpage looks like:
Remote Controller WebPage

Finished Device Schematic
Finished Device Schematic

Link to Github Repo Which contains the Arduino C Code

Step 1: Place the Ethernet shield on top of your Arduino

Step 2: Setting up the RGB Common Cathode LED.

Wire the RGB CC LED as shown in the two pictures below. Using the orientation of the LED in the picture below, wire up the following resistors. Left to Right (This wiring is shown in the schematic below

  1. 220 Ohm Resistor then to pin 7
  2. Ground (FYI Longest Wire on LED)
  3. 100 ohm resistors then to pin 6
  4. 100 ohm resistor then to pin 5

RGB LED Wiring Common Cathode RGB LED

The Red Wire uses a 220 Ohm Resistor.
The Blue and Green each use 100 Ohm Resistors

Step 3: Wiring of the two pushbuttons.

While the pushbutton has 3 metal leads, we'll only be using the ones labelled:

  • COM
  • Normal Closed (NC).

These buttons will be wired up with pull up resistors. This means that the arduino registers a low when the pushbutton is pressed down. Wikipedia goes much more in depth on how exactly pullups work

The following is an example Breadboard wiring.

  • COM = Brown, right wire
  • NC = Blue, left wire

Wiring of the pushbuttons:
Device Wiring Schematic

Step 4: IR LED

Attach the Max Power IR LED kit from Spark:

  • VCC -> 5v (same row as the orange wire)
  • GND -> Ground (same row as the brown wires)
  • CTL -> Pin 4

Step 5: Decoding of a 38Khz Remote Control

The code in the github repo will already work with comcast STB/DTA. Therefore this step is only necessary if you want to control another device.

  1. Connect the IR Receiver Breakout to the arduino.
    • VCC -> 5v (Same row as the orange wire)
    • GND -> Ground (same row as the brown wires)
    • OUT -> Pin 2 (Disconnect the ‘yellow’ wire currently shown in above breadboard, once done decoding IR values, simply reconnect)
  2. Program your arduino with Ladyada's Raw IR Decoder(View Code Here)
  3. The program will display (through Serial) something along the lines of:
    • ON/OFF
    • 34, 74
    • 32, 158
    • 32, 61
    Each of these numbers corresponds to the ‘on’ time (a 38Khz wave), and an ‘off’ time (IR Led is 100% off for this state). Here is an Oscilloscope trace that Ladyada made: Oscilloscope Capture
  4. Take a few samples of each remote control command, average them together, and multiply them by 10 (this converts the values to microseconds). Keep track of these values (they will be needed in the code later on for the chanUP, chanD, chan1, chan2,…etc functions)

Step 6: Getting the Code

To get the most current code go to: https://github.com/cobookman/Arduino-IR-Blaster-for-Comcast-DTA-STB-with-Web-Interface/blob/master/stb_controller.ino

Here is a basic overview of each function in the code below:

  • const int
    • Declares what Pin each device is connected to
  • #define statements
    • Used in the webpage code.  Generates the buttons on the webpage output.
  • void setup()
    • Declares inputs and outputs as well as displays a Red->Green->Blue LED values if the arduino is unable to connect to the internet. But, if the arduino does connect to the internet, it will output its IP Address through serial
  • void loop()
    • Initially gets the value of both pushbuttons, subsequently changes the channel if they have been pushed.
    • Checks to see if someone has changed the channel over through the webpage
  • void led(int color)
    • Simple program which changes the color of the RGB LED
  • void ParseHttpHeader(Client &client)
    • Parses the HTTP command sent, and finds out what channel change was requested from a web user (which is stored in webC
  • void SubmitButton(Client &client, char *pcLable, int iCmd)
    • Creates and sends the HTML code for the website button requested
  • void WebServerLoop()
    • See if a new client has requested for the website, if so it then sends the user a copy of the page
  • **void pulseIR(long microsecs)
    • Pulses the IR LED on and off at 38Khz for the number of microseconds requested
  • void chanUP(), ChanD(), chan1,….etc.
    • Refer back to the values noted in Step 4 part 5, they will be used in this next step.
    • For each of the commands you wish to modify, simply place the ‘on’ times into pulseIR statements and the ‘off’ times into delayMicroseconds. These values have to be in order from left to right
      • Example, if the ir dump program outputs the following for the up arrow:
        • 34, 74
        • 32, 158
        • 32, 61
        then the code would look like:
void chanUP() {  
  pulseIR(340);
  delayMicroseconds(740);
  pulseIR(320);
  delayMicroseconds(1580);
  pulseIR(320);
  delayMicroseconds(610);
}
  • If you want to add or remove buttons from this code you will need to add their respective html in the void WebServerLoop(); and implement the functions:
    • pulseIR(…)
    • delayMicroseconds(…)