# ThermalOptimizer

This design uses a ATMEGA328pb microcontroller and features a temperature sensor input (analog or digital), a 12V digital input, a touch button, LCD, a few open collector outputs and a relay.

## Usage
The ThermalOptimizer circuit board is used in the [RefrigeratorOptimizer](https://www.thefloatinglab.world/en/fridge.html) and production version of the [HotWaterManager](https://www.thefloatinglab.world/en/boilers.html).

## Open Source
The ThermalOptimizer is designed with KiCad 8.0, and released under the GNU GENERAL PUBLIC LICENSE, as supplied with this design.

## Software
The HotWaterManager is an *open source project*, the software that runs on the ThermalOptimizer can be found in the [HotWaterManager GIT](https://git.thefloatinglab.world/thefloatinglab/hotwatermanager).

## Notes
The hardware should be reasonably self explanatory. A few notes:

- Analog input PC1 is used to measure the voltage of the power supply. The resistors are dimensioned to be able to measure voltages up to 30V. This would accomodate 12V and 24V systems.
- PC5 is the input of the temperature sensor. For analog sensors, a pull up resistor of 10k should be used, but for digital sensors, a pull up resistor of 3k3 is better. The software pulls PE1 to high if a digital sensor is detected.
- The outputs PB3, PC0 and PC4 are used to control the backlight of the LCD, which gives us 8 luminance values. Some resistors are put in series, the reason was availability of the specific values. A single PWM output could also be used instead, but it wouldn't work during sleep of the microcontroller.
- The microcontroller does not use a crystal but instead uses its own internal oscillator. The clockspeed should be (at least) 4MHz to reliably read out the digital temperature sensors.
