I have actually done something like this a few years ago! Using an ATTiny85 to just display temp when it is powered on. Made a small portable temp sensor for getting temp readings from my hottub or pool. Even using it for my fish tank. Here is the code that I made long ago.
/* Runnig on ATTiny85 @ Internal 8Mhz
┌ ─ ─ ─ ─ ─ ┐
Reset |1 () 8| 5V
A3 3 |2 7| 2 A1
A2 4 |3 6| 1 PWM1
GND |4 5| 0 PWM0
└ ─ ─ ─ ─ ─ ┘
* Physical pin 2 (3) [A3]
* Physical pin 3 (4) [A2]
* Physical pin 5 (0) [PWM0]
* Physical pin 6 (1) [PWM1]
* Physical pin 7 (2) [A1]
*/
#include <TinyWireM.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 3 //Physical pin 2 (A3)
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
/*
How many bits to use for temperature values: 9, 10, 11 or 12
9 bits: increments of 0.5C, 93.75ms to measure temperature
10 bits: increments of 0.25C, 187.5ms to measure temperature
11 bits: increments of 0.125C, 375ms to measure temperature
12 bits: increments of 0.0625C, 750ms to measure temperature
*/
#define SENSOR_RESOLUTION 12
DeviceAddress sensorDeviceAddress;
#include <Tiny4kOLED.h>
#include "font16x32digits.h"
const DCfont *currentFont = FONT16X32DIGITS;
void setup() {
TinyWireM.begin();
sensors.begin();
sensors.getAddress(sensorDeviceAddress, 0);
sensors.setResolution(sensorDeviceAddress, SENSOR_RESOLUTION);
sensors.requestTemperatures();
oled.begin();
//oled.begin(128, 64, sizeof(tiny4koled_init_128x64br), tiny4koled_init_128x64br);
oled.setRotation(1); // Screen orientation
oled.setFont(FONT16X32DIGITS); // 1 row of 8 characters exactly fills 128x32
oled.clear();
oled.print(F("TEMP SENS"));
oled.on();
oled.switchRenderFrame();
// Position the cusror
// usage: oled.setCursor(X IN PIXELS, Y IN ROWS OF 8 PIXELS STARTING WITH 0);
oled.setCursor(12, 0);
oled.print(F(".SENSOR."));
oled.switchRenderFrame();
} // END SETUP
void loop() {
static int lastchk;
if (sensors.getDS18Count() != 0) {
sensors.requestTemperatures();
oled.clear();
oled.setCursor(25, 0);
oled.print(sensors.getTempFByIndex(0));
oled.switchRenderFrame();
}
} // END LOOP