Introduction: Data Storing Thermometer

This thermometer was designed for the cold winter office days which are comming. It collects temperature data, and storing it in a CSV file for further analyses. The rustic cardboard design is a conscious symbol of the low-cost, low-energy recycling.

Supplies

Item used:

  • Rasperry Pi Pico
  • ssd 1306 oled display
  • some wires, bolts, nuts
  • recycled cardborad

Step 1: Wiring

As far as the Rapberry Pi Pico has a built-in thermometer, only a display had to be added. It can be powered by a 5V solar panel too.

Step 2: MicroPython Code

# Temperature_logger_oled  2.0    2022 V.I.

import machine
import utime
from machine import Pin, I2C
from array import*
import ssd1306

# setup
i2c = I2C(0, sda=Pin(16), scl=Pin(17))
display = ssd1306.SSD1306_I2C(128, 64, i2c)
sensor_temp = machine.ADC(4)
conversion_factor = 3.3 / (65535)
x = 0


def Storing():
   global x,A
   if (x==0):
       A = [0.0]
   else:
       A = A + [0.0]
   A [x] = round(temperature,2)
   x=x+1
   print(A)

def Datasave():
   file=open("tempdata.csv","w")  # creation and opening of a txt file in Write mode
   file.write(str(A)+",")         # writing data in the opened file
   file.flush()                   # internal buffer is flushed
   file.close()                   # the file is closed
   print("Data saved.")

while x < 144000: #100days in case of 1 measurment / 1 min
   display.fill(0)

   reading = sensor_temp.read_u16() * conversion_factor
   temperature = 27 - (reading - 0.706)/0.001721
   t=str(round(temperature,2))
   print("Temperature: " + t + "\u00B0"+"C")
   utime.sleep(1)

   #decoration
   display.rect(90, 12, 10, 30, 1)
   display.fill_rect(91, 32, 8, 8, 1)
   display.rect(89, 40, 14, 2, 1)
   display.rect(88, 42, 16, 2, 1)
   display.fill_rect(87, 44, 18, 6, 1)
   display.rect(88, 50, 16, 2, 1)
   display.rect(89, 52, 14, 2, 1)
   display.rect(92, 54, 8, 2, 1)
   display.text("*", 115, 10)
   display.text("*", 105, 15)
   display.text("*", 110, 25)

   #measurement
   display.text('MEASURED:', 10, 16)
   display.text(t, 10, 36)
   display.rect(54, 36, 3, 3,1)
   display.text("C", 60, 36)

   display.show()

   utime.sleep(60) # one mesure per 60sec - can be anything
   Storing()      # Storing to array
   Datasave()     # Saving to file


To run this code the ssd1306.py is needed to be installed on the pico first!

Step 3: Preparing Cardboard Box

For the box, a part of a recycled cardbox inlay was used. Even most of the foldings are original, only the front support and the hole for the display had to be prepared. The display and the microcontroller were fixed with bolts and nuts.

Step 4: Ready State