{"id":4333,"date":"2012-01-10T19:40:13","date_gmt":"2012-01-11T00:40:13","guid":{"rendered":"http:\/\/embedded-lab.com\/blog\/?p=4333"},"modified":"2012-11-06T13:49:06","modified_gmt":"2012-11-06T18:49:06","slug":"measurement-of-temperature-and-relative-humidity-using-dht11-sensor-and-pic-microcontroller","status":"publish","type":"post","link":"https:\/\/embedded-lab.com\/blog\/measurement-of-temperature-and-relative-humidity-using-dht11-sensor-and-pic-microcontroller\/","title":{"rendered":"Measurement of temperature and relative humidity using DHT11 sensor and PIC microcontroller"},"content":{"rendered":"<p>Measurement and control of temperature and relative humidity finds applications in numerous areas. These days devices are available which have both temperature and humidity sensors with signal conditioning, ADC, calibration and communication interface all built inside them. The use of such smart sensors greatly simplify the design and reduces the overall cost. We discussed in past about\u00a0<a title=\"Permanent Link to Humidity and temperature measurements with Sensirion\u2019s SHT1x\/SHT7x sensors (Part 1)\" href=\"http:\/\/embedded-lab.com\/blog\/?p=2711\" rel=\"bookmark\">Humidity and temperature measurements with Sensirion\u2019s SHT1x\/SHT7x sensors<\/a>. These sensors are capable of measuring both temperature and relative humidity and provide fully calibrated digital outputs. While \u00a0SHT1x\/SHT7x are very accurate sensors, they are still expensive for hobbyists use. This articles discusses the DHT11 sensor which also provides calibrated digital outputs for temperature and humidity but is relatively lot cheaper than the Sensirion sensors. The DHT11 sensor uses a proprietary 1-wire protocol which we will be exploring here and implementing with the PIC16F628A microcontroller that will receive the temperature and humidity values from the sensor and display them on a 16&#215;2 character LCD.<\/p>\n<div id=\"attachment_4348\" style=\"width: 570px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/DHT11_Title.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4348\" class=\"size-full wp-image-4348\" title=\"DHT11_Title\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/DHT11_Title.jpg\" alt=\"\" width=\"560\" height=\"420\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/DHT11_Title.jpg 560w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/DHT11_Title-550x412.jpg 550w\" sizes=\"auto, (max-width: 560px) 100vw, 560px\" \/><\/a><p id=\"caption-attachment-4348\" class=\"wp-caption-text\">Interfacing DHT11 sensor with PIC16F628A<\/p><\/div>\n<p><!--more--><\/p>\n<p><strong>About DHT11 sensor<\/strong><\/p>\n<p>The DHT11 sensor comes in a single row 4-pin package and\u00a0operates from 3.5 to 5.5V power supply. It can measure temperature from 0-50 \u00b0C with an accuracy of \u00b12\u00b0C and relative humidity ranging from 20-95% with an accuracy of \u00a0\u00b15%. The sensor provides fully calibrated digital outputs for the two measurements. It has got its own proprietary 1-wire protocol, and therefore, the communication between the sensor and a microcontroller is not possible through a direct interface with any of its peripherals. The protocol must be implemented in the firmware of the MCU with precise timing required by the sensor.<\/p>\n<div id=\"attachment_4355\" style=\"width: 570px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/DHT11Sensor1.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4355\" class=\"size-full wp-image-4355\" title=\"DHT11Sensor\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/DHT11Sensor1.jpg\" alt=\"\" width=\"560\" height=\"300\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/DHT11Sensor1.jpg 560w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/DHT11Sensor1-550x294.jpg 550w\" sizes=\"auto, (max-width: 560px) 100vw, 560px\" \/><\/a><p id=\"caption-attachment-4355\" class=\"wp-caption-text\">DHT11 sensor comes in a single row 4-pin package<\/p><\/div>\n<p>The following timing diagrams describe the data transfer protocol between a MCU and the DHT11 sensor. The MCU initiates data transmission by\u00a0issuing a &#8220;<em><strong>Start<\/strong><\/em>&#8221; signal. The MCU pin must be configured as output for this purpose. The MCU first pulls the data line low for at least 18 ms and then pulls it high for next 20-40 ?s before it releases it. Next, the sensor responds to the MCU &#8220;<em><strong>Start<\/strong><\/em>&#8221;\u00a0\u00a0signal by pulling the line low for 80 ?s followed by a logic high signal that also lasts for 80 ?s. Remember that the MCU pin must be configured to input after finishing the &#8220;<em><strong>Start<\/strong><\/em>&#8221;\u00a0signal. Once detecting the response signal from the sensor, the MCU should be ready to receive data from the sensor. The sensor then sends 40 bits (5 bytes) of data continuously in the data line.\u00a0Note that while transmitting bytes, the sensor sends the most significant bit first.<\/p>\n<div id=\"attachment_4358\" style=\"width: 577px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/TimingDiagram1.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4358\" class=\"size-full wp-image-4358\" title=\"TimingDiagram1\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/TimingDiagram1.jpg\" alt=\"\" width=\"567\" height=\"238\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/TimingDiagram1.jpg 567w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/TimingDiagram1-550x230.jpg 550w\" sizes=\"auto, (max-width: 567px) 100vw, 567px\" \/><\/a><p id=\"caption-attachment-4358\" class=\"wp-caption-text\">&quot;Start&quot; and &quot;Response&quot; signals<\/p><\/div>\n<p>The 40-bit data from the sensor has the following structure.<\/p>\n<p><strong><em>Data (40-bit) = Integer Byte of RH + Decimal Byte of RH + Integer Byte of Temp. + Decimal Byte of Temp. + Checksum Byte<\/em><\/strong><\/p>\n<p>For DHT11 sensor, the decimal bytes of temperature and humidity measurements are always zero. Therefore, the first and third bytes of received data actually give the numeric values of the measured relative humidity (%) and temperature (\u00b0C). The last byte is the checksum byte which is used to make sure that the data transfer has happened without any error. If all the five bytes are transferred successfully then the checksum byte must be equal to the last 8 bits of the sum of the first four bytes, i.e.,<\/p>\n<p><em><strong>Checksum<\/strong> = <strong>Last 8 bits of<\/strong> (Integer Byte of RH + Decimal Byte of RH + Integer Byte of Temp. + Decimal Byte of Temp.)\u00a0<\/em><\/p>\n<p>Now lets talk about the most important thing, which is signalling for transmitting &#8220;0&#8221; and &#8220;1&#8221;. In order to send a bit of data, the sensor first pulls the line low for 50\u00a0?s. Then it raises the line to high for 26-28 ?s if it has to send &#8220;0&#8221;, or for 70\u00a0?s if the bit to be transmitted is &#8220;1&#8221;.\u00a0So it is the width of the positive pulse that carries information about 1 and 0.<\/p>\n<div id=\"attachment_4360\" style=\"width: 531px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/TimingDiagram2.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4360\" class=\"size-full wp-image-4360\" title=\"TimingDiagram2\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/TimingDiagram2.jpg\" alt=\"\" width=\"521\" height=\"204\" \/><\/a><p id=\"caption-attachment-4360\" class=\"wp-caption-text\">Timing difference for transmitting &quot;1s&quot; and &quot;0s&quot;<\/p><\/div>\n<div id=\"attachment_4363\" style=\"width: 579px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/CombinedTiming.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4363\" class=\"size-full wp-image-4363\" title=\"CombinedTiming\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/CombinedTiming.jpg\" alt=\"\" width=\"569\" height=\"185\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/CombinedTiming.jpg 569w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/CombinedTiming-550x178.jpg 550w\" sizes=\"auto, (max-width: 569px) 100vw, 569px\" \/><\/a><p id=\"caption-attachment-4363\" class=\"wp-caption-text\">Start, Response and Data signals in sequence<\/p><\/div>\n<p>At the end of the last transmitted bit, the sensor pulls the data line low for 50 ?s and then releases it. The DHT11 sensor requires an external pull-up resistor to be connected between its Vcc and the data line so that under idle condition, the data line is always pulled high. After finishing the data transmission and releasing the data line, the DHT11 sensor goes to the low-power consumption mode until a new &#8220;<em><strong>Start<\/strong><\/em>&#8221; signal arrives from the MCU.<br \/>\n<strong><\/strong><\/p>\n<p><strong>Circuit diagram<\/strong><\/p>\n<p>Here is the circuit diagram showing the DHT11 sensor and a HD44780-based character LCD interfaced to the PIC16F628A microcontroller. The microcontroller runs at 4.0 MHz clock using an external resonator connected between OSC1 (16) and OSC2 (15) pins. The use of 4.0 MHz clock makes the timing calculation easier as 1 machine cycle becomes 1 ?s. The timing information will be used to calculate the width of the received data pulse from the sensor so that we could identify if it is carrying a 1 or 0.<\/p>\n<div id=\"attachment_4343\" style=\"width: 585px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/DHT11_PIC16F.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4343\" class=\"size-full wp-image-4343\" title=\"DHT11_PIC16F\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/DHT11_PIC16F.jpg\" alt=\"\" width=\"575\" height=\"574\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/DHT11_PIC16F.jpg 575w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/DHT11_PIC16F-150x150.jpg 150w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/DHT11_PIC16F-550x549.jpg 550w\" sizes=\"auto, (max-width: 575px) 100vw, 575px\" \/><\/a><p id=\"caption-attachment-4343\" class=\"wp-caption-text\">Circuit connections for PIC16F628A and DHT11 sensor<\/p><\/div>\n<p>The following pictures show the circuit setup on a breadboard. Don&#8217;t get confused with the four LEDs and tact switches shown on the perforated board. They have nothing to do with this project. They are there because I am using my <strong><a href=\"http:\/\/embedded-lab.com\/blog\/?p=3596\" target=\"_blank\">DIY Experimenter&#8217;s I\/O board<\/a><\/strong> for the LCD part of this project. Similarly, I am using my <strong><a href=\"http:\/\/embedded-lab.com\/blog\/?p=4260\" target=\"_blank\">18-pin PIC16F board<\/a><\/strong> for easy prototyping with the PIC16F628A microcontroller.<\/p>\n<div id=\"attachment_4352\" style=\"width: 570px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/DHTSetup.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4352\" class=\"size-full wp-image-4352\" title=\"DHTSetup\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/DHTSetup.jpg\" alt=\"\" width=\"560\" height=\"422\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/DHTSetup.jpg 560w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/DHTSetup-550x414.jpg 550w\" sizes=\"auto, (max-width: 560px) 100vw, 560px\" \/><\/a><p id=\"caption-attachment-4352\" class=\"wp-caption-text\">Complete setup of the circuit<\/p><\/div>\n<div id=\"attachment_4370\" style=\"width: 570px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/CircuitSetup.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4370\" class=\"size-full wp-image-4370\" title=\"CircuitSetup\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/CircuitSetup.jpg\" alt=\"\" width=\"560\" height=\"385\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/CircuitSetup.jpg 560w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/CircuitSetup-550x378.jpg 550w\" sizes=\"auto, (max-width: 560px) 100vw, 560px\" \/><\/a><p id=\"caption-attachment-4370\" class=\"wp-caption-text\">PIC16F628A module and the DHT11 sensor are plugged into the breadboard<\/p><\/div>\n<p><strong>Software<\/strong><\/p>\n<p>Writing a software for DHT11 sensor is little more challenging than the hardware part because of the timing conditions for 1s and 0s. I have written sub-routines in mikroC Pro for PIC for initializing the DHT11 sensor and reading the 40-bit of data in sequence. I have used Timer2 module to keep track of the width of the received data pulse, which is required to identify if the received bit is 1 or 0. When a low-to-high pulse is detected at the\u00a0beginning\u00a0of any data bit, TMR2 is cleared and turned ON. Since the clock frequency used here is 4.0 MHz, the TMR2 increments by 1 in every 1\u00a0?s.\u00a0The TMR2 is stopped whenever the data pulse is low again. The value of the TMR2 register gives you the the width of the data pulse in ?s. I am using 40 ?s as the threshold for identifying 0 and 1. If the TMR2 is greater than 40, it means the received bit is 1, else it is 0.\u00a0Here is the complete source code written in mikroC Pro for PIC. It can be easily adapted to any other platform, but remember that if you are using a different clock frequency you should have to modify the timer operation accordingly.<\/p>\n\n<div class=\"wp_syntax\"><table><tr><td class=\"code\"><pre class=\"c\" style=\"font-family:monospace;\"><span style=\"color: #666666; font-style: italic;\">\/\/ LCD module connections<\/span>\nsbit LCD_RS at RB2_bit<span style=\"color: #339933;\">;<\/span>\nsbit LCD_EN at RB3_bit<span style=\"color: #339933;\">;<\/span>\nsbit LCD_D4 at RB4_bit<span style=\"color: #339933;\">;<\/span>\nsbit LCD_D5 at RB5_bit<span style=\"color: #339933;\">;<\/span>\nsbit LCD_D6 at RB6_bit<span style=\"color: #339933;\">;<\/span>\nsbit LCD_D7 at RB7_bit<span style=\"color: #339933;\">;<\/span>\nsbit LCD_RS_Direction at TRISB2_bit<span style=\"color: #339933;\">;<\/span>\nsbit LCD_EN_Direction at TRISB3_bit<span style=\"color: #339933;\">;<\/span>\nsbit LCD_D4_Direction at TRISB4_bit<span style=\"color: #339933;\">;<\/span>\nsbit LCD_D5_Direction at TRISB5_bit<span style=\"color: #339933;\">;<\/span>\nsbit LCD_D6_Direction at TRISB6_bit<span style=\"color: #339933;\">;<\/span>\nsbit LCD_D7_Direction at TRISB7_bit<span style=\"color: #339933;\">;<\/span>\n&nbsp;\nsbit Data at RA0_bit<span style=\"color: #339933;\">;<\/span>\nsbit DataDir at TRISA0_bit<span style=\"color: #339933;\">;<\/span>\n<span style=\"color: #993333;\">char<\/span> message1<span style=\"color: #009900;\">&#91;<\/span><span style=\"color: #009900;\">&#93;<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #ff0000;\">&quot;Temp = 00.0 C&quot;<\/span><span style=\"color: #339933;\">;<\/span>\n<span style=\"color: #993333;\">char<\/span> message2<span style=\"color: #009900;\">&#91;<\/span><span style=\"color: #009900;\">&#93;<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #ff0000;\">&quot;RH   = 00.0 %&quot;<\/span><span style=\"color: #339933;\">;<\/span>\n<span style=\"color: #993333;\">unsigned<\/span> <span style=\"color: #993333;\">short<\/span> TOUT <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">0<\/span><span style=\"color: #339933;\">,<\/span> CheckSum<span style=\"color: #339933;\">,<\/span> i<span style=\"color: #339933;\">;<\/span>\n<span style=\"color: #993333;\">unsigned<\/span> <span style=\"color: #993333;\">short<\/span> T_Byte1<span style=\"color: #339933;\">,<\/span> T_Byte2<span style=\"color: #339933;\">,<\/span> RH_Byte1<span style=\"color: #339933;\">,<\/span> RH_Byte2<span style=\"color: #339933;\">;<\/span>\n&nbsp;\n<span style=\"color: #993333;\">void<\/span> StartSignal<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #009900;\">&#123;<\/span>\n  DataDir <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">0<\/span><span style=\"color: #339933;\">;<\/span>     <span style=\"color: #666666; font-style: italic;\">\/\/ Data port is output<\/span>\n  Data    <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">0<\/span><span style=\"color: #339933;\">;<\/span>\n  Delay_ms<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #0000dd;\">25<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>    <span style=\"color: #666666; font-style: italic;\">\/\/ Low for at least 18us<\/span>\n  Data    <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">1<\/span><span style=\"color: #339933;\">;<\/span>\n  Delay_us<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #0000dd;\">30<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>    <span style=\"color: #666666; font-style: italic;\">\/\/ High for 20-40 us<\/span>\n  DataDir <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">1<\/span><span style=\"color: #339933;\">;<\/span>     <span style=\"color: #666666; font-style: italic;\">\/\/ Data port is input<\/span>\n&nbsp;\n<span style=\"color: #009900;\">&#125;<\/span>\n&nbsp;\n<span style=\"color: #993333;\">unsigned<\/span> <span style=\"color: #993333;\">short<\/span> CheckResponse<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #009900;\">&#123;<\/span>\n  TOUT <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">0<\/span><span style=\"color: #339933;\">;<\/span>\n  TMR2 <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">0<\/span><span style=\"color: #339933;\">;<\/span>\n  T2CON.<span style=\"color: #202020;\">TMR2ON<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">1<\/span><span style=\"color: #339933;\">;<\/span>      <span style=\"color: #666666; font-style: italic;\">\/\/ Start TMR2 while waiting for sensor response<\/span>\n  <span style=\"color: #b1b100;\">while<\/span><span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #339933;\">!<\/span>Data <span style=\"color: #339933;\">&amp;<\/span>amp<span style=\"color: #339933;\">;&amp;<\/span>amp<span style=\"color: #339933;\">;<\/span> <span style=\"color: #339933;\">!<\/span>TOUT<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span> <span style=\"color: #666666; font-style: italic;\">\/\/ If there's no response within 256us, the Timer2 overflows<\/span>\n  <span style=\"color: #b1b100;\">if<\/span> <span style=\"color: #009900;\">&#40;<\/span>TOUT<span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #b1b100;\">return<\/span> <span style=\"color: #0000dd;\">0<\/span><span style=\"color: #339933;\">;<\/span>    <span style=\"color: #666666; font-style: italic;\">\/\/ and exit<\/span>\n  <span style=\"color: #b1b100;\">else<\/span> <span style=\"color: #009900;\">&#123;<\/span>\n   TMR2 <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">0<\/span><span style=\"color: #339933;\">;<\/span>\n   <span style=\"color: #b1b100;\">while<\/span><span style=\"color: #009900;\">&#40;<\/span>Data <span style=\"color: #339933;\">&amp;<\/span>amp<span style=\"color: #339933;\">;&amp;<\/span>amp<span style=\"color: #339933;\">;<\/span> <span style=\"color: #339933;\">!<\/span>TOUT<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>\n   <span style=\"color: #b1b100;\">if<\/span> <span style=\"color: #009900;\">&#40;<\/span>TOUT<span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #b1b100;\">return<\/span> <span style=\"color: #0000dd;\">0<\/span><span style=\"color: #339933;\">;<\/span>\n   <span style=\"color: #b1b100;\">else<\/span> <span style=\"color: #009900;\">&#123;<\/span>\n    T2CON.<span style=\"color: #202020;\">TMR2ON<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">0<\/span><span style=\"color: #339933;\">;<\/span>\n    <span style=\"color: #b1b100;\">return<\/span> <span style=\"color: #0000dd;\">1<\/span><span style=\"color: #339933;\">;<\/span>\n   <span style=\"color: #009900;\">&#125;<\/span>\n  <span style=\"color: #009900;\">&#125;<\/span>\n<span style=\"color: #009900;\">&#125;<\/span>\n&nbsp;\n<span style=\"color: #993333;\">unsigned<\/span> <span style=\"color: #993333;\">short<\/span> ReadByte<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #009900;\">&#123;<\/span>\n  <span style=\"color: #993333;\">unsigned<\/span> <span style=\"color: #993333;\">short<\/span> num <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">0<\/span><span style=\"color: #339933;\">,<\/span> t<span style=\"color: #339933;\">;<\/span>\n  DataDir <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">1<\/span><span style=\"color: #339933;\">;<\/span>\n  <span style=\"color: #b1b100;\">for<\/span> <span style=\"color: #009900;\">&#40;<\/span>i<span style=\"color: #339933;\">=<\/span><span style=\"color: #0000dd;\">0<\/span><span style=\"color: #339933;\">;<\/span> i<span style=\"color: #339933;\">&amp;<\/span>lt<span style=\"color: #339933;\">;<\/span><span style=\"color: #0000dd;\">8<\/span><span style=\"color: #339933;\">;<\/span> i<span style=\"color: #339933;\">++<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #009900;\">&#123;<\/span>\n   <span style=\"color: #b1b100;\">while<\/span><span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #339933;\">!<\/span>Data<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>\n   TMR2 <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">0<\/span><span style=\"color: #339933;\">;<\/span>\n   T2CON.<span style=\"color: #202020;\">TMR2ON<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">1<\/span><span style=\"color: #339933;\">;<\/span>  <span style=\"color: #666666; font-style: italic;\">\/\/ Start TMR2 from 0 when a low to high data pulse<\/span>\n   <span style=\"color: #b1b100;\">while<\/span><span style=\"color: #009900;\">&#40;<\/span>Data<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>       <span style=\"color: #666666; font-style: italic;\">\/\/ is detected, and wait until it falls low again.<\/span>\n   T2CON.<span style=\"color: #202020;\">TMR2ON<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">0<\/span><span style=\"color: #339933;\">;<\/span>  <span style=\"color: #666666; font-style: italic;\">\/\/ Stop the TMR2 when the data pulse falls low.<\/span>\n   <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #009900;\">&#40;<\/span>TMR2 <span style=\"color: #339933;\">&amp;<\/span>gt<span style=\"color: #339933;\">;<\/span> <span style=\"color: #0000dd;\">40<\/span><span style=\"color: #009900;\">&#41;<\/span> num <span style=\"color: #339933;\">|=<\/span> <span style=\"color: #0000dd;\">1<\/span><span style=\"color: #339933;\">&amp;<\/span>lt<span style=\"color: #339933;\">;&amp;<\/span>lt<span style=\"color: #339933;\">;<\/span><span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #0000dd;\">7<\/span><span style=\"color: #339933;\">-<\/span>i<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>  <span style=\"color: #666666; font-style: italic;\">\/\/ If time &amp;gt; 40us, Data is 1<\/span>\n  <span style=\"color: #009900;\">&#125;<\/span>\n  <span style=\"color: #b1b100;\">return<\/span> num<span style=\"color: #339933;\">;<\/span>\n<span style=\"color: #009900;\">&#125;<\/span>\n&nbsp;\n<span style=\"color: #993333;\">void<\/span> interrupt<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #009900;\">&#123;<\/span>\n  <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #009900;\">&#40;<\/span>PIR1.<span style=\"color: #202020;\">TMR2IF<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #009900;\">&#123;<\/span>\n   TOUT <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">1<\/span><span style=\"color: #339933;\">;<\/span>\n   T2CON.<span style=\"color: #202020;\">TMR2ON<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">0<\/span><span style=\"color: #339933;\">;<\/span> <span style=\"color: #666666; font-style: italic;\">\/\/ stop timer<\/span>\n   PIR1.<span style=\"color: #202020;\">TMR2IF<\/span>  <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">0<\/span><span style=\"color: #339933;\">;<\/span> <span style=\"color: #666666; font-style: italic;\">\/\/ Clear TMR0 interrupt flag<\/span>\n  <span style=\"color: #009900;\">&#125;<\/span>\n<span style=\"color: #009900;\">&#125;<\/span>\n&nbsp;\n<span style=\"color: #993333;\">void<\/span> main<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #009900;\">&#123;<\/span>\n  <span style=\"color: #993333;\">unsigned<\/span> <span style=\"color: #993333;\">short<\/span> check<span style=\"color: #339933;\">;<\/span>\n  TRISB <span style=\"color: #339933;\">=<\/span> <span style=\"color: #208080;\">0b00000000<\/span><span style=\"color: #339933;\">;<\/span>\n  PORTB <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">0<\/span><span style=\"color: #339933;\">;<\/span>\n  TRISA <span style=\"color: #339933;\">=<\/span> <span style=\"color: #208080;\">0b00100001<\/span><span style=\"color: #339933;\">;<\/span>\n  CMCON <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">7<\/span><span style=\"color: #339933;\">;<\/span>\n  INTCON.<span style=\"color: #202020;\">GIE<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">1<\/span><span style=\"color: #339933;\">;<\/span>    <span style=\"color: #666666; font-style: italic;\">\/\/Enable global interrupt<\/span>\n  INTCON.<span style=\"color: #202020;\">PEIE<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">1<\/span><span style=\"color: #339933;\">;<\/span>   <span style=\"color: #666666; font-style: italic;\">\/\/Enable peripheral interrupt<\/span>\n  <span style=\"color: #666666; font-style: italic;\">\/\/ Configure Timer2 module<\/span>\n  PIE1.<span style=\"color: #202020;\">TMR2IE<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">1<\/span><span style=\"color: #339933;\">;<\/span>  <span style=\"color: #666666; font-style: italic;\">\/\/ Enable Timer2 interrupt<\/span>\n  T2CON <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">0<\/span><span style=\"color: #339933;\">;<\/span>        <span style=\"color: #666666; font-style: italic;\">\/\/ Prescaler 1:1, and Timer2 is off initially<\/span>\n  PIR1.<span style=\"color: #202020;\">TMR2IF<\/span> <span style=\"color: #339933;\">=<\/span><span style=\"color: #0000dd;\">0<\/span><span style=\"color: #339933;\">;<\/span>   <span style=\"color: #666666; font-style: italic;\">\/\/ Clear TMR INT Flag bit<\/span>\n  TMR2 <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">0<\/span><span style=\"color: #339933;\">;<\/span>\n  Lcd_Init<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>\n  Lcd_Cmd<span style=\"color: #009900;\">&#40;<\/span>_Lcd_Clear<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>\n  Lcd_Cmd<span style=\"color: #009900;\">&#40;<\/span>_LCD_CURSOR_OFF<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>\n&nbsp;\n  <span style=\"color: #b1b100;\">do<\/span> <span style=\"color: #009900;\">&#123;<\/span>\n    Delay_ms<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #0000dd;\">1000<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>\n    StartSignal<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>\n    check <span style=\"color: #339933;\">=<\/span> CheckResponse<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>\n    <span style=\"color: #b1b100;\">if<\/span> <span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #339933;\">!<\/span>check<span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #009900;\">&#123;<\/span>\n     Lcd_Cmd<span style=\"color: #009900;\">&#40;<\/span>_Lcd_Clear<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>\n     Lcd_Out<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #0000dd;\">1<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #0000dd;\">1<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #ff0000;\">&quot;No response&quot;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>\n     Lcd_Out<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #0000dd;\">2<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #0000dd;\">1<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #ff0000;\">&quot;from the sensor&quot;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>\n    <span style=\"color: #009900;\">&#125;<\/span>\n    <span style=\"color: #b1b100;\">else<\/span><span style=\"color: #009900;\">&#123;<\/span>\n&nbsp;\n     RH_Byte1 <span style=\"color: #339933;\">=<\/span> ReadByte<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>\n     RH_Byte2 <span style=\"color: #339933;\">=<\/span> ReadByte<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>\n     T_Byte1 <span style=\"color: #339933;\">=<\/span> ReadByte<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>\n     T_Byte2 <span style=\"color: #339933;\">=<\/span> ReadByte<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>\n     CheckSum <span style=\"color: #339933;\">=<\/span> ReadByte<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>\n     <span style=\"color: #666666; font-style: italic;\">\/\/ Check for error in Data reception<\/span>\n     <span style=\"color: #b1b100;\">if<\/span> <span style=\"color: #009900;\">&#40;<\/span>CheckSum <span style=\"color: #339933;\">==<\/span> <span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #009900;\">&#40;<\/span>RH_Byte1 <span style=\"color: #339933;\">+<\/span> RH_Byte2 <span style=\"color: #339933;\">+<\/span> T_Byte1 <span style=\"color: #339933;\">+<\/span> T_Byte2<span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #339933;\">&amp;<\/span>amp<span style=\"color: #339933;\">;<\/span> <span style=\"color: #208080;\">0xFF<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #009900;\">&#41;<\/span>\n     <span style=\"color: #009900;\">&#123;<\/span>\n      message1<span style=\"color: #009900;\">&#91;<\/span><span style=\"color: #0000dd;\">7<\/span><span style=\"color: #009900;\">&#93;<\/span>  <span style=\"color: #339933;\">=<\/span> T_Byte1<span style=\"color: #339933;\">\/<\/span><span style=\"color: #0000dd;\">10<\/span> <span style=\"color: #339933;\">+<\/span> <span style=\"color: #0000dd;\">48<\/span><span style=\"color: #339933;\">;<\/span>\n      message1<span style=\"color: #009900;\">&#91;<\/span><span style=\"color: #0000dd;\">8<\/span><span style=\"color: #009900;\">&#93;<\/span>  <span style=\"color: #339933;\">=<\/span> T_Byte1<span style=\"color: #339933;\">%<\/span><span style=\"color:#800080;\">10<\/span> <span style=\"color: #339933;\">+<\/span> <span style=\"color: #0000dd;\">48<\/span><span style=\"color: #339933;\">;<\/span>\n      message1<span style=\"color: #009900;\">&#91;<\/span><span style=\"color: #0000dd;\">10<\/span><span style=\"color: #009900;\">&#93;<\/span> <span style=\"color: #339933;\">=<\/span> T_Byte2<span style=\"color: #339933;\">\/<\/span><span style=\"color: #0000dd;\">10<\/span> <span style=\"color: #339933;\">+<\/span> <span style=\"color: #0000dd;\">48<\/span><span style=\"color: #339933;\">;<\/span>\n      message2<span style=\"color: #009900;\">&#91;<\/span><span style=\"color: #0000dd;\">7<\/span><span style=\"color: #009900;\">&#93;<\/span>  <span style=\"color: #339933;\">=<\/span> RH_Byte1<span style=\"color: #339933;\">\/<\/span><span style=\"color: #0000dd;\">10<\/span> <span style=\"color: #339933;\">+<\/span> <span style=\"color: #0000dd;\">48<\/span><span style=\"color: #339933;\">;<\/span>\n      message2<span style=\"color: #009900;\">&#91;<\/span><span style=\"color: #0000dd;\">8<\/span><span style=\"color: #009900;\">&#93;<\/span>  <span style=\"color: #339933;\">=<\/span> RH_Byte1<span style=\"color: #339933;\">%<\/span><span style=\"color:#800080;\">10<\/span> <span style=\"color: #339933;\">+<\/span> <span style=\"color: #0000dd;\">48<\/span><span style=\"color: #339933;\">;<\/span>\n      message2<span style=\"color: #009900;\">&#91;<\/span><span style=\"color: #0000dd;\">10<\/span><span style=\"color: #009900;\">&#93;<\/span> <span style=\"color: #339933;\">=<\/span> RH_Byte2<span style=\"color: #339933;\">\/<\/span><span style=\"color: #0000dd;\">10<\/span> <span style=\"color: #339933;\">+<\/span> <span style=\"color: #0000dd;\">48<\/span><span style=\"color: #339933;\">;<\/span>\n      message1<span style=\"color: #009900;\">&#91;<\/span><span style=\"color: #0000dd;\">11<\/span><span style=\"color: #009900;\">&#93;<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000dd;\">223<\/span><span style=\"color: #339933;\">;<\/span>     <span style=\"color: #666666; font-style: italic;\">\/\/ Degree symbol<\/span>\n      Lcd_Cmd<span style=\"color: #009900;\">&#40;<\/span>_Lcd_Clear<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>\n      Lcd_Out<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #0000dd;\">1<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #0000dd;\">1<\/span><span style=\"color: #339933;\">,<\/span> message1<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>\n      Lcd_Out<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #0000dd;\">2<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #0000dd;\">1<\/span><span style=\"color: #339933;\">,<\/span> message2<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>\n      <span style=\"color: #009900;\">&#125;<\/span>\n&nbsp;\n      <span style=\"color: #b1b100;\">else<\/span><span style=\"color: #009900;\">&#123;<\/span>\n       Lcd_Cmd<span style=\"color: #009900;\">&#40;<\/span>_Lcd_Clear<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>\n       Lcd_Out<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #0000dd;\">1<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #0000dd;\">1<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #ff0000;\">&quot;Checksum Error!&quot;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>\n       Lcd_Out<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #0000dd;\">2<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #0000dd;\">1<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #ff0000;\">&quot;Trying Again ...&quot;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>\n      <span style=\"color: #009900;\">&#125;<\/span>\n    <span style=\"color: #009900;\">&#125;<\/span>\n&nbsp;\n  <span style=\"color: #009900;\">&#125;<\/span><span style=\"color: #b1b100;\">while<\/span><span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #0000dd;\">1<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span>\n<span style=\"color: #009900;\">&#125;<\/span><\/pre><\/td><\/tr><\/table><\/div>\n\n<p>You can also simplify the <em>ReadByte<\/em> subroutine without using the Timer2 module. The following version of <em>ReadByte<\/em> subroutine works equally well. Once the data pin is detected high, wait for 40 ?s and check the data line again. If it is still high, it is 1, else 0.<\/p>\n<pre>unsigned short ReadByte(){\r\n  unsigned short num = 0, t;\r\n  DataDir = 1;\r\n  for (i=0; i&lt;8; i++){\r\n   while(!Data);\r\n   Delay_us(40);\r\n   if(Data) num |= 1&lt;&lt;(7-i);\r\n   while(Data);\r\n   }\r\n  return num;\r\n}<\/pre>\n<p><a href=\"http:\/\/embedded-lab.com\/uploads\/HexFiles\/PIC16F628A\/DHT11.zip\" target=\"_blank\"><strong>Download complete source code and HEX files<\/strong><\/a><\/p>\n<p><strong>Output<\/strong><\/p>\n<p>The accuracy of DHT11 is not as good as Sensirion&#8217;s SHT1X\/7X series sensors, but it provides an easy and cheap solution to hobbyists for measuring relative humidity and temperature in parallel using a single device, which is sometime required in certain applications such as calculating the <strong><a href=\"http:\/\/en.wikipedia.org\/wiki\/Dew_point\" target=\"_blank\">dew point<\/a><\/strong>.<\/p>\n<div id=\"attachment_4353\" style=\"width: 570px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/DHT11Output2.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4353\" class=\"size-full wp-image-4353\" title=\"DHT11Output2\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/DHT11Output2.jpg\" alt=\"\" width=\"560\" height=\"383\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/DHT11Output2.jpg 560w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2012\/01\/DHT11Output2-550x376.jpg 550w\" sizes=\"auto, (max-width: 560px) 100vw, 560px\" \/><\/a><p id=\"caption-attachment-4353\" class=\"wp-caption-text\">Temperature and relative humidity measured by DHT11 sensor<\/p><\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Measurement and control of temperature and relative humidity finds applications in numerous areas. These days devices are available which have both temperature and humidity sensors with signal conditioning, ADC, calibration and communication interface all built inside them. The use of such smart sensors greatly simplify the design and reduces the overall cost. We discussed in past about\u00a0Humidity and temperature measurements with Sensirion\u2019s SHT1x\/SHT7x sensors. These sensors are capable of measuring both temperature and relative humidity and provide fully calibrated digital outputs. While \u00a0SHT1x\/SHT7x are very accurate sensors, they are still expensive for hobbyists use. This articles discusses the DHT11 sensor<\/p>\n","protected":false},"author":1,"featured_media":4343,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[245,4,183],"tags":[392,272,9,96],"class_list":["post-4333","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-embedded-lab-projects","category-pic-projects","category-tips-and-tricks","tag-dht11","tag-humidity-sensor","tag-mikroc","tag-pic16f628a"],"_links":{"self":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts\/4333","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/comments?post=4333"}],"version-history":[{"count":29,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts\/4333\/revisions"}],"predecessor-version":[{"id":4380,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts\/4333\/revisions\/4380"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/media\/4343"}],"wp:attachment":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/media?parent=4333"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/categories?post=4333"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/tags?post=4333"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}