Update:
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.
ADAFRUIT TRINKET (RX / BOSE REMOTE) CODE:
#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
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_enable();
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);
delay(500);
digitalWrite(up_pin, LOW);
delay(500);
}
} else {
for (int i = 0; i < times; i++) {
digitalWrite(down_pin, HIGH);
delay(500);
digitalWrite(down_pin, LOW);
delay(500);
}
}
}
ISR(PCINT0_vect) {} // Button tap
ARDUINO NANO (THERMOSTAT / TX CODE)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);
delay(1000);
if(ac_status != ac_status_old) { // low to high or high to low
digitalWrite(ledPin,HIGH);
delay(500);
digitalWrite(ledPin,LOW);
}
ac_status_old = ac_status;
}
Hi Alex,
I saw your comment https://hackaday.io/project/34266-chewed-up-remote-repair/discussion-99377 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?".