Jump to content

Component: Temp / Humidity (DHT11) (Environmental): Difference between revisions

From Flowcode Help
m Text replacement - "width="10%" align="center" style="background-color:#D8C9D8;"" to "width="10%" align="center" class="mtx-class-macrohead""
m Text replacement - "width="90%" style="background-color:#D8C9D8; color:#4B008D;"" to "width="90%" class="mtx-class-macrohead""
Line 91: Line 91:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetHumidityFloat'''
| width="90%" class="mtx-class-macrohead" | '''GetHumidityFloat'''
|-
|-
| colspan="2" | Gets the humidity returned by calling SampleSensor as a floating point number.  
| colspan="2" | Gets the humidity returned by calling SampleSensor as a floating point number.  
Line 105: Line 105:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetHumidityReal'''
| width="90%" class="mtx-class-macrohead" | '''GetHumidityReal'''
|-
|-
| colspan="2" | Gets the real number portion of the humidity returned by calling SampleSensor. If humidity is 15.8 % then this function would return 8. 
| colspan="2" | Gets the real number portion of the humidity returned by calling SampleSensor. If humidity is 15.8 % then this function would return 8. 
Line 119: Line 119:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetHumidityString'''
| width="90%" class="mtx-class-macrohead" | '''GetHumidityString'''
|-
|-
| colspan="2" | Gets the humidity returned by calling SampleSensor as a string.  
| colspan="2" | Gets the humidity returned by calling SampleSensor as a string.  
Line 133: Line 133:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetHumidityWhole'''
| width="90%" class="mtx-class-macrohead" | '''GetHumidityWhole'''
|-
|-
| colspan="2" | Gets the whole number portion of the humidity returned by calling SampleSensor. If humidity is 15.8 % then this function would return 15. 
| colspan="2" | Gets the whole number portion of the humidity returned by calling SampleSensor. If humidity is 15.8 % then this function would return 15. 
Line 147: Line 147:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetTempFloat'''
| width="90%" class="mtx-class-macrohead" | '''GetTempFloat'''
|-
|-
| colspan="2" | Gets the temperature returned by calling SampleSensor as a floating point number.  
| colspan="2" | Gets the temperature returned by calling SampleSensor as a floating point number.  
Line 161: Line 161:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetTempReal'''
| width="90%" class="mtx-class-macrohead" | '''GetTempReal'''
|-
|-
| colspan="2" | Gets the real number portion of the temperature returned by calling SampleSensor. If temperature is 15.8 degrees C then this function would return 8. 
| colspan="2" | Gets the real number portion of the temperature returned by calling SampleSensor. If temperature is 15.8 degrees C then this function would return 8. 
Line 175: Line 175:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetTempString'''
| width="90%" class="mtx-class-macrohead" | '''GetTempString'''
|-
|-
| colspan="2" | Gets the temperature returned by calling SampleSensor as a string.  
| colspan="2" | Gets the temperature returned by calling SampleSensor as a string.  
Line 189: Line 189:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetTempWhole'''
| width="90%" class="mtx-class-macrohead" | '''GetTempWhole'''
|-
|-
| colspan="2" | Gets the whole number portion of the temperature returned by calling SampleSensor. If temperature is 15.8 degrees C then this function would return 15. 
| colspan="2" | Gets the whole number portion of the temperature returned by calling SampleSensor. If temperature is 15.8 degrees C then this function would return 15. 
Line 203: Line 203:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SampleSensor'''
| width="90%" class="mtx-class-macrohead" | '''SampleSensor'''
|-
|-
| colspan="2" | Communicates with the DHT11 sensor and receives the temperature and humidity readings. Returns 0 for success, 1 for no communication detected and 2 for checksum error. 
| colspan="2" | Communicates with the DHT11 sensor and receives the temperature and humidity readings. Returns 0 for success, 1 for no communication detected and 2 for checksum error. 
Line 218: Line 218:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
| width="90%" class="mtx-class-macrohead" | '''Properties'''  
|-
|-
|-
|-

Revision as of 14:23, 13 July 2026

Author Matrix TSL
Version 1.1
Category Environmental


Temp / Humidity (DHT11) component

The DHT11 temperature and humidity sensor is a popular sensor allowing the ambient temperature and relative humidity to be monitored digitally. Humidity Range = 20% - 90% +/- 5% Temperature Range = 0 - 50 Degrees C +/- 2 Degrees C

Component Source Code

Please click here to download the component source project: FC_Comp_Source_DHT11.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_DHT11.fcfx

Detailed description

No detailed description exists yet for this component

Examples

Example Program showing how to sample the DHT11 sensor and show the temperature and humidity on an LCD. DHT11 Example






Macro reference

GetHumidityFloat

GetHumidityFloat
Gets the humidity returned by calling SampleSensor as a floating point number.  
- FLOAT Return


GetHumidityReal

GetHumidityReal
Gets the real number portion of the humidity returned by calling SampleSensor. If humidity is 15.8 % then this function would return 8. 
- INT Return


GetHumidityString

GetHumidityString
Gets the humidity returned by calling SampleSensor as a string.  
- STRING Return


GetHumidityWhole

GetHumidityWhole
Gets the whole number portion of the humidity returned by calling SampleSensor. If humidity is 15.8 % then this function would return 15. 
- INT Return


GetTempFloat

GetTempFloat
Gets the temperature returned by calling SampleSensor as a floating point number.  
- FLOAT Return


GetTempReal

GetTempReal
Gets the real number portion of the temperature returned by calling SampleSensor. If temperature is 15.8 degrees C then this function would return 8. 
- INT Return


GetTempString

GetTempString
Gets the temperature returned by calling SampleSensor as a string.  
- STRING Return


GetTempWhole

GetTempWhole
Gets the whole number portion of the temperature returned by calling SampleSensor. If temperature is 15.8 degrees C then this function would return 15. 
- INT Return


SampleSensor

SampleSensor
Communicates with the DHT11 sensor and receives the temperature and humidity readings. Returns 0 for success, 1 for no communication detected and 2 for checksum error. 
- BYTE Return


Property reference

Properties
Data Pin
Microcontroller I/O Pin connected to the DHT11 sensor data pin. 
Use Checksum
The checksum value is used to ensure the data being received is correct. Yes = Only receive data if checksum is correct No = Ignore checksum 
Advanced Settings
Clock Adjustment
On 8-bit PIC devices the timings can be a little tight as slower clock speeds and so we implement an adjustment factor to allow the sensor to function. Auto mode will attempt to automatically calculate a correct adjustment factor. Manual mode will allow you to set your own adjustment factor.