Smart Apartment HVAC

My apartment has, lets just say lackluster heating and no air conditioning or ventilation. So, I'm building a simple "smart" system for it.

Similar projects worth following
The basic system requirements are

-Actually controls temperature relatively well - needs to keep the areas I live/work/sleep within a couple degrees of the setting.

-Good airflow. I should be able to get outside air occasionally and should be able to get some air movement everywhere. This is actually more difficult than it sounds though, the apartment layout is terrible for this.

-Fully automatic, I don't want to be turning anything on/off all the time, except maybe the system as a whole when I get home.

-Should avoid using heat/ac if possible. It always kills me to run the AC when it's already colder outside than inside. Run a fan from outside in that case.

-Zone control, can set different rooms to be regulated or not. Kitchen doesn't need cooling/heating at 2am. Well most nights anyway.

-Some kind of scheduling. Doesn't need to be super fancy, but some kind of "I need everything at temp at 5pm"

Secondary requirements 

-Should not require, or require as little as possible, mains wiring.  Not super comfortable with having something run unattended, 24/7, with mains, that I build as cheap as possible.  

-Rental friendly.  This is a rental. 

-As cheap as (reasonably) possible, but balanced with:

-No huge-effort parts.  I'm not making any boards for this or spending a week getting some API or special toolchain working.  

-No vendor subscriptions/APIs/services.  I don't want this breaking in three months when someone changes their system or takes it offline or puts it on a subscription.  Or my internet goes down.  Or run out of "free" sensors or something and have to "upgrade to premium".

-Should use vent fans whenever possible, whenever it's closer to the target temperature outside.  I like me some fresh air AND it's more efficient.  It's just inconvenient sometimes at the moment, this should make it convenient.  

-As quiet as possible.  Or at least not obnoxiously loud.  Infrequent noises/beeps/clicks are the worst.  No mechanical relays in the bedroom, for example.

-As efficient as reasonably possible.  I like money.  Electricity costs money.  So no portable AC units (see the "technology connections" video on these for why.  Though let's be real, if you're here, you already subscribe to him...) 

-"Party mode".  I often have 20+ people over, people make heat.  Need to be able to just dump heat and co2 as fast as possible instead of trying to do fancy closed loop stuff that's going to take time to react.  This should include making sure to ventilate even if it's cold outside and we WANT heat inside.  

-Ground temperature sensing - I live on a ground floor so that dumps/removes *tons* of heat from the building depending on temperature.  It can be 65 outside and sit at 75 inside all night if it was a hot day and the floor is warm.  System should account for that.  

-Cooridination from a single program/script.  Don't want to be updating code on everything all the time, sensors and controls should be as dumb as possible.  

-Use the existing gas heater.  There's a gas heater in the kitchen, and gas is *way* cheaper per energy than electricity.  Also means I don't need to buy and controllerize another heater.  

-Air conditioners shouldn't have to be reverse engineered to interface their controllers.  Do that shit over the IR control.  Except for:

-Remove the damn beepers from the AC units.  This has nothing to do with anything else, those stupid beeps just bug me, why-oh-why does every equipment manufacturer INSIST on putting a fucking beeper in their thing and making it beep EVERY TIME YOU DO ANYTHING.  Like dishwasher, I GET that my dishes are done, ITS 2AM YOU DON'T NEED TO WAKE ME UP TO TELL ME.  YOU'RE HERE SO I DON'T HAVE TO THINK ABOUT MY DISHES, NOT TO ANNOY ME ABOUT THEM.  Same fuckin thing MICROWAVE, stop bugging me every thirty seconds that you're done.  I KNOW. I SET YOU TWO MINUTES AGO.  I'M DOING SOMETHING ELSE.  CHILL. 

I've de-beeped all my other appliances, but haven't got around to AC yet.  Since the remote and buttons make it beep, beep has to go.  


