Micro:bit has an internal temparature sensor, in fact, the nRF51 application processor has an on board core temperature sensor. This is exposed via the standard runtime software, and provides an estimate of ambient temperature.

It is not a highly accurate sensor, but just for fun, it is just great: no extra hardware, no wires, no breadboard or resistors, and, it can be achieved by only one line of micropython code. Has a sensing range of -25C to 75C with a resolution of 0.25C steps.

Go to the online microbit micropython editor

https://python.microbit.org/v/1.1

and paste this code

This will make a one time scroll temperature value.

To make it useful, let’s add a loop:

From the editor, download the hex file to microbit (with the microbit connected on the USB port, will appear a new drive)

The LED from the back of the board will flash until the hex file is processed, then the program will be executed. If any error will occur, the display will scroll “error” text.

 

The same result can be optained using Scratch

In a forever loop display temperature with a 2seconds pause between readings.

The corresponding JavaScript code is

 

Have fun!

 


 

Extra info here:

https://tech.microbit.org/hardware/#temperature-sensing

https://www.nordicsemi.com/Products/Low-power-short-range-wireless/nRF51822

https://lancaster-university.github.io/microbit-docs/ubit/thermometer/

 

micro:bit internal temperature sensor
Tagged on:             

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.