Search This Blog

Turn On Devices with your TV

Alright, there isn't really a fast way of explaining the
background to this project, so buckle up your patience belts and stay with me
for a paragraph or two. I'm using my old 5.1 surround sound PC speaker set with
my TV, hooked up through a PC I built for the purposes of playing media through
my NAS. I believe the youths call this a Home Theatre PC, but what do they
know. Everything was running fine, except for one major issue: when I turn on
my TV, the speakers don't turn on with it. The speaker set gets pretty hot after
a while, so I wasn't prepared to just always leave it on, and I certainly
wasn't about to get up every time I turned the TV on or off. No sir. So I set
to work to figure out another way.

At first I was thinking of building an elaborate setup with
an Arduino and an IR receiver, to capture the TV remote's power signal and
trigger a relay connected to the plug of the speaker set. But this wouldn't do
because

It was elaborate but too easy (setting up the Arduino would take an
hour, and would be a waste of a good microcontroller

The
microcontroller in the speakers resets every time the power dies, resetting the
volume to 0 and the bass to middle (which for my set, in an apartment, is a
ridiculous amount of bass).

The second issue is resolved easily enough: route wires from
the power switch inside the speaker controller dongle thingy and use a relay as a
parallel switch. The first issue is resolved with a personal challenge: no
microcontrollers.

With this in mind, my next idea was to find a way to attach
flywires to the TV's power LED, which is only on when the TV is on... but that
would involve taking apart my new flatscreen TV, which just wasn't going to
happen. I thought about using a photoresistor placed in front of the LED, but
that gets ugly (aesthetically).

Spotted the theme yet? I'm lazy and fussy. It's a winning
combo.

Then it dawned on me: my TV has two USB ports, one for
external storage, the other for ?? (wifi dongle I think, which I don't need).
After a quick test to double-check I confirmed things:

TV On = USB Power On (5V),

TV Off = USB Power Off (0V).

Win.

So how does I gets TV make speakers go? Well, I tried making
guttural noises while waving my hands from the TV to the speaker dongle, but
that didn't seem to help. So I put on my braining hat and set to figuring out
how to make it happen.

The challenges were:

I don't want there to be any chance of wrecking my TV's electronics

I don't want to use an external power source (ran out of plugs)

When the TV first comes on, the USB voltage flip-flops for a few seconds meaning a simple rising edge detector will turn the speakers on and off a bunch which is no good

Since I've already been pretty long-winded in this post, I'll save everyone the chatter about how I slowly figured out how to make this work, and cut straight to the schematic:

If we go from left to right: the TV's USB power lines come
in (through a stripped USB cable) and feed into an opto-isolator which,
surprisingly, isolates the TV signal from the rest of the circuit. Now, the
power signal gets fed into an XNOR gate which acts as an edge detector. How
does it do this? Well, simply put, in this case the capacitor acts as a buffer,
or a slowerer of things. So when the incoming signal goes from high-to-low or
low-to-high there is a momentary difference in the inputs at the two terminals
of the XNOR gate. This difference is big enough that momentarily the XNOR inputs see a logical 1 and 0, which triggers the gate.

When the XNOR gate turns on
it pulls the output low which triggers a 555 timer configured in monostable mode. What
that means is it will turn on for a set amount of time after being
triggered by an input pulse (inverted, so normally high, pulled low - this is
what the 555 timer needs, otherwise I'd use a regular XOR gate). While it's on,
it essentially ignores the input signal, which is perfect for dealing with the unwanted signal changes.

I configured the timer to last about 7 seconds, enough to
get past all the USB voltage flip-flopping as the TV turns on. The 555 timer
output is fed to a relay which is connected in parallel to the speaker's power
button. I also use the speaker's 5V supply to power the circuit, since it was
easy enough to do once I cracked the unit open. I put some links to the
websites and documents I used at the end of this post for reference.

Here's my speaker controller dongle thingy...

And if you pull the little
rubber feet off the back you can easily take it apart.

The microcontroller is on the back of the circuit board, and
I used a multimeter and the microcontroller's datasheet to figure out what pins
were 5V, ground, and the power switch. I drilled a small hole next to where the
cable comes out to run these 3 new wires out to my circuit.

After a bit of testing with a regular 5V supply I was ready
to plug it all into the TV and speakers. It did the job perfectly!

About half a year later I finally decided to finish this
project off by soldering it all up and putting it in an enclosure.

It took 6 hours of work to make it look this tidy. Again, fussiness
for the win.

All closed up. Bigger than it needs to be, but still not
going to get in the way.

All done, and never to be seen again!

I'm really happy with the way this project worked out, as
it's proven to be a reliable circuit, and very convenient. Hopefully this post
will inspire others to control stuff using their TV and at the very least remind
us all that there's a complicated time consuming solution to every problem in
life, so long as that problem uses electricity.

Comments

great job! But why no microcontrollers? You mentioned that the bass levels are always reset as soon as the speakers are powered off, and the current solution does not take care of that, right? That may be something that is easier to implement with one of the smaller AVRs (e.g. http://www.atmel.com/devices/ATTINY9.aspx) or a PIC. Even though programming it sure takes some time, it would simplify the build drastically.Just a thought.

Not using microcontrollers was just a challenge I gave myself to make this project a little more interesting. I guess I didn't indicate it too clearly in my post, but my current solution doesn't reset the bass or volume because it works the same as pressing the on/off button on the speaker controller. So long as the unit is plugged into the wall, the controller is supplied with power so it remembers the values. I agree that a microcontroller based solution would be simpler, but where's the fun in that?! :)

You make me blush! Unfortunately I can't really say I have any go-to books for electronics/electrical engineering. School provided me with tons of overpriced textbooks that taught me super-specific knowledge about a variety of aspects of electrical engineering but I can honestly say they contributed very little to my practical application of circuit design. My real knowledge came from my work terms, and even then my most beneficial work term was one where I had absolutely no supervision or guidance. I was simply given a circuit and expected to make it work. But to actually start answering your question, here's what I'd do:

It is good to have a reference handy, and if you want a book for that I'd suggest looking through what SparkFun recommends, since those guys are pretty great. I just took a quick glance and if I had to pick out a decent getting-started book I'd probably go with:https://www.sparkfun.com/products/9458

That being said, if you have very little existing knowledge in this area then a book like that might be a little over your head at first. I know it was tough at first for me. You have to take things in small steps.

What worked best for me was starting with some really simple projects that I could put together, see that they worked, and then figure out why. Or start with a slightly tougher project that will do something you're really interested in, which you can break down into easier chunks. I started with making a simple robot, following this tutorial:http://www.sparkfun.com/tutorials/129Or, simpler still, start by getting an Arduino, a breadboard and some random parts, such ashttps://www.sparkfun.com/products/10173And work through some of the tutorials here:http://arduino.cc/en/Tutorial/HomePage

If you combine all this with the textbook, you can spend the time after each tutorial figuring out what just happened.

I hope that kind of helps you get off to a good start. Remember Google is your friend!

I'm guessing that the speaker set only resets the volume and bass when the whole set is unplugged. In other words, you're only triggering the set's soft "on/off" switch which toggles power to the amplifier, while the 'brains' of the unit remain powered on (and remember your settings) as long as the set is plugged in to mains.

Also, thanks for writing your article in such a manner that doesn't assume I have an Electrical Engineering degree. I know what a 555 is, but nothing's more annoying than someone writing "so I connected it through a *jargon* circuit and it got all better." without explaining why it did, let alone what the circuit is/does.

Hi Jon. I love this project the idea of using real circuitry instead of a microcontroller. As a learning exercise, I'm trying to build one for myself and use it for both my speakers and my ambilight (http://dhowdy.blogspot.com/2011/10/i-have-updated-my-diy-arduino-ambilight.html).

I'm still cutting teeth on circuitry and need a little bit of help. Could you post some more pictures of the top and bottom of the device if it wouldn't be too much of a bother? It'd be a big help and I'd certainly appreciate it!

Hi Don. Unfortunately I don't have any other pictures of the circuit board, but I actually made the schematic after I built the board, so the schematic should give you all the information you need to get going...

Hi Jon. I came across your blog while I googled the internet for something similar. Instead of turning speakers on and off with TV, I need to turn a powered USB hub on and off with TV. Since I don't have the on and off button to tap into, it seems that I need a electronic switch to turn the USB hub on and off. Do you have any switch to recommend or do you have any better idea to realize what I am trying to do? It is greatly appreciated for your any advice.

If you just want the switch to be on while the TV is on, I would think that you could either use this existing circuit, and reconfigure this 555 timer to latch on (essentially just making a debouncer), or if you don't care so much about that, you could use an XOR gate and cut out the 555 timer altogether (output of XOR goes straight into R6).

Thank you Jon. After further thinking about it, instead of tapping into the USB hub, is there a way to tap into a wall mount power outlet to make it on and off with the TV? I know there are master slave power strips out there but these strips usually don't work well with my plasma HDTV. In addition, I am mounting the power strip at the back of my TV with very limited space. It will be great if I can turn the entire wall mount outlet on and off with TV. Thank you in advance.

Post a Comment

Popular Posts

I am the proud owner of a 2007 Hyundai Sonata GLS (base model). While I have been very happy with the car in general, one thing that's annoyed me from the start is the lack of an auxiliary input for iPods/MP3 players. I do a lot of long highway trips, and it always seems as though the moment you find a good radio station it starts to fade out. If you've used one of those cigarette lighter FM transmitter thingers, you know that they suck, especially around big cities, and when you're on the road it's near impossible to find a frequency that doesn't get interference along the way.

My fiancé has a base model Nissan Versa, and she spends a lot of time on the road with it for work. I wanted to give her the gift of hands-free calling too. I am not a fan of the user interface on my own Sony receiver, so I decided to mix it up a little. Here's what I bought:

This setup guide is intended for people who have bought a SparkFun Bluetooth Mate and are looking to quickly get it working with their Arduino.

The Bluetooth Mate is really easy to use, but you have to know exactly how to configure Windows for it to work properly. Hopefully this quick guide will have you up and running in a few minutes, and will spare you from hours of wondering why you can't get the little green light to come on.