Also shouldn't look like crap.  No exposed wires/boards/etc, at least in obvious places.  

  • Bedroom vent fan wiring/controller

    John Duffy08/20/2022 at 03:12 0 comments

    The bedroom vent fan with louvers is wired, added a little box to hold a fused IEC plug on the front of it (inside the room, the wires/motor are outside).  There's a separate junction box for the speed controller/ESP.  I've gotten that wired up but haven't finished the control code so that's not assembled yet.  The way this controller works required the uC to  control the timing on every AC cycle (so at 120 Hz).  I don't like the idea of relying on an ESP that's also running a web server handling that timing, no idea if any of the web libraries suspend or use interrupts, and if something hangs it could (worst case) just go to full throttle.  So, I'm using a separate arduino to handle just that low-level timing, and the ESP communicates with it using something resembling the pwm used on RC stuff.  To make it a little simpler, instead of 1-2mS, it changes up the normal analogWrite frequency to 100Hz and varies from 10 to 90%, so 1 to 9 mS.  The arduino can time this in the loop, and run the triac gate in the interrupt.  Done this way to keep the serial port of both devices free, and be fail-safe to a pin getting stuck, if the pin goes high or low more than 9mS we know something's wrong and can shut down.  Within the junction box there's two separate boxes, one for the dimmer itself and one for the microcontrollers, to help keep all the mains wiring well away from the low voltage stuff.  

    Hopefully this is the only mains wiring I'll need - I don't like doing mains especially with non-standard stuff like this.  

  • New fan

    John Duffy07/13/2022 at 05:03 0 comments

    Got the big window fan in for the br, $40, 10" 120V fan with louvers.  Unfortunately breaking my "no mains" rule already bc it didnt come pre-wired, AND needs a dimmer to run even remotely quietly.  Think this is more of an industrial thing but I want the ability to move that much air when I don't care about noise too and couldn't find a good alternative.  I'll have to be careful with the boxes and shit to make it pretty failsafe.  

    Got this dimmer off tindie to do the actual control, I'll probably have an arduino to do the low-level timing and ESP for control.  

    Also finally got around to getting a proper ring/spade terminal crimper, to ground the thing.

    Also got a free desktop and got it to boot bodhi (and connect to wifi through a dongle.  That was a whole thing in and of itself...).  May run the main logic on that but mosty using that for the bar lighting.  

    May post that as a project at some point too, we'll see.  

  • Outlet RF remote wifi control

    John Duffy07/09/2022 at 05:21 0 comments

    I got some RF remote control outlets to run the fans without having to build custom 120V stuff, and, to avoid wifi outlets where I'll havre to use some stupid API or bounce it through some "cloud" service.  Spent most of today reverse engineering the remote for the outlets to get it to connected to wifi. 

    After opening the remote, I figured there were three "easy" vectors to get at it.  Inside the remote there's an 8-pin SOIC package (probably a uC) hooked up to the buttons through a weird diode matrix.  One pin goes through about a dozen passives and a transistor, to a 3-pin metal can, to the antenna.  Option one is to probe the "data" pin of the mcu, figure out the data encoding, and inject my own serial stream between the mcu and radio.  Another is to bypass the remote altogether and use an SDR to intercept and decode the RF directly, then buy a radio that can reproduce that frequency/modulation.  Finally I could figure out how button presses are detected (with the weird diode matrix) and  inject button presses.    

    Scoping what I thought was the data line revealed something weird, the "mcu" created a sawtooth wave at a couple hundred KHz, from about 2-3V whenever a button was pushed.  


    No apparent modulation or anything either, just a sawtooth as long ad the button is pressed. 

    I think this is something that feeds into the RF section, but still haven't really figured it out exactly. Turns out there was another pin though, which had normal digital data on it, which ran to the RF section through a path on the pcb I didn't see.   

    This was pretty easy to figure out, it's a 1.08HKz RTZ code with a 700uS high pulse for "1", and a ~230uS pulse for "0" (or the reverse, doesn't really matter.  Ultimately I didn't go much further than this, figured the  weird sawtooth thing would be a pain to generate and I wanted this working as fast as possible.  

    So, I turned to the buttons.  

    Originally I'd figured they'd have an mcu with enough gpio to read each pin, surely any other solution would cost more right? 

    Wrong apparently, there's an mcu with 4 pins for 10 buttons, and about a dozen diodes on the board.  

    I expected there was some clever use of mixed I/O on the pins, sort of like charlieplexing, some "active" system where the mcu puts pins high and low and can telll what's been pushed by the responses of other pins.  Poking around a little though, showed nothing coming out if the uC at all.


    Probing the four pins showed that actually, the diodes just pulled them high in a really simple pattern depending on what button was pushed.  Bingo, that's an easy way in.  

    I assigned each pin an (arbitrary) bit index, recorded what 4-bit number shows up (on the 4 pins) for each button on the remote, 

    Save those in an array, wire an ESP8266 to those pins write some simple logic to toggle those pins for half a second, and boom, wifi interface for the remote.

    There wasn't quite enough space in the existing case, so I soldered a DB9 to the back of the remote, and made a tiny box for the ESP with the mating connector.  

    What's passed through is just power for the remote and 4 GPIO lines.  

    So I hooked it all up, connected to the esp, toggled an outlet aaaaand... nothing

    Pretty quickly guessed that it was the power going to the remote - by default it runs on 12V, I'd been running it off a 5V bench supply while testing, which worked fine.  Running it on my computers USB port through the ESP though, wasn't working.  I know my computer puts out a little less than 5V for USB (it's old) so ai suspect the remote just couldn't run on <5V.  

    So, up the supply to 12V and add a regulator to run the esp, problem solved! 

    Wait crap still now working. 


    Turns out the "mcu" on the remote doesn't run at 3v3, or 5v or anything, it runs directly off the supply voltage!...

    Read more »

  • Picking and testing devices

    John Duffy06/29/2022 at 05:12 0 comments

    First serious part of this was figuring out what big parts I need - AC units, fans, heater.  For months I've had a 5000 btu portable AC unit upstairs for the kitchen, and a 6000btu in the bedroom.  This mostly worked fine for the bedroom in the fall/winter/spring, but come May this started underperforming.  I switched out the portable for a used 10000 btu window unit (more efficient and less precarious! big win.). Also added a permanent vent fan in the kitchen with some foam louvers.  This had worked OK but was super hacky and needs an upgrade.  Bedroom needs a vent fan too. 

    Recently added some fans to move air between upstairs, the stairwell, and the kitchen.  This is better but still not getting me the cooling performance I need, I'm probably going to switch this out for a more powerful fan and some tubing to get air directly to the kitchen from the AC.  Also an outside vent from upstairs, to dissipate hot air that's risen up would be useful, but I'll worry about that later.  

    For heating, the situation isn't as tough.  I've already got a big powerful, built in gas heater in the kitchen, but had to get an electric one for the bedroom.  Over winter I'd usually put this on a timer, keep it cold overnight and just use a blanket, but bring it up to like 70 right before I get up.  This worked fine.  Not being bound to windows, and needing far less heating power overall (its pretty warm here year round) makes heating relatively simple. 

    So, the whole shebang is: 

    -Two window AC units 

    -Five fans (though I may add more eventually) 

    -One gas heater

    -One electric heater

View all 4 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

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