This is an ATtiny85 project to measure the ambient temperature of my office and the outside temperature. The temperatures are measured with two DS18B20 sensor and the values are shown on a SSD1306 0.96” OLED display. The code is written in C++17/20 with two goals in mind: small code size and low power consumption.
Note: The photo above is outdated because now there is a push button to turn on the device.
Note: The image is outdated because now there is a push button to turn on the device.
This project uses 1794bytes if compiled withavr-gcc 10.2
and -Os
.
The system stays at power down mode sleep consuming 0.5uA @ 5V and it wakes up when the power switch is pressed. The process of taking one temperature value lasts ~100ms and the pair of temperatures are displayed by 8 seconds, after that the system goes to sleep again. Another important point is that the contrast of the display is defined to be the lowest possible. The system reaches a peak of ~3.87mA when it wakes up to take the temperatures. The MCU is running under 1Mhz clock.
avr-gcc 10.2
with-std=c++20 -Os