Datasheet
CircuitPython CPU
Temp
There is a CPU temperature sensor built into every ATSAMD21, ATSAMD51 and nRF52840 chips. CircuitPython makes
it really simple to read the data from this sensor. This works on the Adafruit CircuitPython boards it's built into the
microcontroller used for these boards.
The data is read using two simple commands. We're going to enter them in the REPL. Plug in your board, connect to
the serial console (https://adafru.it/Bec), and enter the REPL (https://adafru.it/Awz). Then, enter the following commands
into the REPL:
import microcontroller
microcontroller.cpu.temperature
That's it! You've printed the temperature in Celsius to the REPL. Note that it's not exactly the ambient temperature and
it's not super precise. But it's close!
If you'd like to print it out in Fahrenheit, use this simple formula: Celsius * (9/5) + 32. It's super easy to do math using
CircuitPython. Check it out!
Note that the temperature sensor built into the nRF52840 has a resolution of 0.25 degrees Celsius, so any
temperature you print out will be in 0.25 degree increments.
© Adafruit Industries https://learn.adafruit.com/adafruit-itsybitsy-nrf52840-express Page 167 of 179










