Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
istatrol [2016/03/23 17:36] – created Traumflug | istatrol [2018/05/27 16:10] (current) – external edit (unknown user) | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== ISTAtrol ====== | ====== ISTAtrol ====== | ||
- | {{ : | + | {{ : |
+ | |||
+ | The **ISTAtrol** is a device for controlling temperature of a heating radiator depending on the temperature of the ISTA heating consumption counter and, in a next step, also depending on room temperature. It's easily DIY-able and code is Open Source, so it can be custom programmed without too much effort. It means to replace traditional [[http:// | ||
+ | |||
+ | It was designed because these ISTA counters measure heating consumption based on the temperature of the radiator, only, which leaves much room for optimisation. | ||
+ | |||
+ | ===== Features ===== | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Of the shown features currently works: | ||
+ | |||
+ | * USB. | ||
+ | * External and USB voltage source (one of both required). | ||
+ | * 1 temperature sensor. | ||
+ | * Radiator valve motor. | ||
+ | * In System Programming (ISP) | ||
+ | |||
+ | All other features require some schematic and PCB layout changes as well as an upgrade to an ATtiny4313. One could operate LEDs or user buttons right now, but then one would have to drop temperature controlling code due to ATtiny2313's tight program memory (2\_kB Flash). | ||
+ | |||
+ | Disappointed? | ||
+ | |||
+ | ===== How To Get It ===== | ||
+ | |||
+ | Firmware sources, schematics and layout can be found at [[https:// | ||
+ | |||
+ | In its current state you likely want to fix some of the issues found during development first. If you do so, don't hesitate to ask for a PCB or two, [[mah@reprap-diy.com|Traumflug]] usually makes them happily and for free. | ||
+ | |||
+ | ===== Assembly ===== | ||
+ | |||
+ | Assembly is straightforward, | ||
+ | |||
+ | ===== Firmware Upload ===== | ||
+ | |||
+ | Firmware should compile out of the box with a simple | ||
+ | |||
+ | make | ||
+ | |||
+ | For uploading the firmware one needs a programming device, e.g. [[https:// | ||
+ | |||
+ | Before the first firmware upload, ATtiny' | ||
+ | |||
+ | make fuses | ||
+ | |||
+ | Then one can upload the actual firmware: | ||
+ | |||
+ | make program | ||
+ | |||
+ | After any firmware change, e.g. a change in configuration, | ||
+ | |||
+ | ===== Connecting to a PC ===== | ||
+ | |||
+ | When connecting the ISTAtrol to a PC, a new USB device should appear. Use //lsusb// on the command line for checking. There should show up a device named //Van Ooijen Technische Informatica Free shared USB VID/PID pair for CDC devices// | ||
+ | |||
+ | That's all, USB communications is working. | ||
+ | |||
+ | ===== Controlling Terminal ===== | ||
+ | |||
+ | As ATtinys | ||
+ | |||
+ | To fire up the terminal, type | ||
+ | |||
+ | sudo ./ | ||
+ | |||
+ | on the command line. It should connect to the ISTAtrol and give a temperature readout every minute. That's how one makes visible how the ISTAtrol works. | ||
+ | |||
+ | **Note**: if the ISTAtrol was just started, it'll take some time until temperature readouts pick up, so be a bit patient. | ||
+ | ===== Valve Actuator ===== | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Any controller needs some means to influence the controlled entity, of course. In terms of the ISTAtrol, this is the valve of the heating radiator. For the prototype, this actuator was taken from a [[Hacking An EQ-3 Model N|EQ-3 Model N]]. | ||
+ | |||
+ | Red wire of this actuator is plus and goes into the pin closer to the thermistor connectors of the motor connector. Minus goes to the one closer to the user buttons. If the actuator happens to react the opposite way later, like opening the valve if temperature is too high already, these two have to be swapped. | ||
+ | |||
+ | ===== Temperature Sensors ===== | ||
+ | |||
+ | Bad news: there are three thermistor connectors in the layout, but two of them have to be kept disconnected. Third one works just fine :-) | ||
+ | |||
+ | Type of the thermistor isn't crucial. Design was made with a 10\_kOhms type in mind. Lower ohms ones will give smaller temperature readouts, larger ohms ones will give a higher readout. This can be adjusted in the configuration by TARGET_TEMPERATURE. Simply attach the thermistor, fire up terminal.py and look what the readings are. Then adjust configuration and upload firmware again. | ||
+ | |||
+ | If readouts happen to be above 32' | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | For the technical: ATtinys feature no Analog Digital Converter (ADC). But there is [[https:// | ||
+ | |||
+ | As one can see by the coarse measurements done, this is linear enough for our purposes. The recorded pretty hefty hysteresis isn't a property of the thermistor or the ISTAtrol, it's an artefact of the measurement procedure. | ||
+ | |||
+ | ===== Configuration ===== | ||
+ | |||
+ | Here's a description of the configuration values meant to be user-adjustable. They' | ||
+ | |||
+ | All the values described here are also described in a comment in main.c. | ||
+ | |||
+ | ==== TARGET_TEMPERATURE ==== | ||
+ | |||
+ | This is our main goal, here one sets which temperature the ISTAtrol should try to keep. The actual value largely depends on the thermistor in use. Use [[# | ||
+ | |||
+ | ==== THERMISTOR_HYSTERESIS ==== | ||
+ | |||
+ | This is, also in thermistor ticks, temperature is allowed to deviate from TARGET_TEMPERATURE. Too small values result in constant valve movements (more than 20 per hour), a too large value doesn' | ||
+ | |||
+ | ==== RADIATOR_RESPONSE_TIME ==== | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | This is a bit a tricker one. Moving the radiator valve usually doesn' | ||
+ | |||
+ | To get an idea about this dead time, connect ISTAtrol, run [[# | ||
+ | |||
+ | ==== PREDICTION_STEEPNESS ==== | ||
+ | |||
+ | This value says how " | ||
+ | |||
+ | ==== MOT_OPEN_TIME ==== | ||
+ | |||
+ | The radiator valve is moved in increments, absolute position is actually ignored. Such an increment means to run the actuator motor for a short while. This value says how long this short time is when opening the valve, in milliseconds. | ||
+ | |||
+ | ==== MOT_CLOSE_TIME ==== | ||
+ | |||
+ | The same when closing the valve. Both values can be adjusted individually, | ||
+ | |||
+ | ===== Practical Experience ===== | ||
+ | |||
+ | Quality of temperature regulation was recorded during days of firmware development, | ||
+ | |||
+ | ==== Early Days ==== | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | As one can see in the first set of graphs, regulation was really jerky in the early days. With a simple Bang-Bang-algorithm ("Temp too low? Open valve. Temp too high? Close valve." | ||
+ | |||
+ | Next step was to add kind of a mild prediction into the algorithm. "If temperature raises already, don't open the valve further. And vice versa" | ||
+ | |||
+ | ==== Full Predictive ==== | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | As the Bang-Bang thing had turned out to be not very helpful, it was removed entirely. Instead, prediction now scales the last temperature change by factor PREDICTION_STEEPNESS into the future and looks wether this future value is within target bandgap. As one can see, results were much better, a precision of +-\_0.5\_°C could be kept almost all of the time. This is usable! | ||
+ | |||
+ | But still occasionally an erratic temperature measurement slipped in, exploiting the prediction formula. Readouts aren't exactly noise-free, likely due to all the long unshielded wires. So an exponential moving average was introduced, each new measurement now counts in only 12% of the existing value. Regulation response is still quick, because some 100 averaged temperature readings happen between two evaluations of the regulation algorithm. | ||
+ | |||
+ | And then a hardware issue was found. The temperature sensor was connected directly to the radiator, more precisely to the ISTA consumption counter. But when a blow hushed through the air, the sensor would change a lot more than the radiator. So the sensor was thermally insulated against air with some foam, still tightly connected to the radiator, problem solved. | ||
+ | |||
+ | Now we get away with about 11% valve movements, which is one movement about every 9\_minutes. Looks like a good compromise between precision and valve actuator wear. | ||
+ | |||
+ | ===== These ISTA Devices ==== | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Remember these ISTA things mounted to the radiator? They mean to measure heating consumption. But they can also count erratic, because: | ||
+ | |||
+ | * They measure radiator temperature in one point only, so water flowing back to the central heating system hot is counted as consumed energy, too. | ||
+ | * They ignore room temperature. A 30\_°C warm radiator in a 25\_°C warm room certainly consumes less heating energy than the same in a 15\_°C warm room. | ||
+ | * They ignore effective size of the radiator. While the physical size is part of their bookkeeping, | ||
+ | * They count radiator temperatures above 28\_°C, only. | ||
+ | |||
+ | To get at least an idea about what's happening at the counter, applying a temperature sensor directly to the aluminium back of this device is a good idea. Then you can see what's happening and optimise accordingly. | ||
+ | |||
+ | Such erratic behavior was actually the reason why ISTAtrol was developed. Consumption grew by 50% from one year to another, without visible reason. After optimisation (e.g. removing the table), bills are now not 50% up, but 60% down. Yikes! | ||
+ | |||
+ | ===== TODO ===== | ||
+ | |||
+ | Let's collect possible improvements here. | ||
+ | |||
+ | ==== Bugs ==== | ||
+ | |||
+ | * Replacing the ATtiny2313 with an ATtiny4313. Program memory is so constrained that this is considered to be a bug. | ||
+ | * C3, 1.0 uF, should have a 200\_mil wide footprint. Many suppliers don't have 100\_mil types at this capacity. | ||
+ | * Key //Menu// should go to INT1 to allow triggering an interrupt. Crucial for allowing the MCU to go to sleep. | ||
+ | * These three thermistor connectors actually don't work this way. Connecting to means that current flows partially not to the measuring capacitor, but to the other ATtiny pin. Can likely solved with diodes, but note that a capacitor fills reasonably linear in the lower 20%, only. | ||
+ | |||
+ | ==== Wishlist ==== | ||
+ | |||
+ | * There is an internal voltage reference, which can be connected to the Analog Comparator. Does this work? Does the Brown Out Detector still work then, too? This could save a pair of resistors. See page\_149, " | ||
+ | * Voltage dividers for the 5\_V programmer should go into a separate cable adapter. | ||
+ | * Maybe it's a good idea to lift this whole thing to 5\_volts. Zener-diodes needed for D+ and D- then. ATtiny can run at 20\_MHz with quartz or 16.5\_MHz without quartz, then, both featuring considerably [[Notes on V-USB|smaller V-USB code]]. Voltage regulator can be dropped, but then the valve actuator motor needs some sort of voltage reduction. | ||
+ | * A display for allowing USB-less operations, of course. Could be done with SPI via the ISP connector. | ||
- | The **ISTAtrol** is a device for controling temperature of a heating radiator depending on the temperature of the ISTA heating consumption counter and, in a next step, also depending on room temperature. It's easily DIY-able and code is Open Source, so it can be custom programmed without too much effort. It means to replace traditional [[http:// |
istatrol.1458751005.txt.gz · Last modified: 2018/05/27 16:10 (external edit)