Thermostat Controlled TV Volume

Controlling TV volume with the house thermostat. If you're thinking WTF? click through for details!

Similar projects worth following

- When the a/c or heat is on at my house, the fan is noisy and makes it hard to hear the TV

- When you turn the TV up loud enough to hear it over the HVAC fan, it is way too loud when the fan turns off. This makes watching TV a constant exercise of manually adjusting volume up or down every few minutes (worse on really hot and really cold days).


I want to sense when the HVAC fan kicks on and off, and automatically adjust the TV volume appropriately.


This will alleviate the physical burden being imposed upon my right thumb which currently has to move several times every hour to keep the volume at the correct levels.


1. The 24 VAC thermostat fan line connects to a rectifier and a transistor that control an input on an Arduino Nano.

2. An output on the Nano connects to a transistor that closes a button on the Adafruit TX(keyfob).

3. The Adafruit RX(pcb module) sends a pin high when the button on the TX is pressed.

4. The RX pin goes to an input on the Adafruit Trinket, which has two outputs controlling transistors that close volume up and down buttons.

When the Nano senses the thermostat fan line, it pulses the TX up for 500 ms. When this happens the Trinket presses the up button 5 times. Next time the Trinket presses the down button 5 times. Simple as that, the Nano and Trinket can be replaced with any old microcontroller board, they are just what I had around.


#include <avr/power.h>
#include <avr/sleep.h>

int up_pin = 4; // up volume
int down_pin = 0; // down volume
int up = 1;
int down = 0;
int toggle_times = 5;
int flag = 1;

