Temperature sensor not working

I've received my Zero to Hero package today and was testing some of the project. When I try to read out temperature it shows always 0 (zero). Connecting it with cable results the same. Anyone else had the same issue?


  • I have the same issue. Can you advise whether it's the DHT11 library not connecting properly?

  • If using arduino IDE




    termometre_arduino.ino (the script in the book don't work)

    Use the following libraries :

    • For LCD :


    • For sensor DHT (many libraries, this one work, you need the 2 ) :

    Adafruit Unified sensor by Adafruit

    DHT sensor for adafruit

    Hope this may help

  • Hi Guys,

    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. 

    Thanks a lot


  • Hi Samet - no, unfortunately the temperature module still does not work. It is reporting 0 degrees when using microblocks.

    Tried both the microblock code in the ebook for 2.4, and the microblock code provided at the in project 2.4 (there are two different codes used here). Neither is working.

    The humidity sensor is also not working.

    Using the code in microblocks of:


    When started


    Say "PicoBricks temperature"


    This returns an unchanging zero value for temperature. Humidity does the same. Have confirmed the picobrick board works - the rgb, led, buzzer etc. all work.

    Can you please advise next steps. I have purchased two picobrick boards, neither of them has working temperature/humidity sensors.

  • Hello,

    We tested all boards especially the temperature and humidty sensor. There is a library problem in Micropython. Can you try it with Arduino as well? It should work on both cards.


  • Hi @SametS,

    Thanks for the suggestion. I will try at a later moment and let you know the results.

  • I am going through the projects too and noticed the same temp 0 and humidity doesn't work with microblock environment. I haven't tried micropython but really would want it to work with microblock.

  • ozerngg
    edited October 2022

    Hello @rktam,

    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 ozerngg. When I install arduino IDE, and associated libraries and run your code, the thermometer is working. However, I was hoping that the microblocks programming environment could be worked on, so I can go through all the projects with my daughter.

  • Since it seems that the issue is with MicroBlocks and not the other environments, can we get a fix for MicroBlocks? I don't really plan to use the other development tools.

  • Yes there s a problem with the MicroBlocks library code for temperature and humidity. Sometimes the DHT sensor library works, sometimes it does not. More often, it is the temperature that returns the correct value, even though the data is in the same data stream from the sensor. Using the GitHub code in Arduino returns not just an answer, but the correct temperature and humidity. I do hope they fix the library, as I too want to use the code with beginners. I like the immediate interactivity with MicroBlocks. However, with extensive code revisions, I find it useful to disconnect the board (not physically, but using the 'disconnect' button at the top right of the menu) when making these changes, and then reconnecting when they are done. The editing is a lot faster, and less choppy when the board is disconnected.

  • I also have this issue with Temp and Humidity. It's unacceptable that it doesn't work with MicroBlocks, especially with the Out of the Box demo. Imagine being an 8-10 year old kid and running into this situation, it would demotivate them and likely impair adoption of the boards.

    Please let us know when to expect a fix. Thanks!

  • Hello @MRedRaider

    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.


  • @ozerngg

    MRedRaider is not saying its not workign with arduino code. his point and the frustration people have is arduino code is not going to be common or exciting for an 8 year old. honestly, as an adult the complicated coding to test if it works is frustrating as its a project for me and my 8 year old. He is not at a point he is interested in programing "code". drag and drop commands with simple instructions and a walkthrough style is what we all expected.

    I am in the same level of frustration as red because this is not what we expected when we purchased picobricks and rather than find a solution to the issue you are just blowing us off with a response that it works with computer code.

  • I have found that the "Thermometer activities" works with the MicroBlocks as long as the device is connected to the computer. Disconnecting the device and powering it up causes the device to freeze up before displaying the temperature. The only debugging I can figure out is that somehow the 'Join' code block isn't converting the data from the thermometer into a String for the display unless the device is connected to the computer and the MicroBlocks software/web page. I have tried creating a variable and assigning the 'Join' block to the variable before different sections of code, and it always hangs at the 'Join' block.

  • Hello everyone,

    Some updates have come to Microblocks. DHT11 will work if you try it by updating it via the browser.



  • Hi Joshua,

    You are right but it was working with the first set of sensors. After we got the second party of DHT11s, problem started to escalade with several boards. Then we updated the library, it started to work again. Then we got complains about DHT11 on MicroPython.

    Now we are writing a new library. Hope will release in few weeks on Github.

    Thank you


  • Chad
    edited October 2022

    There is still a problem with the MicroBlocks library. When the PicoBrick is connected and "running" the program will not work. You get an "Error: IC2 transfer failed" message from the 'when started' block and an "Error: Needs an integer" message from the 'PicoBricks temperature (°C)' block. If you click the 'stop' button, you will get the temperature reading from the 'PicoBricks temperature (°C)' block. The same happens with the 'PicoBricks humidity' block. This is as of attempting the website at 3:43 PM EDT on 10/31/2022 with updating the firmware on the board also.

  • Turgut
    edited November 2022

    @chad and others, experiencing i2c and other errors with MicroBlocks:

    Your experiences point to an out of synch condition between the code on the board and the IDE, which can be caused by various things. Regarding DHT module errors, we have made some changes to the firmware to eliminate the problem. It is important that you run a current version of the MicroBlocks / FW which has the fix in it.

    Now, without bothering with the reasons of errors, let's see how we can start from a clean slate and get to a running state:

    Connect your board and make sure you are running with the latest FW and IDE versions. Best way to do this is to pick the RUN option from the MB web site (http://microblocks.fun/) and then do a FW update. Make sure you select No to the question of Pico W (WiFi).

    After the update, remember to click on the USB icon and wait till it is green.

    As of Nov.2, after the update, you should see the following version displays from "about" selection in the Settings menu:

    Now select File / New to clean the slates on both the board and the IDE.

    You are either copying a URL from one of the projects or loading a saved program. Either way, drag and drop the project link or load your code to the IDE. The USB icon will turn grey-ish and show a gradual change to green while the system synchs your code to the board. When it is fully green , you are ready to run.

    It is possible that intermittently when you select RUN at this point, you may get an error due to serial port buffers. But don't mind that and select RUN again. We are going to release a version that will fix this intermittent problem very soon.

    Your project should run without errors at this point. If for some reason, you are still experiencing problems, please report your cases, as above, with IDE and FW version info, so we can look into it.

  • MSMorkan
    edited November 2022


    We were able to reproduce error with one of the versions. It is solved and published on Github under Examples/Pre-Installed Code.

    Both main.py and picobricks.py are updated. Can you please check the temperature sensor with new files?


    We will update all of the examples that contains DHT11 after your confirmation.

    Have a nice day!


  • Chad
    edited November 2022

    Attempted another update of firmware as of 8:39 AM EDT on 11/2/2022. Followed Turgut's instructions for a File / New clean slate. Each attempt to run the program with MicroBlock still generates the error message "Error: Needs an integer". This is not an intermittent error. The code will not transfer to the board.

  • @Chad

    Can you confirm something for me:

    If you place a PB temperature block on the IDE and click on it, do you get a reading as in the picture:


  • If I include any OLED Graphics blocks, I get a reading from the PicoBricks temperature block only if "stopped". With only a PicoBricks Temperature block, I get an integer result either way.



  • Users with DHT problem in MicroBlocks:

    Provided you are running the latest versin of IDE and FW, please try the code with a 500ms delay inserted at end of the loop. That would be a wait 500ms block from the control category. It should go right after the last write block, still within the loop scope.

    And let me know.


  • Turgut
    edited November 2022

    Hi everyone,

    We have found a strange timing problem with the DHT library and fixed it. The new release will include the fix.

    Until than, if you want to make the Temperature project (or any project with the DHT11) work reliably, please modify the project code to include a 2 sec delay at the top. Then change the read loop delay to minimal 1 sec.

    The 1 sec read interval is a DHT datasheet guidance and was cause of the problem with our library implementation.

    Here is the way the new code should look:

    You can drag and drop this code image onto the MicroBlocks IDE and run it.

    Thanks to @chad helping us debug this problem.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!