Close

Bedroom vent fan wiring/controller

A project log for 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.

john-duffyJohn Duffy 08/20/2022 at 03:120 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.  

Discussions