This was probably one of my most time consuming projects. Hopefully I can do some justice to the time and work spent through this post. I should probably begin by describing the whole system. First, the TV is lifted up & down by a"Lift Tech" lift. Their controller box has a port that allows home automation systems to control its operation. They did a really good job of making it extensible; you can control it in a variety of ways: short one pair for going up, another for going down; short a pair for down, open for up; etc. I had intended to use the first mode, but I think I fried a channel on my opto-isolator, so I ended up using the second method because it only required one channel. That means I can only have the TV up, or down. This isn't really a problem, though, because I don't expect to want it any other way very often.
The board I designed to interface the TV Lift to the server was fun to design and build, even though it was prone to error. I had originally intended to use the Microchip ENC28J60 ethernet controller. I thought it'd be cool to have the iPhone app connect directly to the board's ethernet controller and microcontroller. Unfortunately, I screwed up the interface from the ethernet controller (specifically the physical layer circuitry) and the magnetics. This interface is harder than it looks, trust me. I included a serial port on the board (which I had other plans for) and used that instead. This choice made the microcontroller software extremely simple. All it really has to do is wait for a 'd' character over the serial port and lower the TV. A 'u' character lifts the TV, and an 's' character queries the controller for the current state. I've included an image of the schematic for the board, in case you are curious about my lofty intentions.
If you're interested, the board I used on my reflow soldering toaster oven page is the TV Lift board. Here is a picture of it mostly finished up:
There is one more thing that I had to change. For some reason the controller board that I made crashes after a while. I have to use a ladder to reboot it (via a power-cycle). Hauling the ladder around is annoying, and I don't like doing it. To allow myself to reboot it remotely, I added a diode from the MCLR line(reboot) of the microcontroller to the RTS line of the serial port. The RTS line is used for modems from back in the day, and is rarely used. Now I can use it to force MCLR low, to reboot the controller. It's a hack, but it's much better than climbing ladders.
The software for this project is deceptively simple. The iPhone software basically connects to the server using a socket, and if the "up" button is pressed it sends a 'u' over the socket, and a 'd' if the down button is pressed. That's it! Server software is almost identical, however it listens to the return of the serial port and expects my controller board to return a 'U'or a 'D' from the 'u' and 'd' command. If these are not received, the board is reset and the command is tried again.