CategoriesRaspberry Pi Pico

#4 Thermometer Project with PicoBricks

thermometer header

Sensors are the sense organs of electronic systems. We use our skin to feel, our eyes to see, our ears to hear, our tongue to taste, and our nose to smell. There are already many sense organs (sensors) in the picobrix. Also, new ones can be added. You can interact with the environment using humidity, temperature, light and many more sensors. Picobricks can measure the ambient temperature without the need for any other environmental component.

Ambient temperature is used in greenhouses, incubators, in environments used for the transport of drugs, briefly in situations where the temperature change must be constantly monitored. If you are going to do an operation on temperature change in your projects, you should know how to measure the ambient temperature. In this project, you will prepare a thermometer with Picobricks that will display the ambient temperature on the OLED screen.

Details and Algorithm

Picobricks has a DHT11 module. This module can sense the temperature and humidity in the environment and send data to the microcontroller. In this project, we will write the necessary codes to print the temperature values ​​measured by the DHT11 temperature and humidity sensor on the OLED screen.


1X PicoBricks

Wiring Diagram

You can code and run Picobricks’ modules without wiring. If you are going to use the modules by separating them from the board, you should make the module connections with grove cables.

MicroBlocks Codes of the PicoBricks

197475556 b70ce092 43ac 4695 a2b1 1ee3a9c90c52

You can access the Microblocks codes of the project by dragging the image to the Microblocks Run tab or click the button

MicroPython Codes of the PicoBricks

					from machine import Pin,I2C,ADC #to acces the hardware picobricks
from picobricks import SSD1306_I2C, DHT11 #oled library
import utime #time library
#to acces the hardware picobricks
#define the weight and height picobricks

#we define sda and scl pins for inter-path communication
i2c=machine.I2C(0, sda=sda, scl=scl, freq=2000000)#determine the frequency values
oled=SSD1306_I2C(128, 64, i2c)
while True:
    if(utime.time() - current_time > 2):
        current_time = utime.time()
        oled.fill(0)#clear OLED
        oled.text("Temperature: ",15,10)#print "Temperature: " on the OLED at x=15 y=10
        oled.text("Humidty: ", 15,40)
        oled.text(str(int(humidity)),55,50) on OLED
        utime.sleep(0.5)#wait for a half second

Arduino C Codes of the PicoBricks

					#include <Wire.h>
#include <DHT.h>
#include "ACROBOTIC_SSD1306.h"
#define DHTPIN 11
#define DHTTYPE DHT11
//define the library

float temperature;
//define the temperature veriable

void setup() {
  //define dht sensor and Oled screen

void loop() {
  temperature = dht.readTemperature();
  Serial.print("Temp: ");
  oled.putString("Temperature: ");
  //print "Temperature: " on the OLED at x=3 y=1
  //print the value from the temperature sensor to the oled screen at x=4 y=3

Project Image

Project Video

Project Proposal 💡

In order to develop your project, you can make the red LED light up and a warning phrase appear on the screen when the temperature in the environment rises above 30 degrees.


  1. PicoBricks temperature and humidity sensor returns 0.
    Any idea what to do?

    1. Hello;

      Unfortunately, Micropython DHT library sometimes not giving data when combined with other sensors or actuators. Can you please test it out with Arduino IDE or Microblocks? Because we made sure that all of the Boards’ DHT sensors are functioning with Arduino IDE.
      You can test it with our Thermometer activities. There’s GitHub link here;
      Also, after testing components, if you think DHT 11 is working completely wrong, please report us.

      Have a nice day☺️.
      Thanks a lot

Leave a Reply

Your email address will not be published.