Controlling temperature in a room can be a complicated task.
It depends on the room obviously, conditions needed in that room, the amount and types of sensors installed etc.
For keeping this system somewhat general, as there should be no artificial limits, starting from simple solutions and then adding complexity seems the way to go. Also this system should still work if some non essential sensors fail.
The system this device is intended to control, composes of a heating element and a heat carrier which distributes heat around the room.
Heat carrier is probably water with either underfloor- or radiator heating configuration.
Heater element is something which can be manipulated in a simple on-off fashion. Via a room thermostat connection for example.
First two sensors measure outgoing water temperature and incoming water temperature. Two sensors are used, because outgoing water temperature needs to be kept under control, to avoid potential damage to pipes, radiators etc. Incoming temperature gives some feedback.
The simplest system that kind of works is this:
Keep incoming water temperature at certain level, just by checking, if it is under that limit turn heater on, if it is over, turn heater off.
To avoid damage to the system, if outgoing temperature gets over a limit, then turn heater off and wait.
If those temperatures are picked well, then we get constant room temperature. Only if outside temperature is constant. Which is rarely the case.
To compensate for outside temperature fluctuations, another sensor is needed. For outside temperature. As usually outside temperature changes first and this change is transferred slowly to the inside temperature, if we act on outside temperature changes, then inside temperature fluctuations can be minimized.
Outside temperature is used for compensating incoming water temperature in linear fashion. I.e if outside temperature drops x degrees, incoming water temperature is raised y degrees.
This is actually the same principle as used by many similar controllers. It works but it has some serious flaws.
Someone must know these temperatures somehow. Also a normal person does not think that way. One just wants to set room temperature, not to guess that at outside temperature x, incoming water temperature needs to be at y to get room temperature z.
Some kind of auto learning seems to be in order.
Next step is to take account of the inside temperature sensor, probably by using a PID algorithm, which should make this controller good enough. Actually it is in production use without this feedback loop, and works well.
Work in progress.