Micro:bit Temperature and Humidity Sensing

Stephen just shared a new tutorial: "Micro:bit Temperature and Humidity Sensing"

The Micro:bit has the ability to measure temperature by sensing the temperature of the silicon die inside the main CPU. This works because the Micro:bit runs cold, and the temperature of the CPU is usually a good approximation of ambient te…

Read more

Hi, thanks for this tutorial I have successfully got it up and running.

Can the DHT11 write back to the MakeCode through the serial function? Using block code, the simulator does not appear when I drag in any Serial functions.

Many thanks,

Hi Jarrod,

You could save the value as a variable and use the serial - write line block to send the variable over serial.

Hi Guys,
Is there an DHT22/AM2302 block for the Microbit? I don’t have access to a DHT11 at present. Tried hooking up the DHT22 in the same fashion, observing Vdd, Data and GND. Also tried googling and searching the extensions but came up with nothing. The output appears to be 0 for the temp and 1 for the humidity :slightly_smiling_face:



Hi Roger,

There is currently no MakeCode support for the DHT22. The DHT22 has different timing than the DHT11, so although they are very similar there is not a block for it. You could read a DHT22/AM2302 with a Micro:bit if you program it with Arduino or MicroPython though!

Hi Stephen,
Can the DHT11 be used with micropython and the Micro:Bit?
If so, can you point me in the direction of any tutorials or support?

Hi Leeob,

There really isn’t that much documentation on using the DHT11 with MicroPython on the Micro:bit. You can use Arduino libraries directly which is nice.

I was able to find this library, but there isn’t much direction on how to use it:

Hello to everyone. My problem is that i cant find the extension at the makecode. I find iot-environment-kit but it is not the same. Any help ?

Hi Nikos,

You can just follow the link in the tutorial, but if you’re working from scratch you need to add the extension.

In the web editor, click on Settings then Extensions to search and add extensions to the project. The Blocks and JavaScript definitions will be automatically loaded in the editor. The Extension you’re looking for is the iot-environment-kit:

Once you’ve added the library, the block is under Octopus -> More

1 Like

Thanks Oliver.

Please, could you tell me how can i collect data from dht11 to my computer?

Hi Nikos,

Check out this tutorial:

Yes, I knew it but I dont have these components.

I wonder if we can operate DHT11 with battery and connect USB at the same time. Can we?