Jump to content

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

From Flowcode Help
No edit summary
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder""
 
(5 intermediate revisions by the same user not shown)
Line 88: Line 88:


===ControlHeater===
===ControlHeater===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[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;" | '''ControlHeater'''
| width="90%" class="mtx-class-macrohead" | '''ControlHeater'''
|-
|-
| colspan="2" | Controls the in-built heater element to speed up sensor recovery time in case of condensation. Humidity and temperature cannot be read while Heater is active. 
| colspan="2" | Controls the in-built heater element to speed up sensor recovery time in case of condensation. Humidity and temperature cannot be read while Heater is active. 
Line 107: Line 107:


===DataAvailable===
===DataAvailable===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[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;" | '''DataAvailable'''
| width="90%" class="mtx-class-macrohead" | '''DataAvailable'''
|-
|-
| colspan="2" | Checks to see if new sensor data is available. Returns 0 if no new data is available. Returns 1 if new Temperature data is available. Returns 2 if new Humidity data is available. Returns 3 if new Temp and Humidity data is available. 
| colspan="2" | Checks to see if new sensor data is available. Returns 0 if no new data is available. Returns 1 if new Temperature data is available. Returns 2 if new Humidity data is available. Returns 3 if new Temp and Humidity data is available. 
Line 121: Line 121:


===Initialise===
===Initialise===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[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;" | '''Initialise'''
| width="90%" class="mtx-class-macrohead" | '''Initialise'''
|-
|-
| colspan="2" | Configures the I2C peripheral ready for communications. 
| colspan="2" | Configures the I2C peripheral ready for communications. 
Line 135: Line 135:


===ReadHumidityInt===
===ReadHumidityInt===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[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;" | '''ReadHumidityInt'''
| width="90%" class="mtx-class-macrohead" | '''ReadHumidityInt'''
|-
|-
| colspan="2" | Samples the humidity from the sensor and returns the relative humidity reading as a integer byte from 0 to 100 
| colspan="2" | Samples the humidity from the sensor and returns the relative humidity reading as a integer byte from 0 to 100 
Line 149: Line 149:


===ReadHumidityReal===
===ReadHumidityReal===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[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;" | '''ReadHumidityReal'''
| width="90%" class="mtx-class-macrohead" | '''ReadHumidityReal'''
|-
|-
| colspan="2" | Samples the humidity from the sensor and returns the relative humidity reading as a float from 0.0 to 100.0. 
| colspan="2" | Samples the humidity from the sensor and returns the relative humidity reading as a float from 0.0 to 100.0. 
Line 163: Line 163:


===ReadRegister===
===ReadRegister===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[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;" | '''ReadRegister'''
| width="90%" class="mtx-class-macrohead" | '''ReadRegister'''
|-
|-
| colspan="2" | Reads an 8-bit value from one of the registers onboard the sensor IC. 
| colspan="2" | Reads an 8-bit value from one of the registers onboard the sensor IC. 
Line 182: Line 182:


===ReadTemperatureInt===
===ReadTemperatureInt===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[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;" | '''ReadTemperatureInt'''
| width="90%" class="mtx-class-macrohead" | '''ReadTemperatureInt'''
|-
|-
| colspan="2" | Samples the temperature from the sensor and returns the reading in degrees C as an integer from -40 to 120. 
| colspan="2" | Samples the temperature from the sensor and returns the reading in degrees C as an integer from -40 to 120. 
Line 196: Line 196:


===ReadTemperatureReal===
===ReadTemperatureReal===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[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;" | '''ReadTemperatureReal'''
| width="90%" class="mtx-class-macrohead" | '''ReadTemperatureReal'''
|-
|-
| colspan="2" | Samples the temperature from the sensor and returns the reading in degrees C as a float from -40.0 to 120.0. 
| colspan="2" | Samples the temperature from the sensor and returns the reading in degrees C as a float from -40.0 to 120.0. 
Line 210: Line 210:


===WriteRegister===
===WriteRegister===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[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;" | '''WriteRegister'''
| width="90%" class="mtx-class-macrohead" | '''WriteRegister'''
|-
|-
| colspan="2" | Writes a value to a register on the sensor IC. 
| colspan="2" | Writes a value to a register on the sensor IC. 
Line 235: Line 235:
==Property reference==
==Property reference==


{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[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'''  
|-
|-
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Sensor Properties
| width="90%" class="mtx-class-propfolder" | Sensor Properties
|-
|-
|-
|-
Line 250: Line 250:
| colspan="2" |  
| colspan="2" |  
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | I2C Properties
| width="90%" class="mtx-class-propfolder" | I2C Properties
|-
|-
|-
|-
Line 289: Line 289:
| colspan="2" | Baud rate to be used 
| colspan="2" | Baud rate to be used 
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
| width="90%" class="mtx-class-propfolder" | Simulation
|-
|-
|-
|-

Latest revision as of 14:37, 13 July 2026

Author Matrix TSL
Version 1.0
Category Environmental


Temp / Humidity (HTS221) component

A temperature and relative humidity sensor allowing the ambient temperature and relative humidity to be monitored digitally. Humidity Range = 0% - 100% +/- 3.5% Temperature Range = -40 - 120 Degrees C +/- 0.5 Degrees C

Component Source Code

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

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

Detailed description

No detailed description exists yet for this component

Examples

No additional examples







Macro reference

ControlHeater

ControlHeater
Controls the in-built heater element to speed up sensor recovery time in case of condensation. Humidity and temperature cannot be read while Heater is active. 
- BOOL Active
0 = Off (Sensor Reading Available) / 1 = On (Sensor Reading Disabled) 
- VOID Return


DataAvailable

DataAvailable
Checks to see if new sensor data is available. Returns 0 if no new data is available. Returns 1 if new Temperature data is available. Returns 2 if new Humidity data is available. Returns 3 if new Temp and Humidity data is available. 
- BYTE Return


Initialise

Initialise
Configures the I2C peripheral ready for communications. 
- BYTE Return


ReadHumidityInt

ReadHumidityInt
Samples the humidity from the sensor and returns the relative humidity reading as a integer byte from 0 to 100 
- BYTE Return


ReadHumidityReal

ReadHumidityReal
Samples the humidity from the sensor and returns the relative humidity reading as a float from 0.0 to 100.0. 
- FLOAT Return


ReadRegister

ReadRegister
Reads an 8-bit value from one of the registers onboard the sensor IC. 
- BYTE Address
 
- BYTE Return


ReadTemperatureInt

ReadTemperatureInt
Samples the temperature from the sensor and returns the reading in degrees C as an integer from -40 to 120. 
- INT Return


ReadTemperatureReal

ReadTemperatureReal
Samples the temperature from the sensor and returns the reading in degrees C as a float from -40.0 to 120.0. 
- FLOAT Return


WriteRegister

WriteRegister
Writes a value to a register on the sensor IC. 
- BYTE Address
 
- BYTE Data
 
- VOID Return


Property reference

Properties
Sensor Properties
Data Rate
 
I2C Properties
Address
 
Channel
Channel selection 
SDA
Pin used for SDA (data signal) 
SCL
Pin used for SCL (clock signal) 
Stop Delay
On older microcontroller devices there is a potential for the I2C hardware channel to lock up if there is not a 10ms delay between an I2C stop event and the next I2C start event. Most modern microcontrollers will not have a problem so this property can be disabled to speed up the I2C communications.  
Baud Select
Baud rate option selector 
Baud Rate
Baud rate to be used 
Simulation
Sim Type