Control Your TV With Your Phone

79,614

233

38

Introduction: Control Your TV With Your Phone

Control your TV, DVD, Stereo, DVR, Cable box, Mac, Xbox, or any other IR device with the Web Clicker!

The Web Clicker is a web server & IR transceiver.  You can record any IR command and play it back via an AJAX web interface or just by requesting a URL.  It works great from a cell phone and it's especially handy for home automation projects.  It's based on a Propeller Platform USB, here's a little demo;



Continue on and I'll answer a few questions and then show you how to make it.

Step 1: FAQ

What can I do with it?
The Web Clicker can control any IR device (TV, DVD, Stereo, etc) simply by requesting a URL. There's also an AJAX based control page so you can use it with a web browser, like on your iPhone or computer.

The Web Clicker is awesome for home automation projects because of it's ease of implementation - just request a URL and you'll generate an IR signal or trigger a series of IR signals

Why?
I built the web clicker mostly for home automation - I have a MythTV DVR that uses an RF remote.  Now, I've set it up so when I push the power button on the remote, the DVR makes a page request to the Web Clicker and it generates the correct IR signal. 

How?
The Web Clicker is a Propeller Platform USB and E-Net Module, and a very basic IR circuit.  Web server code is based on PropTCP, by Harrison Pham, and I wrote a custom object (Magic IR) for capturing and playing back IR signals. 

I started researching IR control schemes - after a few days of work, I decided it would be better to code my own IR recorder - this way it's compatible with any TV without having to look through a huge code list.  It's like a learning remote that has greater than 100ns accuracy & unlimited storage capacity.

I'm using a 38kHz IR receiver, which is the most common (95% of devices).  If your devices uses another frequency, it's easy to use a different IR receiver.

All the software & hardware is available under the MIT license, which is essentially public domain.

