4

I'm using Raspberry pi 3 model B for some college project with HC SR-04 ultrasonic for distance measurement. Since the sensor is using sound wave, which is depends on the velocity of sound and the velocity of sound is depends on the temperature of the environment. I have question:

  1. Raspberry pi 3 have temperature monitor, can I use it for another program?
  2. Does the temperature sensor measure CPU temperature only?

I know there is a lot of temperature monitor project using sensor and Raspberry pi, but if the built-in temperature monitor can do that, why don't I use it.

9
  1. Yes.

The system on a chip (SoC) of the Raspberry Pi has a temperature sensor that can be used to measure its temperature from the command line.

source: Raspberry Pi Projects, Temperature log

To view the Pi's temperature, type: cat /sys/class/thermal/thermal_zone0/temp. Divide the result by 1000 to find the value in Celsius.

source: Raspberry Pi Documentation, Overclocking options in config.txt

  1. Yes. But: to measure the environment temperature you could attach an external sensor (like DS18B20).
1

You can read the cpu temperature, but it's not going to be the Environment temperature. I have 20°C now and the CPU reads 41°C. Idle with heatsink. 21°K error is no good for anything.

  • that's not an error. its reading the temp at the CPU die, which is going to be above ambient temp, by a lot if no air flow or in a case. – warath-coder Mar 25 at 22:16
  • @warath-coder Error like a measurment error, not error like a defect. Of course it's by design because it's not measuring the right thing. – Christian Mar 25 at 22:19
  • it is in fact measure exactly the right thing :) if you want to measure ambient or case temps, there are a ton of ways to do that. the sensor on the motherboard and CPU is to measure exactly what its on, the motherboard, cpu. Its like saying HD temps sensor are wrong because they don't measure case temp. – warath-coder Mar 27 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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