The Most Face Rockingest Project Blog on the Entire Fucking Web
An ATTiny85 Home Automation IR Device
Published: November 20, 2013
My google AD, I know most hackers and DIY'ers hate ads but it brings in around 5 bucks on a good month and I use it to subsidize my hosting fee's so you can get access to my code :)

Problem:

You’ve bought yourself a nice home-automation solution like MicasaVerde or WeMo, but supplying power to your TV only powers it up and puts it in suspend mode.

Solution:

Some TV’s are smart enough to remember that if they were powered down in active mode, when the power returns, boot straight to active mode again. So let’s build a device that replicates this functionality with A small micro-controller hooked up to a 5-volt power source and an IR LED with firmware that flashes the IR code to turn on the TV as soon as it receives power. This way, if you hook the power source for the micro-controller into the same, switched outlet that the TV is plugged into, when the TV receives power, it will subsequently, automatically be turned on.

The Hardware

First, we need to pick a micro-controller. A common and often used one is the Arduino board. But that’s a lot more power than we need for this project, so let’s go smaller. An ATtiny85 has all of the functionality we need but costs a whole lot less and with it’s few pins and internal clock, will be a lot simpler to wire up! Here’s a bill of materials for this project:

The Firmware

The Arduino sketch for this project is deceptively simple. Ken Shirriff’s Multi-Protocol Infrared Remote Library for the Arduino is what does all the magic! The tough part will be getting the codes to your own TV. I used my own IR Shield to get the codes that I needed, but for this purpose, all you really need is a spare Arduino and and IR Receiver. Ken has parts and schematic information on his site.

Putting it all Together

Here's how I program my ATTiny's! It's an arduino mini from sparkfun.

Here’s how I program my ATTinys! It’s an arduino mini from sparkfun.

First, you’ll need to pick your programmer for the ATTiny85. This programmer from sparkfun will get the job done. Alternatively, you can build your own if you’ve got a spare Arduino sitting around (Who doesn’t?!). This tutorial from High-Low Tech will walk you through setting that up. I ended up building a board using an Arduino Mini from Sparkfun. I really like this method because the board was really simple to put together (I’m using the schematic from High-Low Tech), cheap and my Arduino mini is not permanently committed to Attiny programming duty. Though, I may make another version with a Zif socket; it can be a bit of a pain inserting and removing the ATTiny.

Next, if you’re using the internal timer in the ATTiny85 you’ll need to calibrate it for it to be precise enough for replaying IR codes. The TinyTuner Arduino Library will accomplish this for you, have a look at Nathan Chantrell’s blog entry under the heading ‘Calibrating the oscillator’ for a nice explanation of the process.

Putting the board together is a snap, there’s no difficult soldering here, it’s all well spaced through-hole soldering. Take a look at my schematic and some images of  what the board looked like completed.

Talk about a simple board, it's an IR Led, a resister ATTiny85 and some pins and pin sockets.

Talk about a simple board, it’s an IR Led, a resister ATTiny85 and some pins and pin sockets.

Is there a name for this type of soldering? It's not pretty but it was easy, it's solid and it works.

Is there a name for this type of soldering? It’s not pretty but it was easy, it’s solid and it works.

This is basically the 'Hello World' of microcontroller schematics.

This is basically the ‘Hello World’ of microcontroller schematics.

Final Setup

Lastly, it’s important to set the LED properly in view of your TV’s IR receiver. I used a little bit of velcro tape to attach the board to the TV. This worked well except that my device can only control the TV. I’d like to have it also turn on my sound bar while it’s at it. A revised version of the board could include two connectors for LEDs instead of one permanently connected LED. That way, I could put IR LEDs on the end of some wires and place them next to the receiver of each appliance. That would also allow me to hide the little circuit board.

I put the old, useless remotes next to my project to shame them.

I put the old, useless remotes next to my project to shame them.

--

Hey thanks for reading this far! Maybe you'll be interested in more of my projects? Check out my homepage :)
This entry was posted in Hardware and tagged , , , . Bookmark the permalink. Follow any comments here with the RSS feed for this post. Post a comment or leave a trackback: Trackback URL.

3 Comments

  1. Julian
    Posted Nov 25 at 4:24 pm | Permalink

    I need a way to do something similar. I want to monitor a 7 inch digital tv for openings on channel 2 but the TV will shut itself off after a few minutes if no tv signal is received. I need to send it any remote code and that will cancel and reset the timer in it. So if I can send it a code every 3 minutes, it will stay on indefinitely.

    • Posted Nov 25 at 4:33 pm | Permalink

      Yup, makes sense, it sounds like my exact setup would cover your situation. Instead of a power code, change it to whatever would cancel the timeout. And put it into the loop function instead of setup. Also, instead of every three minutes, I would put a delay in the loop that is just slightly shorter than the length of time that it waits with the time-out prompt. That way, you wouldn’t have to worry about the exact timing of when the prompt comes up.

  2. Chad
    Posted Feb 06 at 10:22 pm | Permalink

    Love the post! I’m trying to do the same things, however, running into trouble with the sketch. I’ve got Ken’s Library. The second I try to reference the object it throws a pile of errors. Any thoughts? Did you have to do something special?

    ERRORS:

    C:\Users\Chad\Documents\Arduino\libraries\IRremote\IRremote.cpp: In member function ‘void IRsend::mark(int)’:
    C:\Users\Chad\Documents\Arduino\libraries\IRremote\IRremote.cpp:227: error: ‘TCCR2A’ was not declared in this scope
    C:\Users\Chad\Documents\Arduino\libraries\IRremote\IRremote.cpp:227: error: ‘COM2B1′ was not declared in this scope

3 Trackbacks

  1. […] We love home theater hacks and this one especially since it is also part of a larger home automation project. [Falldeaf] use Z-Wave wireless home automation and includes mains switching for his television. The only problem being that when power is switch back on the TV remains in the standby state. His solution was to use an ATtiny85 to detect power, then push the IR code to turn the TV on after a short delay. […]

  2. […] We love home theater hacks and this one especially since it is also part of a larger home automation project. [Falldeaf] use Z-Wave wireless home automation and includes mains switching for his television. The only problem being that when power is switch back on the TV remains in the standby state. His solution was to use an ATtiny85 to detect power, then push the IR code to turn the TV on after a short delay. […]

  3. […] We love home theater hacks and this one especially since it is also part of a larger home automation project. [Falldeaf] use Z-Wave wireless home automation and includes mains switching for his television. The only problem being that when power is switch back on the TV remains in the standby state. His solution was to use an ATtiny85 to detect power, then push the IR code to turn the TV on after a short delay. […]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">