Here is the general program flow of the most basic module. Two timers, referred to as on and off, are used to keep track of time in states. These can be low precision so can be as simple as a variable manually incremented based on a timer interrupt.
1. Monitor the inputs. If the fan, heat or cool is on, reset off timer, and go to 1. Else:
2. Check off timer for compete. If not complete, go to 1. Else:
3. Start on timer, turn on system fan. Go to next:
4. If the heat or cool is on, turn off fan and go to 1. Else:
5. If on timer not complete, go to 4. Else:
6. Turn off system fan, reset on timer, reset off timer and go to 1.
In parallel to all states, check if all three input monitoring is low. If so, turn off the output, go into lowest power mode supported. In this case, the module is running off battery or hold up capacitors. This would happen if a system only has heat(or cool) so that the cool(or heat) input is open, then when the main thermostat turns on, the other inputs go to zero as well. Doing this just to retain timing and any settings. If this does not work on the basic model, it doesn't pose any issues, because when the main thermostat turns off, the module will power up again, and restart the timer.
In parallel to all states, monitor for user inputs and act accordingly.
For power savings, a system timer should be setup to drive interrupts periodically which wakes the processor, updates the loop, then goes back to sleep.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.