0

how to show the

CPU temperature, CPU usage (percentage) and the memory usage(percentage)

in Arduino Serial Monitor.

  • 1
    an Arduino does not have a CPU – jsotola Jan 1 at 9:15
  • 1
    @jsotola Yes it does. – Majenko Jan 1 at 10:49
4

CPU temperature

Some Arduino boards have a microcontroller with a temperature sensor inside. For example the Aarduino Uno can measure the temperature inside the microcontroller.

As far as I know, no one uses it. It is not accurate and a microcontroller should not get hot in the first place. The microcontroller or processor on the Arduino board can run at 100% load and it does not get hot.
The internal temperature sensor is not accurate enough to measure the ambient temperature.
The internal temperature is therefor (almost) useless.

See this page on the Arduino Playground and this forum thread for the internal temperature sensor.

CPU usage

There is no CPU usage. There is no idle task. The microcontroller or processor usually runs all the time at full speed.

It is possible to determine how long the Arduino board stays in delays (via the yield function).
With a external RTC clock it is possible to determine how long the Arduino board stays in sleep mode (some battery powered Arduino projects use the sleep mode).
However, those are very specific things. Perhaps a project requires to measure them, but there is no common use for them.

A good sketch is not supposed to do nothing, it is supposed to check all the inputs and check millis-timers and act if needed. The Arduino loop() function is supposed to run as often as possible to make the Arduino run fast and smooth.

Memory usage

The memory usage is something to be aware of when writing a sketch. An Arduino board is not a computer and memory is limited.

It is possible to determine the unused memory between the stack and the heap.
The function at the bottom of this page can be used to determine the amount of free memory.

I have also seen code to measure the high water mark (memory that is never used at all), but none of them work for all Arduino boards and the code is not reliable.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.