Skip to content

Projects

#6 Thermometer Project With micro:bit

by PicoBricks Team 29 Apr 2025

Sensors are the sensory organs of electronic systems. To perceive, we use our skin, eyes for seeing, ears for hearing, tongue for tasting, and nose for smelling. Picobricks already has many sensory organs (sensors), and new ones can also be added. By using sensors such as humidity, temperature, light, and many others, you can interact with the environment. Picobricks can measure ambient temperature without the need for any other environmental components. 

Ambient temperature is used in situations where continuous monitoring of temperature changes is required, such as in greenhouses, incubators, and environments used for transporting medications. If you are going to perform a task related to temperature changes in your projects, you should know how to measure ambient temperature. In this project, you will prepare a thermometer with Picobricks that displays ambient temperature on the OLED screen. Using the PicoBricks potentiometer module, you can instantly change the displayed temperature value on the OLED screen between Fahrenheit and Celsius.

Thanks to the PicoBricks Temperature & Humidity module, we will display the temperature and humidity values detected from the environment on the OLED screen by using the Potentiometer module, either in Celsius or Fahrenheit.

Connection Diagram:

You can prepare this project without making any cable connections.

Project Images:

 

MakeCode Code of The Project

Python Code of The Project:

#Thermometer Project
from microbit import *
from picobricks import *

# Pin Initialization
Pot_Pin = pin1

# Function Initialization
oled = SSD1306()
oled.init()
oled.clear()
shtc = SHTC3()

oled.add_text(0,0,"TEMP:")
oled.add_text(0,1,"_______________")
oled.add_text(0,3,"HUM:")

def celsius():
    display.show(Image('00009:'
                       '09900:'
                       '90000:'
                       '90000:'
                       '09900'))
def Fahrenheit():
    display.show(Image('99909:'
                       '90000:'
                       '99900:'
                       '90000:'
                       '90000'))
    
while True:
    
    temp = shtc.temperature()
    hum=shtc.humidity()
    pot_value = round(round( Pot_Pin.read_analog() - 0 ) * ( 2 - 1 ) / ( 1023 - 0 ) + 1)
    if pot_value==1:
        celsius()
        temp=round(shtc.temperature())
    else:
        Fahrenheit()
        temp=round((9*shtc.temperature())/5 + 32)
    oled.add_text(5,0,str(temp))
    oled.add_text(5,3,str(round(hum)))


MicroBlocks Code of The Project

Prev Post
Next Post

Thanks for subscribing!

This email has been registered!

Shop the look
Choose Options

Edit Option

Back In Stock Notification

Compare

Product SKURatingDescription Collection Availability Product Type Other Details
this is just a warning
Login
Shopping Cart
0 items
Same Day Shipping No Extra Costs
Easy Returns Guarantee Return with Ease
Secure Checkout Secure Payment