Difference between revisions of "Component: Temp / Humidity (Grove 101020019) (101020019) (Environmental)"

From Flowcode Help
Jump to navigationJump to search
 
(10 intermediate revisions by the same user not shown)
Line 15: Line 15:
 
The DHT22 temperature and humidity sensor is a popular sensor allowing the ambient  temperature and relative humidity to be monitored digitally. Humidity Range = 0% - 100% +/- 2% Temperature Range = -40 - 80 Degrees C +/- 0.5 Degrees C
 
The DHT22 temperature and humidity sensor is a popular sensor allowing the ambient  temperature and relative humidity to be monitored digitally. Humidity Range = 0% - 100% +/- 2% Temperature Range = -40 - 80 Degrees C +/- 0.5 Degrees C
  
==Component Pack==
+
==Component Source Code==
  
SENSORS
+
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_Grove_DHT22.fcfx FC_Comp_Source_Grove_DHT22.fcfx]
 +
 
 +
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_Grove_DHT22.fcfx FC_Comp_Source_Grove_DHT22.fcfx]
  
 
==Detailed description==
 
==Detailed description==
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
  
  
Line 32: Line 48:
  
 
==Examples==
 
==Examples==
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
  
  
Line 45: Line 75:
  
  
==Downloadable macro reference==
 
  
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
==Macro reference==
 +
 +
===GetHumidityFloat===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetTempWhole'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetHumidityFloat'''
 
|-
 
|-
| 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 humidity returned by calling SampleSensor as a floating point number. If humidity is 15.8 % then this function would return 15.8. 
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-f32-icon.png]] - FLOAT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
  
  
 +
===GetHumidityReal===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetHumidityFloat'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetHumidityReal'''
 
|-
 
|-
| colspan="2" | Gets the humidity returned by calling SampleSensor as a floating point number. If humidity is 15.8 % then this function would return 15.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. 
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-f32-icon.png]] - FLOAT
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
  
  
 +
===GetHumidityString===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetTempString'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetHumidityString'''
 
|-
 
|-
| colspan="2" | Gets the temperature returned by calling SampleSensor as a string. If temperature is 15.8 degrees C then this function would return "15.8". 
+
| colspan="2" | Gets the humidity returned by calling SampleSensor as a string. If humidity is 15.8 % then this function would return "15.8". 
 
|-
 
|-
 
|-
 
|-
Line 86: Line 129:
  
  
 +
===GetHumidityWhole===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetHumidityString'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetHumidityWhole'''
 
|-
 
|-
| colspan="2" | Gets the humidity returned by calling SampleSensor as a string. If humidity is 15.8 % then this function would return "15.8". 
+
| 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. 
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
  
  
 +
===GetTempFloat===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetHumidityWhole'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetTempFloat'''
 
|-
 
|-
| 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 temperature returned by calling SampleSensor as a floating point number. If temperature is 15.8 degrees C then this function would return 15.8. 
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-f32-icon.png]] - FLOAT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
  
  
 +
===GetTempReal===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 125: Line 171:
  
  
 +
===GetTempString===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetHumidityReal'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetTempString'''
 
|-
 
|-
| 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 temperature returned by calling SampleSensor as a string. If temperature is 15.8 degrees C then this function would return "15.8". 
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
  
  
 +
===GetTempWhole===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SampleSensor'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetTempWhole'''
 
|-
 
|-
| 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" | 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. 
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
  
  
 +
===SampleSensor===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetTempFloat'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SampleSensor'''
 
|-
 
|-
| colspan="2" | Gets the temperature returned by calling SampleSensor as a floating point number. If temperature is 15.8 degrees C then this function would return 15.8. 
+
| 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. 
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-f32-icon.png]] - FLOAT
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
 
 
  
  
Line 183: Line 230:
 
|-
 
|-
 
| colspan="2" | The checksum value is used to ensure the data being received is correct. Yes = Only receive data if checksum is correct No = Ignore checksum 
 
| colspan="2" | The checksum value is used to ensure the data being received is correct. Yes = Only receive data if checksum is correct No = Ignore checksum 
 +
|-
 +
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 +
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Advanced Settings
 +
|-
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
Line 188: Line 239:
 
|-
 
|-
 
| colspan="2" | 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. 
 
| colspan="2" | 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. 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Connections'''
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Simulations'''
 
|-
 
 
|}
 
|}

Latest revision as of 13:10, 7 February 2023

Author Matrix TSL
Version 1.2
Category Environmental


Temp / Humidity (Grove 101020019) component

The DHT22 temperature and humidity sensor is a popular sensor allowing the ambient temperature and relative humidity to be monitored digitally. Humidity Range = 0% - 100% +/- 2% Temperature Range = -40 - 80 Degrees C +/- 0.5 Degrees C

Component Source Code

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

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

Detailed description

No detailed description exists yet for this component

Examples

No additional examples







Macro reference

GetHumidityFloat

Fc9-comp-macro.png GetHumidityFloat
Gets the humidity returned by calling SampleSensor as a floating point number. If humidity is 15.8 % then this function would return 15.8. 
Fc9-f32-icon.png - FLOAT Return


GetHumidityReal

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


GetHumidityString

Fc9-comp-macro.png GetHumidityString
Gets the humidity returned by calling SampleSensor as a string. If humidity is 15.8 % then this function would return "15.8". 
Fc9-string-icon.png - STRING Return


GetHumidityWhole

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


GetTempFloat

Fc9-comp-macro.png GetTempFloat
Gets the temperature returned by calling SampleSensor as a floating point number. If temperature is 15.8 degrees C then this function would return 15.8. 
Fc9-f32-icon.png - FLOAT Return


GetTempReal

Fc9-comp-macro.png 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. 
Fc9-s16-icon.png - INT Return


GetTempString

Fc9-comp-macro.png GetTempString
Gets the temperature returned by calling SampleSensor as a string. If temperature is 15.8 degrees C then this function would return "15.8". 
Fc9-string-icon.png - STRING Return


GetTempWhole

Fc9-comp-macro.png 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. 
Fc9-s16-icon.png - INT Return


SampleSensor

Fc9-comp-macro.png 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. 
Fc9-u8-icon.png - BYTE Return


Property reference

Fc9-prop-icon.png Properties
Fc9-type-5-icon.png SIG Pin
Microcontroller I/O Pin connected to the DHT11 sensor data pin. 
Fc9-type-7-icon.png 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 
Fc9-conn-icon.png Advanced Settings
Fc9-type-16-icon.png 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.