Using it
I'll get into using it in a bit, but here's the big picture;
  1. Enter the webserver address into your browser
  2. Hit 'Record' to capture IR commands
  3. Initiate playback either by:
    1. requesting a URL (something like: http://192.168.1.252/exec.cgi?x- where x is the command number), or,
    2. through the web interface on your smart phone or PC.

Step 2: Make It: Materials


The Web Clicker is based on a Propeller Platform USB and an E-Net Module.  The Prop Platform USB comes pre-assembled, and the E-Net is a kit. 

You can probably build this all on a breadboard or protoboard (except for the RJ45 jack), but it might get pretty cumbersome & out of place for your TV cabinet. I suggest using a custom board.


Propeller Platform USB

You can grab one here, it comes pre-assembled.  You can also download the PCB design (diptrace format) and etch it yourself.  Most parts are commodity (47uF Electrolytics, 4.7uF Tantalum, Prop, Tactile Switch), a few specific parts;

Voltage Regulators
Use mouser part 511-LD29150DT33R and 511-LD29150DT50R to make sure you have the same pin-out & package size

EEPROM
Use mouser part 556-A24C512BNSH25T, this is a 64kb eeprom so you can use the program on the bottom 32k and load your IR codes to the top 32k.

SD card slot
Use mouser part 798-DM3D-SF, this is a push-pull slot, so it's easier to re-work if you have any problems.


E-Net module

A kit is available here, or you can grab the PCB layout here to etch it yourself.  Here's the schematic (pdf), only a few special parts;

ENC28J60
It's mouser part 579-ENC28J60/SP, make sure you get the DIP-28 package.

PulseJack
Mouser part 673-J00-0065NL

Additional Parts

In addition to the E-Net and Prop Platform SD, you'll need 2 more parts;

IR Receiver
You'll only use this once to capture IR codes, this vishay (mouser part 782-TSOP4838) is nice because it works at 5v & 3v.  It's a 38kHz receiver, which is the most common, they also make receivers for other modulations.

IR LED
No special trick to transmitting IR codes, you just need a generic IR LED.  This one (mouser part 638-IR333-A ) works for me.


Step 3: Make It: Schematic

The schematic for the Propeller Platform USB is here (pdf), and the E-net module schematic is here (pdf).  If you've etched your own E-Net module or bought the kit, assembly instructions for it are here.

In addition to the E-Net and Propeller Platform, you'll also need to build a simple IR transmit / receive circuit.  Here it is;


I'm using the wrong symbol for an IR receiver,  but it's the device at U1.  Hopefully it doesn't look too complicated - you just hook the long lead of the LED to P12, the short leg to ground.  Hook up the first pin of the IR receiver (the pin on the left when the dome is facing up) to P12, the middle pin to ground, and the 3rd pin to V33.  Here the circuit is on a ProtoPlus.

Step 4: Make It: Software

Grab the code
Download all the code here, copy to your desktop and unzip it.

Edit the settings
The webserver IP stuff needs to be set up.  First, download the Propeller Tool (Windows, Mac, Linux), then open up Top_object.spin.  Towards the beginning, you'll see where the IP settings are;


Change them if necessary, connect the Propeller Platform USB, save the file and hit F11 to program the Propeller Platform.
  • mac_addr doesn't really matter, you should be able to keep it as is
  • ip_addr The Web Clicker doesn't use DHCP, just pick an IP address on your local network that isn't being used.
  • IP_subnet probably 255.255.255.0.  If that doesn't work, take a look at your PC and see what the subnet setting is - use the same setting on the Web Clicker
  • ip_gateway IP address of your router
  • ip_dns IP address of your router
That's it!  Your Web Clicker is ready to go.  Now, just connect to your network - in the next step, I'll show you how to record & script commands.


Step 5: Home Automation-ing

In your web browser, type in the IP address you set in the previous step.  You'll get this web interface;

Code Capture
Here's how it works;  Type a code name (maybe 'Power', or 'Vol+', or whatever makes sense) in the box, then click on the 'Start Recording' button.  put your IR remote up to the IR receiver and push the button.  The command will be stored and the command list will dynamically be updated.  To play that code via the web interface just click on the 'Play Code' link next to the command name.  To clear the commands, click on the 'Clear Commands' link.

Scripting
Once the command has been recorded, you can easily script it.  In Linux / Mac, you just need to make a page request to the web clicker to send the IR;

wget 192.168.1.252/exec.cgi?0- >> /dev/null 2>&1
Will execute the first command on the list (Power on my Web Clicker)

wget 192.168.1.252/exec.cgi?1- >> /dev/null 2>&1
Will execute the second command, and so on.  Change the number after the ? in the url to execute a different command.  The >> /dev/null 2>&1 redirects the program output (and any error codes) to the trash - this is for non-interactive scripting.

If you're using curl, the command is almost the same;
curl --url 192.168.1.252/exec.cgi?1- >> /dev/null 2>&1

You could associate this command with a LIRC input, a chron job, or whatever else.  I don't know how to script in windows, but you can download wget for Windows & that's probably the first step.

Step 6: Next Steps


Once your Web Clicker is up and running, you'll probably want to tweak it / play with it!  Here are a few ideas to get you started;

Local File Storage
The Propeller Platform USB has a microSD / microSDHC card slot so you can add up to 32GB of local file storage.  You could serve MP3's, pictures or whatever else.  You could also use the SD card for data logging.  To start playing with the SD card, grab the fsrw object.

Multiple IR transmissions with a single command
Take a look at the source code - towards the top, there's a section of 'Elseif', which tell the Web Clicker what to do when a command request is received.  You can make the device do anything in response to a command, including sending several IR blasts.

Controlling a motor, switch, light, or anything else
Why not use the Web Clicker to turn on a motor, change a light, play back a wav file or something else?  It's the same process as adding multiple IR transmissions - look at the code with the Elseif commands - instead of playcommand(x), change it to your newly created method.

That's it!  I had a lot of fun putting the Web Clicker together - let me know if you've got any questions or comments!

Be the First to Share

    Recommendations

    • For the Home Contest

      For the Home Contest
    • Big and Small Contest

      Big and Small Contest
    • Game Design: Student Design Challenge

      Game Design: Student Design Challenge

    38 Comments

    0
    JeremyB2
    JeremyB2

    8 years ago on Introduction

    I need one of these also! Anywhere to buy one all ready to go?

    0
    Redhroogar
    Redhroogar

    10 years ago on Step 6

    I urgently need one of these! Has anyone out there got one that's fully working for sale and/or know of a commercially available unit with this functionality. Neat device!

    0
    alterator
    alterator

    10 years ago on Introduction

    on symbian there is an app for this.. Anything that user IR control -- You can control it through your phoner IR transmitter.

    BR

    0
    oakleym82
    oakleym82

    11 years ago on Step 6

    This is the perfect instructable, thanks! This will be my first one. My company recently installed two pan/tilt/zoom cameras in our conference room (that are IR controlled only), as well as an IR controlled video input selector. We want to allow our remote employees to select which camera to view and remotely pan/tilt/zoom them. I'm looking forward to putting this together.

    One question: Do I have to have the SD card? e.g. when I program the device does it go into volatile storage, requiring it to be reprogrammed every time power is lost, or is there some on-board flash?

    0
    Gadget Gangster
    Gadget Gangster

    Reply 11 years ago on Step 6

    The current program doesn't store the code on any non-volatile memory, but you could store it on the Propeller Platform USB's EEPROM, which is built-in, or use an SD card.

    0
    oakleym82
    oakleym82

    Reply 11 years ago on Introduction

    I've been pouring over this for a while and being new to Spin, I can't figure out how to get the LONGs to go to a file or something that I can use to reload the codes when it reboots. Any help would be greatly appreciated.

    Also, I am having the problem where it crashes after recording 5 codes, or sometimes on playback.

    One more thing, any advice on how I could rework it so that I can mimic holding a button like Vol+ instead of clicking it a bunch of times to raise the volume a lot?

    0
    Gadget Gangster
    Gadget Gangster

    Reply 11 years ago on Introduction

    The Spinneret is capable, but it uses a different ethernet IC (a Wiznet) - so you'd need different code. It can be done, though.

    0
    holdenba
    holdenba

    11 years ago on Step 6

    We need to control the selections of different videos to be shown in one projector via our iPhone/SmartPhone and and internet or 3G connection. Can your device do this?

    0
    Gadget Gangster
    Gadget Gangster

    Reply 11 years ago on Step 6

    Maybe, it depends on how videos are queued -

    If there's an Infrared command that switches videos, then certainly. If there's a computer that controls the currently playing video file, the Propeller Platform USB can interface with it over the USB connection - but it's beyond the scope of this instructable.

    Hope it helps!

    0
    holdenba
    holdenba

    Reply 11 years ago on Step 6

    The DVD players have a remote. I thought that maybe that would work.

    0
    Gadget Gangster
    Gadget Gangster

    Reply 11 years ago on Step 6

    Yep, it should, as long as they're IR remotes.

    0
    anankin
    anankin

    11 years ago on Introduction

    it works for me but is it possible that he save codes in memory card??

    0
    StianF
    StianF

    12 years ago on Introduction

    Hi

    Thank you for the code and instructions I just have two problems:

    - The codes are stored in ram, and I want to save them to a sdcard, with one file pr code or in raw. I should be able to make that by my self, but if anyone already have written it, I would be happy to take a peek at your code

    - My clicker crashes after just recording 5 codes, tried to adjust the allocated variable sizes but that shouldn't be the problem since they allow 10 codes (at least?). I think I have narrowed it down to the assembly for recording codes, but I can't figure out whats wrong, anyone have a clue?

    0
    quartarian
    quartarian

    12 years ago on Introduction

    This project is Awesome! Is there currently any way to add wifi to the propellar platform Though? It would be great to have this sit on my coffee table and control all of my devices. Thanks again for posting the great project!

    0
    caseysmiller
    caseysmiller

    Reply 12 years ago on Introduction

    i did not see a wifi module while dinkin around on gadget gangster but I do have a suggestion. A wifi bridge (anywhere from $30-$200 depending on where you buy) will allow you to connect anything with an Ethernet port to a wireless network. You simply plug it into your computer one time to teach it to connect to your wifi then plug any ethernet device into it as if you were pluggin em directly into your router.

    0
    caseysmiller
    caseysmiller

    12 years ago on Introduction

    This project is almost PERFECT for what I have in mind for my entertainment system when I refinish my basement soon. My intention is to have multiple tvs throughout the house connected to a 8x8 hdmi matrix. I know its overkill but heh anything worth doin is worth overdoin right ;). Anyhow a pair of directv receivers and a pair of hd OTA tuners, among other boxes, will be stacked in a cabinet. I would like all remote function to be handled through a web page hosted on my htpc. The ability to activate a code through a simple page call is perfect for this design. Due to this fact I need to have discreet IR blasters for each receiver. Otherwise changing the channel on one will change them both. Is it possible to have a second or even third IR transceiver and be able to set codes to only blast the code over the correct pins. Im sure this is possible but its a matter of how hard would the coding be. I have never played with propeller platform before but i am willing too learn. If nothing else i know i could just build multiple controllers but seeing as i'll be dropping $1k on the hdmi matrix i would like to be able to keep costs down elsewhere. Any help would be greatly appreciated and once again BIG kudos on designing this awesome little toy.

    0
    Calegari
    Calegari

    12 years ago on Introduction

    Hi, i just assembled this project and works pretty good.

    I only have one problem, when i power off the webclicker all the recorded commands are lost, in order to make it save and do not lose the commands, what do i need to do? save everything in the microSD? How can i do that?

    Thanks!

    0
    thrglassdarkly

    Sorry if this is a dumb question - would it be possible to connect multiple IR LEDs or add an extension wire so the LED can be placed further away from the device? I read somewhere that speaker cables can be used for that.

    Thanks