HC-SR04 and the temperature

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
MrTom
New user
Posts: 1
Joined: 16 Dec 2018, 12:38

HC-SR04 and the temperature

#1 Post by MrTom » 04 Jan 2019, 13:51

Hi

does anyone created a temperature-compensation for the HC-SR04? How it realised?

Greets
Thomas

User avatar
dynamicdave
Normal user
Posts: 257
Joined: 30 Jan 2017, 20:25
Location: Hampshire, UK

Re: HC-SR04 and the temperature

#2 Post by dynamicdave » 14 Jan 2019, 18:48

I thought the HC-SR04 was an ultrasonic distance measuring device.
Are we talking about the same device?

The SR04 and SR05 work on the speed of sound that varies slightly with changes in altitude (and with temperature as others have pointed out).
Last edited by dynamicdave on 15 Jan 2019, 20:58, edited 1 time in total.

Domosapiens
Normal user
Posts: 307
Joined: 06 Nov 2016, 13:45

Re: HC-SR04 and the temperature

#3 Post by Domosapiens » 14 Jan 2019, 21:13

Speed of Sound:
c = 331.3 + 0.606 × Temperature_in_C
@20C:
c = 331.3 + 0.606 × 20 = 343.42 m/s
You can measure the temperature and compensate for the difference to 20C in a rule.

But ... useful?
Don't think so.
1 degree difference is less than 0.2% speed difference.
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.

HomeJCL
Normal user
Posts: 89
Joined: 03 Feb 2018, 10:42

Re: HC-SR04 and the temperature

#4 Post by HomeJCL » 15 Jan 2019, 20:30

:roll:
Belgium and land of ESP ... counting :D

fluppie
Normal user
Posts: 89
Joined: 09 Oct 2015, 13:23

Re: HC-SR04 and the temperature

#5 Post by fluppie » 17 Jan 2019, 13:36

Check this: https://www.instructables.com/id/Improv ... -Accuracy/

I was wondering if you would get better results on a ESP32 as the timer is in µs instead of ms?

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: HC-SR04 and the temperature

#6 Post by Shardan » 17 Jan 2019, 18:24

I think this is a bit questionable.

It could be usefull in a car ("distance radar") where you definitely find a span from -20°C to +70°C easily.
But for a sensor like the HC_SR04? Honestly this is a cheap sensor, and it has tolerances of some percent.

Within the temperature range inhouse the factor from the formula is below 1% - for a sensor that has
some percent tolerance this just pretends an exactness that does not exist.

The more: If you have an item not exactly in front of the sensor but some degrees right, left, up or down
you get even more tolerance in readings.

First step would be to calibrate this sensor. This would give better results then temperature compensation.
Anyways, even this would only be exact if an item is exactly in front of the sensor with zero degrees deviation.
Regards
Shardan

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 26 guests