{"id":9412,"date":"2020-11-07T11:01:58","date_gmt":"2020-11-07T11:01:58","guid":{"rendered":"https:\/\/wolles-elektronikkiste.de\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors"},"modified":"2020-12-02T11:23:34","modified_gmt":"2020-12-02T11:23:34","slug":"hc-sr04-and-jsn-sr04t-2-0-distance-sensors","status":"publish","type":"post","link":"https:\/\/wolles-elektronikkiste.de\/en\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors","title":{"rendered":"HC-SR04 and JSN-SR04T-2.0 distance sensors"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">About the post<\/h2>\n<p>In my series about light, gesture, motion and distance sensors, I would like to introduce the classic distance sensor, namely the HC-SR04. I&#8217;ll talk about how it works in principle, how you connect it to an Arduino and what a suitable sketch looks like. Then I will introduce the waterproof brother of the HC-SR04, the JSN-SR04T-2.0.<\/p>\r\n<p>If this series of articles is complete, you will find a link to the summary <a href=\"https:\/\/wolles-elektronikkiste.de\/en\/sensor-comparison-ambient-light-proximity-motion\" target=\"_blank\" rel=\"noopener noreferrer\">here.<\/a><\/p>\n<h2 class=\"wp-block-heading\">Technical data <\/h2>\n<p>The key properties of the HC-SR04 are:<\/p>\r\n<ul>\r\n\t<li><strong>Range:<\/strong> 2 cm to 400 cm<\/li>\r\n\t<li><strong>Voltage:<\/strong> 5 V<\/li>\r\n\t<li><strong>Power consumption:<\/strong> approx. 3.5 mA (fast and continuous measurement, self-determined)\u00a0<\/li>\r\n\t<li><strong>Detection angle:<\/strong> 15\u00b0<\/li>\r\n\t<li><strong>Signal level<\/strong>: TTL<\/li>\r\n\t<li><strong>Accuracy:<\/strong> 0.3 cm (theoretical, more later)<\/li>\r\n\t<li><strong>Measurements per second:<\/strong> max. 50 50<\/li>\r\n<\/ul>\r\n<p>The maximum range depends, among other things, on the size of the object, the angle of incidence of the signal and the surface structure.\u00a0<\/p>\r\n<p>You get the HC-SR04 in a single pack starting at about four euros, for example <a href=\"https:\/\/smile.amazon.de\/s?k=hc-sr04&amp;__mk_de_DE=%C3%85M%C3%85%C5%BD%C3%95%C3%91&amp;ref=nb_sb_noss\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a> at Amazon. It is usually offered in multipacks which are significantly cheaper.\u00a0<\/p>\r\n<p>The most helpful data sheet I found <a href=\"https:\/\/www.mikrocontroller.net\/attachment\/218122\/HC-SR04_ultraschallmodul_beschreibung_3.pdf\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<\/p>\n<h2 class=\"wp-block-heading\">How the HC-SR04 works<\/h2>\n<p>The HC-SR04 makes it like the bat: it emits an ultrasonic signal and evaluates the echo. The distance can then be calculated via the flight time of the signal and the speed of sound.<\/p>\r\n<p>For this purpose, the module has an ultrasonic transmitter, which is marked with a &#8220;T&#8221; on the module. Next to it, marked with &#8220;R&#8221;, the receiver is located.\u00a0<\/p>\n<h3 class=\"wp-block-heading\">Pinout of the HC-SR04<\/h3>\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/HC_SR04.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"624\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/HC_SR04-1024x624.jpg\" alt=\"HC-SR04 ultrasonic module\" class=\"wp-image-8163\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/HC_SR04-1024x624.jpg 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/HC_SR04-300x183.jpg 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/HC_SR04-768x468.jpg 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/HC_SR04-1320x804.jpg 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/HC_SR04.jpg 1800w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>HC-SR04 ultrasonic module<\/figcaption><\/figure><p>The module has four pins:<\/p>\r\n<ul>\r\n\t<li>VCC \/ GND: 5 V are connected here<\/li>\r\n\t<li>Trigger: a change from HIGH to LOW triggers a measurement<\/li>\r\n\t<li>Echo: is HIGH as long as the ultrasonic signal is its way<\/li>\r\n<\/ul>\n<h3 class=\"wp-block-heading\">Exact sequence of a measurement<\/h3>\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/11\/sequence.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"319\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/11\/sequence-1024x319.png\" alt=\"Schematic sequence of a measurement with the HC-SR04\" class=\"wp-image-8164\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/11\/sequence-1024x319.png 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/11\/sequence-300x94.png 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/11\/sequence-768x240.png 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/11\/sequence-1320x412.png 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/11\/sequence.png 1327w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>Schematic sequence of a measurement (timeline is not true to scale)<\/figcaption><\/figure><p>The trigger input first requires a HIGH signal with a length of at least 10 seconds. The falling edge of the trigger signal is the &#8220;starting shot&#8221; for the measurement. After approx. 250 \u00b5s, the HC-SR04 sends the ultrasonic signal as eight 40 kHz pulses. This process requires about 200 \u00b5s. Immediately after sending the signal, the echo pin goes HIGH. It stays on HIGH level until the module receives the reflected signal. After a maximum time of &#8211; according to my measurement &#8211; about 170 ms, the Echo Pin goes to LOW even without receiving echo. By the way, this would correspond to a distance of 29 m. Measurements in this region can therefore be considered as &#8220;no object in range&#8221;.<\/p>\r\n<p>Actually, the Echo pin has to stay on HIGH level until the Echo signal has completely returned, and as this is 200 \u00b5s long, this corresponds to a distance of about 3.5 cm. I have not been able to find any information on this detail, but the results are correct and that is the main thing.\u00a0<\/p>\n<h2 class=\"wp-block-heading\">Evaluation of the HC-SR04 measurement<\/h2>\n<p>The duration of the HIGH state at the Echo pin is measured best using the pulseIn() function. The return value is the time in microseconds.\u00a0<\/p>\r\n<p>There is still the conversion of time into distance. In the first approximation, the speed of sound in dry air at room temperature is 343.2 m\/s. From the mentioned boundary conditions you can already derive that various factors influence the speed of sound, especially the temperature. The following formula describes the temperature dependency in the range from -20 \u00b0C to +40 \u00b0C with an accuracy of &gt; 99.8%.<\/p>\r\n<p>c<sub>Air<\/sub> \u2248 331.5 + 0.6 x T<sub>[\u00b0C] \u00a0<\/sub> [m\/s]<\/p>\r\n<p>If you insert 0 \u00b0C once in this formula and 20 \u00b0C once, you can calculate that it makes a difference of at least 3.5%. This is ten times the accuracy of the HC-SR04 specified in the data sheet. Humidity also has an influence. At 20\u00b0 C, the speed of sound at 100% humidity is 0.375% higher than at 0% humidity. You can neglect other parameters, such as air pressure. If you want to know why this is the case or if you want to know more about the speed of sound in general, then look <a href=\"https:\/\/de.wikipedia.org\/wiki\/Schallgeschwindigkeit\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a> on Wikipedia. \u00a0<\/p>\r\n<p>The simple conversion formula without temperature correction and after taking the units into account is:<\/p>\r\n<p>distance [cm] = measuring time [s] * 0.03432 \/ [cm\/\u00b5s] 2<\/p>\r\n<p>The factor of 1\/2 is of course because the signal has to travel the distance twice. \u00a0<\/p>\n<h2 class=\"wp-block-heading\">The HC-SR04 at Arduino<\/h2>\n\n<h3 class=\"wp-block-heading\">Sketch for distance measurement<\/h3>\n<p>The sketch for distance measurement is no big surprise due to the previous explanations. Compared to the distance measurements with the VL53L0X and VL53L1X from <a href=\"https:\/\/wolles-elektronikkiste.de\/en\/vl53l0x-and-vl53l1x-tof-distance-sensors\" target=\"_blank\" rel=\"noopener noreferrer\">my last post,<\/a> this is all surprisingly simple.<\/p>\r\n<p>If you want to take the temperature into account, then comment the corresponding lines. \u00a0<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-title=\"HC_SR04_Proximity.ino\" data-enlighter-group=\"HC_SR04_Proximity.ino\">int triggerPin = 12;\r\nint\u00a0echoPin\u00a0=\u00a011;\r\n\r\nint\u00a0cmDistance,\u00a0tCorrectedCmDistance;\r\n\/\/int\u00a0temperature\u00a0=\u00a00;\r\nunsigned\u00a0long\u00a0duration;\r\n\r\n\r\nvoid\u00a0setup(){\r\n\u00a0\u00a0pinMode(triggerPin,\u00a0OUTPUT);\r\n\u00a0\u00a0pinMode(echoPin,\u00a0INPUT);\r\n\u00a0\u00a0Serial.begin(9600);\r\n\u00a0\u00a0delay(10);\r\n}\r\n\r\nvoid\u00a0loop(){\r\n\u00a0\u00a0digitalWrite(triggerPin,\u00a0HIGH);\r\n\u00a0\u00a0delayMicroseconds(10);\r\n\u00a0\u00a0digitalWrite(triggerPin,\u00a0LOW);\r\n\u00a0\u00a0duration\u00a0=\u00a0pulseIn(echoPin,\u00a0HIGH);\r\n\u00a0\r\n \u00a0\/\/ Speed of sound in air: 343m\/S (at 20\u00b0C)\r\n\u00a0\u00a0\/\/\u00a0343,2\u00a0m\/S\u00a0--&gt;\u00a034,32cm\u00a0\/\u00a0ms\u00a0--&gt;\u00a00,03432cm\u00a0\/\u00a0\u00b5s\r\n \u00a0\/\/ divided by 2 because it's the echo\r\n\u00a0\u00a0cmDistance\u00a0=\u00a0duration\u00a0*\u00a00.03432\u00a0\/\u00a02;\u00a0\r\n\/\/\u00a0\u00a0tCorrectedCmDistance\u00a0=\u00a0duration\u00a0*(0.03315\u00a0+\u00a00.00006\u00a0*\u00a0temperature)\/2;\r\n \u00a0Serial.print(\"Distance [cm]: \");\r\n\u00a0\u00a0Serial.println(cmDistance);\r\n\/\/\u00a0\u00a0Serial.print(\"T-corrected distance [cm]: \");\r\n\/\/\u00a0\u00a0Serial.println(tCorrectedCmDistance);\r\n\u00a0\u00a0delay(500);\r\n}<\/pre>\r\n<p>&nbsp;<\/p>\n<h3 class=\"wp-block-heading\">Related circuit<\/h3>\n<p>The wiring is also very simple. I need the LED on pin 13 for the motion detector sketch.\u00a0<\/p>\n<figure class=\"wp-block-image\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/hc_sr04_wiring.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"485\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/hc_sr04_wiring-1024x485.png\" alt=\"Wiring: the HC-SR04 controlled by an Arduino\" class=\"wp-image-8165\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/hc_sr04_wiring-1024x485.png 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/hc_sr04_wiring-300x142.png 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/hc_sr04_wiring-768x364.png 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/hc_sr04_wiring-1320x625.png 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/hc_sr04_wiring.png 1626w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>HC-SR04 controlled by an Arduino<\/figcaption><\/figure>\n<h3 class=\"wp-block-heading\">Control via NewPing Library <\/h3>\n<p>For completeness, I would like to mention that there is a library called NewPing that can be used to control the HC-SR04. You can find it <a href=\"https:\/\/github.com\/microflo\/NewPing\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a> on Github. However, I am not a friend of using libraries for such simple tasks.<\/p>\n<h3 class=\"wp-block-heading\">Motion detector sketch<\/h3>\n<p>Of course, you can also use any distance sensor as a motion detector. And that&#8217;s exactly what the next sketch does. A movement occurs when the current distance value differs by a certain value from the previous value.\u00a0<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-title=\"HC_SR04_Movement_Detection.ino\" data-enlighter-group=\"HC_SR04_Movement_Detection.ino\">int\u00a0triggerPin\u00a0=\u00a012;\r\nint\u00a0echoPin\u00a0=\u00a011;\r\nint\u00a0ledPin\u00a0=\u00a013;\r\nint\u00a0cmDistancePrevious,\u00a0cmDistanceCurrent;\r\nconst\u00a0int\u00a0sensitivity\u00a0=\u00a020;\u00a0\r\n\r\nvoid\u00a0setup(){\r\n\u00a0\u00a0pinMode(triggerPin,\u00a0OUTPUT);\r\n\u00a0\u00a0pinMode(ledPin,\u00a0OUTPUT);\r\n\u00a0\u00a0pinMode(echoPin,\u00a0INPUT);\r\n\u00a0\u00a0cmDistancePrevious\u00a0=\u00a0measureDistance();\r\n}\r\n\r\nvoid\u00a0loop(){\r\n\u00a0\u00a0cmDistanceCurrent\u00a0=\u00a0measureDistance();\r\n\u00a0\u00a0\r\n\u00a0\u00a0if\u00a0(abs(cmDistanceCurrent\u00a0-\u00a0cmDistancePrevious)\u00a0&gt;\u00a0sensitivity){\r\n\u00a0\u00a0\u00a0\u00a0digitalWrite(ledPin,\u00a0HIGH);\r\n\u00a0\u00a0\u00a0\u00a0delay(1000);\r\n\u00a0\u00a0\u00a0\u00a0digitalWrite(ledPin,LOW);\r\n\u00a0\u00a0\u00a0\u00a0cmDistanceCurrent\u00a0=\u00a0measureDistance();\r\n\u00a0\u00a0}\r\n\u00a0\u00a0cmDistancePrevious\u00a0=\u00a0cmDistanceCurrent;\r\n\u00a0\u00a0delay(50);\r\n}\r\n\r\nint\u00a0measureDistance(){\r\n\u00a0\u00a0unsigned\u00a0long\u00a0duration\u00a0=\u00a00;\r\n\u00a0\u00a0\r\n\u00a0\u00a0digitalWrite(triggerPin,\u00a0HIGH);\r\n\u00a0\u00a0delayMicroseconds(10);\r\n\u00a0\u00a0digitalWrite(triggerPin,\u00a0LOW);\r\n\u00a0\u00a0duration\u00a0=\u00a0pulseIn(echoPin,\u00a0HIGH);\r\n\u00a0\r\n\u00a0\u00a0int\u00a0cmDis\u00a0=\u00a0duration\u00a0*\u00a00.03432\u00a0\/\u00a02;\u00a0\r\n\r\n\u00a0\u00a0if(cmDis&gt;400){\r\n\u00a0\u00a0\u00a0\u00a0cmDis\u00a0=\u00a0400;\r\n\u00a0\u00a0}\r\n\r\n\u00a0\u00a0return\u00a0cmDis;\r\n}<\/pre>\r\n<p>&nbsp;<\/p>\n<h2 class=\"wp-block-heading\">JSN-SR04T-2.0 &#8211; the waterproof alternative<\/h2>\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/jsn-sr04t__small.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"851\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/jsn-sr04t__small-1024x851.jpg\" alt=\"JSN-SR04T (version 2.0)\" class=\"wp-image-8167\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/jsn-sr04t__small-1024x851.jpg 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/jsn-sr04t__small-300x249.jpg 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/jsn-sr04t__small-768x639.jpg 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/jsn-sr04t__small-1320x1098.jpg 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/jsn-sr04t__small.jpg 2000w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>JSN-SR04T<\/figcaption><\/figure><p>Next, I would like to introduce a very interesting alternative to the HC-SR04, namely the JSN-SR04T-2.0. In this case, the transmitter\/receiver unit is very compact, waterproof and connected to the module via a 2.5 m extension cable. On the one hand, this makes outdoor applications possible, for example, and on the other hand, the measuring unit can be installed much more discreetly. One restriction to this version is that it requires a minimum distance of 25 cm. \u00a0<\/p>\r\n<p>You can get the JSN-SR04T-2.0 for about 10 &#8211; 12 euros on Amazon or eBay. If you order from Chinese shops via these platforms, it will be cheaper again, but you may have to be patient with the delivery.<\/p>\n<h3 class=\"wp-block-heading\">JSN-SR04T vs. JSN-SR04T-2.0 \/ JSN-SR04T issues<\/h3>\n<p>In addition to the JSN-SR04T-2.0, there is also the version JSN-SR04T, i.e. without &#8220;2.0&#8221;. This looks very similar at first glance, but has a few clear differences. Above all, the JSN-SR04T lacks the jumper R27, which I will come to talk about.<\/p>\r\n<p>Some JSN-SR04T-2.0 models have problems with incorrect measurements. Sporadically distance values of around 20 cm are determined, although nothing is in this area. I noticed this for one of the three modules I bought. The other two did not show the problem. However, since the error is also described by others (e.g. <a href=\"https:\/\/www.youtube.com\/watch?v=N42Y-QOqwtA\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>) it does not seem to be a seldom exception.\u00a0<\/p>\r\n<p>One could be tempted to buy a JSN-SR04T because of these issues. But even if shops have product images of the JSN-SR04T and even if nothing else in the product description refers to version 2.0, you will probably still get version 2.0. In any case, this has happened to me in two out of two attempts. Then I lost my motivation and gave up testing a JSN-SR04T.\u00a0<\/p>\r\n<p>Also <a href=\"https:\/\/smile.amazon.de\/gp\/product\/B076SWF5FV\/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;psc=1\" target=\"_blank\" rel=\"noopener noreferrer\">in this shop here<\/a> I got the version 2.0, although the other one was pictured. However, I tested this representative most intensively, and it worked without any problems. For this source speaks the absence of negative ratings (as of August 2019).\u00a0<\/p>\n<h3 class=\"wp-block-heading\">HC-SR04 vs. JSN-SR04T-2.0<\/h3>\n<p>Apart from the differences already mentioned, the JSN-SR04T has the following special features:<\/p>\r\n<ul>\r\n\t<li><strong>Power supply:<\/strong> 3 &#8211; 5.5 V<\/li>\r\n\t<li><strong>Power consumption:<\/strong> approx. 8 mA<\/li>\r\n\t<li><strong>Range:<\/strong> supposedly up to 6 meters<\/li>\r\n\t<li><strong>Detection angle:<\/strong> 45\u00b0 &#8211; 75\u00b0; here, too, different data are found &#8211; in any case, the angle of coverage is wider than that of the HC-SR04<\/li>\r\n\t<li><strong>Communication<\/strong>: such as the HC-SR04 via trigger \/ echo or serial (RX \/ TX)<\/li>\r\n\t<li><strong>Baud rate:<\/strong> 9600, n, 8, 1\u00a0<\/li>\r\n<\/ul>\r\n<p>The maximum range depends on the size of the object, its surface condition, and the angle of incidence of the signal. I would say that the limit, as with the HC-SR04, is rather 4 meters. With large, smooth walls, for example, you get a little beyond that.\u00a0<\/p>\r\n<p>Data sheets for the JSN-SR04T-2.0 are hard to find. <a href=\"https:\/\/www.google.de\/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=1&amp;ved=2ahUKEwinqZOMvqbkAhUMYlAKHQ9hD80QFjAAegQIABAC&amp;url=https%3A%2F%2Fwww.jahankitshop.com%2Fgetattach.aspx%3Fid%3D4635%26Type%3DProduct&amp;usg=AOvVaw0v_VKu_EYJoKstjsEl-ct8\" target=\"_blank\" rel=\"noopener noreferrer\">Here&#8217;s<\/a> the best I&#8217;ve come across.\u00a0<\/p>\n<h3 class=\"wp-block-heading\">The three operating modes of the JSN-SR04T-2.0<\/h3>\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/R27_open.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"995\" height=\"427\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/R27_open.jpg\" alt=\"R27 Jumper for setting the operating modes of the JSN-SR04T-2.0\" class=\"wp-image-8168\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/R27_open.jpg 995w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/R27_open-300x129.jpg 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/R27_open-768x330.jpg 768w\" sizes=\"auto, (max-width: 995px) 100vw, 995px\" \/><\/a><figcaption>R27 Jumper for setting operating modes<\/figcaption><\/figure><p>On the module you find the jumper R27 next to the pins. You can leave it unconnected, you can solder a 47 kOhm resistor in between or take a 120 kOhm resistor. With this measure, you determine the operating mode. \u00a0<\/p>\n<h4 class=\"wp-block-heading\">Mode 1: R27 open<\/h4>\n<p>In this mode, the JSN-SR04T-2.0 behaves like the HC-SR04, which means you control it via the trigger and echo pin. You can use the same Arduino Sketch as the HC-SR04, but with <b>a small change<\/b>. For every fifth to tenth measurement, I obtained a zero as a result. If you have the same problem, increase the &#8220;HIGH time&#8221; on the trigger pin from 10 to 20 microseconds (line 18 in HC_SR04_Proximity.ino). With this measure, the error did not occur to me anymore.\u00a0<\/p>\n<h4 class=\"wp-block-heading\">Mode 2: 47 kOhm resistance at R27<\/h4>\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/R27_Solder_ausschnitt.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"486\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/R27_Solder_ausschnitt-1024x486.jpg\" alt=\"47 kOhm at R27 of the JSN-SR04T-2.0 for mode 2\" class=\"wp-image-8169\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/R27_Solder_ausschnitt-1024x486.jpg 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/R27_Solder_ausschnitt-300x142.jpg 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/R27_Solder_ausschnitt-768x364.jpg 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/R27_Solder_ausschnitt-1320x626.jpg 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/R27_Solder_ausschnitt.jpg 2035w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>47 kOhm at R27 &#8211; Mode 2 (an SMD would have been more robust, but I did not have the right one)<\/figcaption><\/figure><p>With a 47 kOhm resistor at R27, the JSN-SR04T-2.0 enters a continuous operating mode. In this mode, a measurement is performed every 100 ms. The result of this measurement is the distance in millimeters, which is transmitted serially as a 16 bit value. The trigger pin becomes RX, the Echo pin becomes TX. The JSN-SR04T-2.0 transmits 4 bytes per measurement:<\/p>\r\n<ol>\r\n\t<li>Start byte: 0xFF\u00a0<\/li>\r\n\t<li>Upper byte of distance (h_data)<\/li>\r\n\t<li>Lower byte of distance (l_data)<\/li>\r\n\t<li>Checksum: lower byte of the sum of start byte + h_data + l_data<\/li>\r\n<\/ol><p>In my sketch (JSN_SR04T_Serial_continous.ino) the communication takes place via SoftwareSerial. I defined the Arduino pins 10 and 11 as RX pin or TX pin. The RX of the Arduino is connected to TX of the module, TX of the Arduino is connected to RX of the module. I think I can save myself a switching scheme.\u00a0<\/p>\r\n<p>If there is data at the serial input, the sketch checks whether it is the start byte. If this is the case, the next 3 bytes are read and stored in an array (&#8220;buf&#8221;). The distance is then calculated from h_data and l_data. Finally, the sketch checks the checksum. To do this, the upper byte must be masked. If the checksum is OK, the result is output.\u00a0<\/p>\r\n<p>I defined the variables h_data, l_data and sum only for didactic reasons. You can also work directly with buf[0], buf[1] and buf[2].\u00a0<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-title=\"JSN_SR04T_Serial_continous.ino\" data-enlighter-group=\"JSN_SR04T_Serial_continous.ino\">#include\u00a0&lt;SoftwareSerial.h&gt;\r\n#define\u00a0rxPin\u00a010\r\n#define\u00a0txPin\u00a011\r\n\u00a0\r\nSoftwareSerial\u00a0jsnSerial(rxPin,\u00a0txPin);\r\n\u00a0\r\nvoid\u00a0setup()\u00a0{\r\n\u00a0\u00a0jsnSerial.begin(9600);\r\n\u00a0\u00a0Serial.begin(9600);\r\n}\r\n\u00a0\r\nvoid\u00a0loop()\u00a0{\r\n\u00a0\u00a0if(jsnSerial.available()){\r\n\u00a0\u00a0\u00a0\u00a0getDistance();\r\n\u00a0\u00a0}\r\n}\r\n\r\nvoid\u00a0getDistance(){\r\n\u00a0\u00a0unsigned\u00a0int\u00a0distance;\r\n\u00a0\u00a0byte\u00a0startByte,\u00a0h_data,\u00a0l_data,\u00a0sum\u00a0=\u00a00;\r\n\u00a0\u00a0byte\u00a0buf[3];\r\n\u00a0\u00a0\r\n\u00a0\u00a0startByte\u00a0=\u00a0(byte)jsnSerial.read();\r\n\u00a0\u00a0if(startByte\u00a0==\u00a0255){\r\n\u00a0\u00a0\u00a0\u00a0jsnSerial.readBytes(buf,\u00a03);\r\n\r\n\u00a0\u00a0\u00a0\u00a0h_data\u00a0=\u00a0buf[0];\r\n\u00a0\u00a0\u00a0\u00a0l_data\u00a0=\u00a0buf[1];\r\n\u00a0\u00a0\u00a0\u00a0sum\u00a0=\u00a0buf[2];\r\n\u00a0\u00a0\u00a0\u00a0distance\u00a0=\u00a0(h_data&lt;&lt;8)\u00a0+\u00a0l_data;\r\n\r\n\u00a0\u00a0\u00a0\u00a0if(((startByte\u00a0+\u00a0h_data\u00a0+\u00a0l_data)&amp;0xFF)\u00a0!=\u00a0sum){\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Serial.println(\"Invalid\u00a0result\");\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0\u00a0else{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Serial.print(\"Distance\u00a0[mm]:\u00a0\");\u00a0\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Serial.println(distance);\r\n\u00a0\u00a0\u00a0\u00a0}\u00a0\r\n\u00a0\u00a0}\u00a0\r\n\u00a0\u00a0else\u00a0return;\r\n}<\/pre>\r\n<p>&nbsp;<\/p>\r\n<h4>Mode 3: 120 kOhm resistance at R27<\/h4><p>Unlike mode 2, mode 3 is a polling method, i.e. a measurement is performed on request. The communication is serial again. A measurement is started by sending 0x55. In the following sketch, a pushbutton triggers this start signal. The &#8220;pick up&#8221; of the result, on the other hand, is no different from the previous sketch.<\/p><div class=\"scroll-paragraph-long\">\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-title=\"JSN_SR04T_Serial_Polling.ino\" data-enlighter-group=\"JSN_SR04T_Serial_Polling.ino\">#include\u00a0&lt;SoftwareSerial.h&gt;\r\n#define\u00a0rxPin\u00a010\r\n#define\u00a0txPin\u00a011\r\n#define\u00a0switchPin\u00a09\r\n\u00a0\r\nSoftwareSerial\u00a0jsnSerial(rxPin,\u00a0txPin);\r\n\u00a0\r\nvoid\u00a0setup()\u00a0{\r\n\u00a0\u00a0jsnSerial.begin(9600);\r\n\u00a0\u00a0Serial.begin(9600);\r\n\u00a0\u00a0pinMode(switchPin,\u00a0INPUT);\r\n}\r\n\u00a0\r\nvoid\u00a0loop()\u00a0{\r\n\u00a0\u00a0if(digitalRead(switchPin)\u00a0==\u00a0HIGH){\r\n\u00a0\u00a0\u00a0\u00a0jsnSerial.write(0x55);\r\n\u00a0\u00a0\u00a0\u00a0delay(50);\r\n\u00a0\u00a0\u00a0\u00a0if(jsnSerial.available()){\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0getDistance();\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0\u00a0delay(1000);\r\n\u00a0\u00a0}\r\n}\r\n\r\nvoid\u00a0getDistance(){\r\n\u00a0\u00a0unsigned\u00a0int\u00a0distance;\r\n\u00a0\u00a0byte\u00a0startByte,\u00a0h_data,\u00a0l_data,\u00a0sum\u00a0=\u00a00;\r\n\u00a0\u00a0byte\u00a0buf[3];\r\n\u00a0\u00a0\r\n\u00a0\u00a0startByte\u00a0=\u00a0(byte)jsnSerial.read();\r\n\u00a0\u00a0if(startByte\u00a0==\u00a0255){\r\n\u00a0\u00a0\u00a0\u00a0jsnSerial.readBytes(buf,\u00a03);\r\n\r\n\u00a0\u00a0\u00a0\u00a0h_data\u00a0=\u00a0buf[0];\r\n\u00a0\u00a0\u00a0\u00a0l_data\u00a0=\u00a0buf[1];\r\n\u00a0\u00a0\u00a0\u00a0sum\u00a0=\u00a0buf[2];\r\n\u00a0\u00a0\u00a0\u00a0distance\u00a0=\u00a0(h_data&lt;&lt;8)\u00a0+\u00a0l_data;\r\n\r\n\u00a0\u00a0\u00a0\u00a0if(((startByte\u00a0+\u00a0h_data\u00a0+\u00a0l_data)&amp;0xFF)\u00a0!=\u00a0sum){\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Serial.println(\"Invalid\u00a0result\");\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0\u00a0else{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Serial.print(\"Distance\u00a0[mm]:\u00a0\");\u00a0\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Serial.println(distance);\r\n\u00a0\u00a0\u00a0\u00a0}\u00a0\r\n\u00a0\u00a0}\u00a0\r\n\u00a0\u00a0else\u00a0return;\r\n}<\/pre>\r\n<p>&nbsp;<\/p>\r\n<\/div>\n<h2 class=\"wp-block-heading\">Acknowledgement<\/h2>\n<p>The bat in the post image is taken from <a href=\"https:\/\/pixabay.com\/de\/users\/Schmidsi-104144\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=1775692\" target=\"_blank\" rel=\"noopener noreferrer\">Schmidsi<\/a> on <a href=\"https:\/\/pixabay.com\/de\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=1775692\" target=\"_blank\" rel=\"noopener noreferrer\">Pixabay<\/a>.<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>The distance sensors HC-SR04 and JSN-SR04T-2.0 are introduced in terms of their functions, differences and control with the Arduino. <\/p>\n","protected":false},"author":1,"featured_media":8166,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[573,572],"tags":[825,828,830,833,836,835,838,801,829,832,827],"class_list":["post-9412","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-distance-light-movement","category-sensors","tag-hc-sr04-en","tag-hc-sr04-am-arduino-en","tag-hc-sr04-module","tag-jsn-sr04t-en","tag-jsn-sr04t-vs-jsn-sr04t-2-0-en","tag-jsn-sr04t-2-0-en","tag-probleme-mit-jsn-sr04t-2-0-en","tag-proximity-detection-en","tag-speed-of-sound","tag-temperature-correction","tag-ultrasound"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>HC-SR04 and JSN-SR04T-2.0 distance sensors &#8226; Wolles Elektronikkiste<\/title>\n<meta name=\"description\" content=\"The distance sensors HC-SR04 and JSN-SR04T-2.0 are introduced in terms of their functions, differences and control with the Arduino.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wolles-elektronikkiste.de\/en\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"HC-SR04 and JSN-SR04T-2.0 distance sensors &#8226; Wolles Elektronikkiste\" \/>\n<meta property=\"og:description\" content=\"The distance sensors HC-SR04 and JSN-SR04T-2.0 are introduced in terms of their functions, differences and control with the Arduino.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wolles-elektronikkiste.de\/en\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors\" \/>\n<meta property=\"og:site_name\" content=\"Wolles Elektronikkiste\" \/>\n<meta property=\"article:published_time\" content=\"2020-11-07T11:01:58+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-12-02T11:23:34+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/Beitragsbild-2.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1303\" \/>\n\t<meta property=\"og:image:height\" content=\"1303\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Wolfgang Ewald\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Wolfgang Ewald\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"11 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors\"},\"author\":{\"name\":\"Wolfgang Ewald\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#\\\/schema\\\/person\\\/b774e4d64b4766889a2f7c6e5ec85b46\"},\"headline\":\"HC-SR04 and JSN-SR04T-2.0 distance sensors\",\"datePublished\":\"2020-11-07T11:01:58+00:00\",\"dateModified\":\"2020-12-02T11:23:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors\"},\"wordCount\":1828,\"commentCount\":17,\"publisher\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#\\\/schema\\\/person\\\/b774e4d64b4766889a2f7c6e5ec85b46\"},\"image\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/08\\\/Beitragsbild-2.jpg\",\"keywords\":[\"HC-SR04\",\"HC-SR04 am Arduino\",\"HC-SR04 module\",\"JSN-SR04T\",\"JSN-SR04T vs. JSN-SR04T-2.0\",\"JSN-SR04T-2.0\",\"Probleme mit JSN-SR04T-2.0\",\"Proximity detection\",\"speed of sound\",\"temperature correction\",\"ultrasound\"],\"articleSection\":[\"Distance, light, movement\",\"Sensors\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors\",\"url\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors\",\"name\":\"HC-SR04 and JSN-SR04T-2.0 distance sensors &#8226; Wolles Elektronikkiste\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/08\\\/Beitragsbild-2.jpg\",\"datePublished\":\"2020-11-07T11:01:58+00:00\",\"dateModified\":\"2020-12-02T11:23:34+00:00\",\"description\":\"The distance sensors HC-SR04 and JSN-SR04T-2.0 are introduced in terms of their functions, differences and control with the Arduino.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors#primaryimage\",\"url\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/08\\\/Beitragsbild-2.jpg\",\"contentUrl\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/08\\\/Beitragsbild-2.jpg\",\"width\":1303,\"height\":1303},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Startseite\",\"item\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"HC-SR04 and JSN-SR04T-2.0 distance sensors\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#website\",\"url\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\",\"name\":\"Wolles Elektronikkiste\",\"description\":\"Die wunderbare Welt der Elektronik\",\"publisher\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#\\\/schema\\\/person\\\/b774e4d64b4766889a2f7c6e5ec85b46\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#\\\/schema\\\/person\\\/b774e4d64b4766889a2f7c6e5ec85b46\",\"name\":\"Wolfgang Ewald\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/cropped-Logo-1.png\",\"url\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/cropped-Logo-1.png\",\"contentUrl\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/cropped-Logo-1.png\",\"width\":512,\"height\":512,\"caption\":\"Wolfgang Ewald\"},\"logo\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/cropped-Logo-1.png\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"HC-SR04 and JSN-SR04T-2.0 distance sensors &#8226; Wolles Elektronikkiste","description":"The distance sensors HC-SR04 and JSN-SR04T-2.0 are introduced in terms of their functions, differences and control with the Arduino.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/wolles-elektronikkiste.de\/en\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors","og_locale":"en_US","og_type":"article","og_title":"HC-SR04 and JSN-SR04T-2.0 distance sensors &#8226; Wolles Elektronikkiste","og_description":"The distance sensors HC-SR04 and JSN-SR04T-2.0 are introduced in terms of their functions, differences and control with the Arduino.","og_url":"https:\/\/wolles-elektronikkiste.de\/en\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors","og_site_name":"Wolles Elektronikkiste","article_published_time":"2020-11-07T11:01:58+00:00","article_modified_time":"2020-12-02T11:23:34+00:00","og_image":[{"width":1303,"height":1303,"url":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/Beitragsbild-2.jpg","type":"image\/jpeg"}],"author":"Wolfgang Ewald","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Wolfgang Ewald","Est. reading time":"11 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/wolles-elektronikkiste.de\/en\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors#article","isPartOf":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors"},"author":{"name":"Wolfgang Ewald","@id":"https:\/\/wolles-elektronikkiste.de\/en#\/schema\/person\/b774e4d64b4766889a2f7c6e5ec85b46"},"headline":"HC-SR04 and JSN-SR04T-2.0 distance sensors","datePublished":"2020-11-07T11:01:58+00:00","dateModified":"2020-12-02T11:23:34+00:00","mainEntityOfPage":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors"},"wordCount":1828,"commentCount":17,"publisher":{"@id":"https:\/\/wolles-elektronikkiste.de\/en#\/schema\/person\/b774e4d64b4766889a2f7c6e5ec85b46"},"image":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors#primaryimage"},"thumbnailUrl":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/Beitragsbild-2.jpg","keywords":["HC-SR04","HC-SR04 am Arduino","HC-SR04 module","JSN-SR04T","JSN-SR04T vs. JSN-SR04T-2.0","JSN-SR04T-2.0","Probleme mit JSN-SR04T-2.0","Proximity detection","speed of sound","temperature correction","ultrasound"],"articleSection":["Distance, light, movement","Sensors"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/wolles-elektronikkiste.de\/en\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors#respond"]}]},{"@type":"WebPage","@id":"https:\/\/wolles-elektronikkiste.de\/en\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors","url":"https:\/\/wolles-elektronikkiste.de\/en\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors","name":"HC-SR04 and JSN-SR04T-2.0 distance sensors &#8226; Wolles Elektronikkiste","isPartOf":{"@id":"https:\/\/wolles-elektronikkiste.de\/en#website"},"primaryImageOfPage":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors#primaryimage"},"image":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors#primaryimage"},"thumbnailUrl":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/Beitragsbild-2.jpg","datePublished":"2020-11-07T11:01:58+00:00","dateModified":"2020-12-02T11:23:34+00:00","description":"The distance sensors HC-SR04 and JSN-SR04T-2.0 are introduced in terms of their functions, differences and control with the Arduino.","breadcrumb":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wolles-elektronikkiste.de\/en\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wolles-elektronikkiste.de\/en\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors#primaryimage","url":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/Beitragsbild-2.jpg","contentUrl":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/08\/Beitragsbild-2.jpg","width":1303,"height":1303},{"@type":"BreadcrumbList","@id":"https:\/\/wolles-elektronikkiste.de\/en\/hc-sr04-and-jsn-sr04t-2-0-distance-sensors#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Startseite","item":"https:\/\/wolles-elektronikkiste.de\/en"},{"@type":"ListItem","position":2,"name":"HC-SR04 and JSN-SR04T-2.0 distance sensors"}]},{"@type":"WebSite","@id":"https:\/\/wolles-elektronikkiste.de\/en#website","url":"https:\/\/wolles-elektronikkiste.de\/en","name":"Wolles Elektronikkiste","description":"Die wunderbare Welt der Elektronik","publisher":{"@id":"https:\/\/wolles-elektronikkiste.de\/en#\/schema\/person\/b774e4d64b4766889a2f7c6e5ec85b46"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wolles-elektronikkiste.de\/en?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/wolles-elektronikkiste.de\/en#\/schema\/person\/b774e4d64b4766889a2f7c6e5ec85b46","name":"Wolfgang Ewald","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/03\/cropped-Logo-1.png","url":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/03\/cropped-Logo-1.png","contentUrl":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/03\/cropped-Logo-1.png","width":512,"height":512,"caption":"Wolfgang Ewald"},"logo":{"@id":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/03\/cropped-Logo-1.png"}}]}},"_links":{"self":[{"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/posts\/9412","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/comments?post=9412"}],"version-history":[{"count":0,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/posts\/9412\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/media\/8166"}],"wp:attachment":[{"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/media?parent=9412"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/categories?post=9412"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/tags?post=9412"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}