void setup() { 
  pinMode(up_pin, OUTPUT);
  pinMode(down_pin, OUTPUT);
  power_timer1_disable();    // Disable unused peripherals
  power_adc_disable();       // to save power
  PCMSK |= _BV(PCINT1);      // Set change mask for pin 1


void loop() {
  GIMSK = _BV(PCIE);     // Enable pin change interrupt
  power_all_disable();   // All peripherals off
  sei();                 // Keep interrupts disabled
  sleep_mode();          // Power down CPU (pin 1 will wake)
  GIMSK = 0;             // Disable pin change interrupt

  if (flag) {
    toggle(up,toggle_times); // up, 5x
    flag = 0;  
  else {
    toggle(down,toggle_times); // down, 5x
    flag = 1;  

void toggle(int direction, int times) {
    if (direction) {
      for (int i = 0; i < times; i++) {
        digitalWrite(up_pin, HIGH);
        digitalWrite(up_pin, LOW);
    } else {
      for (int i = 0; i < times; i++) {
        digitalWrite(down_pin, HIGH);
        digitalWrite(down_pin, LOW);

ISR(PCINT0_vect) {} // Button tap
int ledPin = 13;
int inputPin = 12;
int ac_status = 0;
int ac_status_old = 0;

void setup() {
   pinMode(ledPin, OUTPUT);
   pinMode(inputPin, INPUT_PULLUP);

void loop() {
  ac_status = !digitalRead(inputPin);
  if(ac_status != ac_status_old) { // low to high or high to low
  ac_status_old = ac_status;

Microsoft Trust UI Provider - Certificate Trust Link - 3.58 MB - 02/07/2016 at 18:29


Microsoft Trust UI Provider - Certificate Trust Link - 654.67 kB - 02/07/2016 at 18:29


Microsoft Trust UI Provider - Certificate Trust Link - 60.43 kB - 02/07/2016 at 18:29


View all 10 components

  • New remote 3D printed and working!

    Alex Rich02/07/2016 at 18:53 2 comments

    I finally 3D printed my redesigned remote control and it all seems to fit! The biggest challenge was getting all of the buttons to align, but I checked that using a simple 2D print on a piece of paper before I went to 3d printing. There are a couple of minor things I would tweak but overall this is a good replacement for an F-ed up Bose Lifestyle remote.

    If you recall, my dog ate the original remote that I hacked. I could have ordered a new one for like $50 but I have access to a 3D printer so I thought why not reverse engineer the remote housing. Below you can see the old chewed up plastic and the new one. I also was able to incorporate a mount for a slider switch. This cuts power to the radio receiver when I'm not using the TV to help the batteries last longer.

    Some more pics of the new remote parts:

    notice a blob of hot glue below, this is because the batteries were springing out of alignment and not staying down, so I sprayed a bit of WD-40 on the batteries, put a blob of hot glue on and closed the battery door. Once cooled it was a perfect mold to hold the batteries in. In the future I would 3d print a support on the door to hold the batteries in place.

  • Finishing the remote CAD design

    Alex Rich01/10/2016 at 13:34 0 comments

    In this log I'm going to show the process I used in CAD to finish up the enclosure for the remote. This involves taking the blank enclosure shape and adding a cavity, a battery compartment, battery door, supports for the PCB, bosses to connect the enclosure halves together, and anti-wobble nubs.

    CAD can seem daunting but really it involves a series of simple steps that can result in something fairly complex. I am going to try to walk through the steps to remove some of the mystery from the process. See previous logs for how I did the main enclosure design as well as the button pad on the other half of the enclosure.

    Starting point:

    Final result:


    1. Shell

    Using a shell command, I take the solid enclosure model and create a cavity with constant 2mm wall thickness in all places. Shell is one of those commands that most CAD programs have. It should also be noted that the shell command likes simple smooth surfaces, if you try to shell something with too many funky shapes it will most likely fail, so it is best to shell early on in a design.

    2. Battery compartment

    The battery compartment will be indented into the main enclosure shape and will have a 2mm wall thickness around it as well. Below in orange I have begun to model the "air" in my battery compartment. The orange piece is a separate body that is not physically merged to the main enclosure.

    Below you can see I have added additional detail to the orange body, these details will be indented into the main enclosure.

    Hopefully the below picture shows clearly what happened, the orange body was used as an indent tool on the main enclosure. There is definitely more than one way to achieve this result, I have always liked using an indent because it is more versatile if I ever want to go back and make changes I can just roll back and change the orange part and the indent will automatically update.

    After indent is done the orange part is no longer used and can be hidden or deleted. Below is the result with the enclosure shown as opaque rather than transparent.

    another view

    Next I created several cuts for the battery springs on the PCB to fit through the battery compartment. I also cut away an area for the battery door latch to clip in (upper right of the battery compartment). Before the cuts I added support ribs for the PCB, making sure they are in areas where there are no components. The purpose of these ribs is to add support to the PCB to prevent the board from flexing too much when buttons are pressed on the remote.

    3. Creating the battery door

    The battery door will follow the same shape as the enclosure before the battery compartment was indented. To get this geometry back I rolled the design back to just before we created the indent, after the shell command. Then I made a copy of this body:

    From here I cut away everything except the portion that will fit in the battery compartment. This was done by offsetting the edges of the battery compartment opening on the main enclosure by 0.01" to cut away the door plus a little clearance. 0.01" is a good clearance for 3D printed parts that you want to slide smoothly, if you go tighter than this you will probably end up sanding to get things to fit.

    Next I added snaps so the battery door will click into place in the battery compartment:

    Finally I added a little indent to indicate where you press with your thumb to open the battery door:
    Below is the door shown through the transparent enclosure:

    Here are the real parts I have just recreated. Obviously the real remote enclosure has a few more details, I have intentionally simplified for this design.

    4. Slider switch mounting

    I want to have a hard off switch for the electronics I am adding to the remote. This minimizes battery drain when I'm not using the auto volume control. For this I am using a sliding switch I had laying around, it will fit in a small box in the enclosure with a slot for the sliding switch to protrude out of the enclosure. This is not a panel mount switch so I will hold it in with a...

    Read more »

  • Reverse engineering the remote enclosure

    Alex Rich12/03/2015 at 01:04 0 comments

    Since my dog ate the remote, I figured it would be cool to design a new housing for it. The new housing will be 3d printed and can include any custom features I want. The first step, however, is to just recreate the original remote enclosure as accurately as possible. One of the trickiest parts is getting the silicone button pad on the original to match with the new remote. Below are the steps I took to (hopefully) match the button pad fairly closely:

    1) I took a picture that was as "straight on" as possible to capture the button locations. To remove most of the perspective effects, I mounted my camera to a ceiling joist in my unfinished utility room. Then I zoomed in on the remote.

    2) I pulled the picture into CAD (Solidworks in this case because I'm faster with it, but you can also do this in Onshape for free) and scaled the image according to the tape measure in the picture. After this it was a matter of sketching the buttons on top of the picture.

    3) After this I sketched the remote outline and then printed the sketch to scale on paper. This let me compare my sketch with the real remote using a lightbox, but you could also just hold it up to a light to get a decent idea.

    It took me several tries to get this right, despite having the tape measure in my picture I had to scale and iterate about 3-4 times to get it to look like the picture above.

    4) Now that I know the buttons on the old remote will align reasonably well, I am moving forward finishing the enclosure design. Below are a few pictures of that process:

    Need to finish the back of the remote including battery compartment and my replica of the original remote should be finished. Then I can decide if I want any extra custom features before 3D printing.

  • Dog ate my remote

    Alex Rich11/25/2015 at 01:13 0 comments

    After all the hacking, gluing receiver and trinket modules into my remote, wiring up buttons, switches, working on code, etc... the damn dog ate the remote while I was at work

    He said he didn't do it

    I think he actually ate one of these SPST switches

  • Need help putting Trinket (ATtiny85) to sleep

    Alex Rich11/11/2015 at 00:47 0 comments

    Despite adding code to put this thing to sleep when not in use, it is still drawing 8 mA. I assume when it goes to sleep the green power LED should turn off as well (but it never does). This is killing my remote batteries every 2-3 days. I can't figure out why it isn't going fully to sleep and drawing micro Amps. Anyone have any thoughts? My most recent Trinket code is in my project details, any help is appreciated.

    Another note - I have a hard switch that turns of the transmitter module, so that is not the culprit.

  • Trinket Issues

    Alex Rich10/28/2015 at 21:46 2 comments

    Did you know the Trinket uses a firmware bootloader so you can program it via USB? It does, and it's a clever solution since the ATTiny85 has no USB hardware. Somehow, due to my own ignorance, I managed to dick up the bootloader by messing with interrupts. I basically copied and pasted someone else's sleep mode code which included setting interrupts, but I missed the ISR at the end of their code. One of the firmware guys I work with says this can cause bizarre things to happen, and I guess those bizarre things include breaking the bootloader.

    So my trinket was bricked which normally would mean buying another one for $6, but in this case it was an Fing disaster because I had already glued it into my $90 Bose remote!!! :

    I was relieved when I googled and found these awesome instructions for repairing the bootloader using an arduino uno!

    Finally a use for the Uno which is a massive brick of a board. I thought that thing was obsolete but apparently it can be used as a faux AVR programmer. Pretty cool, this is why I buy shit from Adafruit, they think of everything. Here's a shot of the UNO configured to program my Trinket's bootloader back on.

    Believe it or not, it worked on the first try! Super easy, what a cool hack that is. So I fixed my Trinket code and I'm back in business now.

  • Sensing the thermostat

    Alex Rich10/28/2015 at 12:29 0 comments

    Finally got parts for my rectifier to allow me to sense the 24 VAC thermostat lines. Works great, in the picture below you can see it is turning on the LED in response to the heat turning on.

    Nothing frying yet so I guess it's all good! the rectified signal is like 32 VDC, this presumably is because the 24 VAC is an RMS value, 32ish must be the peak to peak voltage.

    Next step is to hook my keyfob up and zip tie this somewhere inside my furnace control enclosure.

  • Remote Side Working

    Alex Rich10/18/2015 at 22:06 0 comments

    Ok this is a fairly trivial accomplishment from an engineering standpoint, but it really highlights how you can do some cool stuff with a small amount of tinkering.

    Basically I hacked my tv remote control to have its own remote control. When I press the button on my remote's remote, a transistor presses the "volume +" button 5 times. When I press said button again, the "volume -" button gets pressed 5 times.

    This way I have two quick states, one for loud when the a/c is on and one for quiet when the a/c is off.

    RIght now the transmitter side is manual, I press a dongle with my finger. It saves me some button presses, but isn't that useful in this state. The next step in this project is to use my thermostat control lines to control the transmitter automatically.

  • Closing a switch with 24 VAC

    Alex Rich10/03/2015 at 03:05 0 comments

    So I was a little bit stumped about the right way to automatically press the button on my keyfob transmitter using the 24 VAC signal in my thermostat as a control signal. The keyfob button connects 12V to an input pin on a transmitter chip to send it high. So in this case not only is the control signal AC, but the voltage is 24 V which is higher than the 12 V I am switching on the keyfob.

    I looked at 24 VAC relays for a simple fix, but those were huge and were obviously designed for carrying serious current.

    So then I hopped into Hacker Channel and asked for a bit of help! Thanks to some pointers from @Kumar, Abhishek I now have a neat circuit planned out.

    It turns out the switch is doable, but the circuit is more complicated than I had hoped.

    1. First I have to rectify the AC with a diode, this is obvious otherwise my switch would be flipping off and on at 60 Hz. Without some filtering I would still have an oscillating signal, so a filter is added after the diode to sufficiently reduce ripple and make it look like DC. Not sure what the DC voltage will end up being, but I have to assume 24 VDC for now.

    2. Just hooking up a single BJT or MOSFET won't work because 24V is probably too much to control most MOSFETS (I looked it up and max Vgs appears to commonly be 20V). A single transistor won't work because control voltage has to be lower than the voltage you are switching or current won't flow. So ultimately the solution is using two transistor stages with an NPN controlling a PNP that actually does the switching.

    I don't completely get that last part, it seems like my button is shorted all the time through the base and collector of the PNP transistor.... maybe I need to read up on PNPs some more, but I thought there is current flowing from base to collector to keep it off, which would mean current is flowing across the contacts of the button whether the transistor is switched on or off... I don't know, let me think that through.

    Thanks again Abhishek, he even drew the circuit in KiCAD for me!

View all 9 project logs

Enjoy this project?



salec wrote 01/23/2018 at 09:41 point

Hi Alex,

I saw your comment on your other project page.

I got an idea about that, but maybe you already tried it and rejected it earlier:

Did you initially intended to supply the apparatus from the thermostat switch? Your thermostat detection circuit looks like it was meant to collect energy from the thermostat output, but then was re-purposed to just provide answer to question "is fan on or off?".

  Are you sure? yes | no

Alex Rich wrote 01/23/2018 at 13:40 point

@salec Thanks for the comment.  Actually the apparatus on the thermostat was powered by a USB cable plugged into an outlet.  I never tried to harvest power from the thermostat output or anything like that, was just trying to answer "is fan on or off" as you said.  This triggered a message being sent to the receiver I put in the remote control, the receiver then told a little arduino to pulse the volume buttons up or down a few times depending on the fan state.

The problem I ran into was putting the arduino (adafruit trinket) into a low enough power state.  I played with code and did a lot of googling but couldn't figure it out, it just drew 8mA no matter what which is too high for a remote control (I had to change the 4 AA batteries every 2 days).  This required me to put all of the remote circuitry on a hard switch rather than being able to leave it on all the time.

  Are you sure? yes | no

salec wrote 01/23/2018 at 18:52 point

50$ ! What a rip-off! They made a remote which is not IR so that you couldn't replace it with one of many cheap universal programmable IR remotes.

I think they deserve to have their remote's PCB caged in a mains-supplied project box with a micro controller operating not just volume up and volume down, but each and every remote button, and the box should be placed near TV, accepting IR commands from an universal IR remote (or even better, one built by you, now that you know how to make enclosure, and can reuse their buttons on a new PCB of your design), as well as from your system for automatic volume adjustment.

  Are you sure? yes | no

Alex Rich wrote 01/23/2018 at 19:15 point

I would love to switch to a universal remote and have all this in a project box.  That's not a half bad idea!  Who knows if I'll ever find the time to start that project though.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates