Difference between revisions of "Component: Thermistor (Environmental)"

From Flowcode Help
Jump to navigationJump to search
 
(10 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
|-
 
|-
 
| width="20%" style="color:gray;" | Version
 
| width="20%" style="color:gray;" | Version
| 1.1
+
| 2.0
 
|-
 
|-
 
| width="20%" style="color:gray;" | Category
 
| width="20%" style="color:gray;" | Category
Line 15: Line 15:
 
A generic thermistor component that can be used to simulate and create code for any thermistor with a known temperature/resistance curve.  Thermistor is connected in a simple potential divider circuit - thermistor between ADC input and 0V, and a fixed resistor between ADC and the positive supply.  Default calibration is for the EBM003 module.
 
A generic thermistor component that can be used to simulate and create code for any thermistor with a known temperature/resistance curve.  Thermistor is connected in a simple potential divider circuit - thermistor between ADC input and 0V, and a fixed resistor between ADC and the positive supply.  Default calibration is for the EBM003 module.
  
==Component Source Code==
+
==Version information==
  
Please click here for the component source code: [https://www.flowcode.co.uk/wikicopy/componentsource/FC_Comp_Source_Thermistor.fcfx FC_Comp_Source_Thermistor.fcfx]
+
Library Version, Component Version, Date, Author, Info
 +
9, 2.0, 19-07-24, BR, Added compatibility for external ADC
 +
9, 2.0, 19-07-24, BR, Allowed full bit depth usage of the internal ADC
  
 
==Detailed description==
 
==Detailed description==
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
  
  
Line 34: Line 48:
  
 
==Examples==
 
==Examples==
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
  
  
Line 49: Line 75:
  
  
==Downloadable macro reference==
 
  
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
==Macro reference==
 +
 +
===CalculateTemperature===
 
{| 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;" | '''GetIntegerTemperature'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CalculateTemperature'''
 +
|-
 +
| colspan="2" | Converts the input ADC value and returns the Temperature in tenths of degree C 
 
|-
 
|-
| colspan="2" | Reads the ADC input and returns the calculated Temperature as Integer degrees C 
 
 
|-
 
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" | ADCValue
 +
|-
 +
| colspan="2" | ADC Reading to be converted 
 
|-
 
|-
 
| 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-s16-icon.png]] - INT
Line 64: Line 106:
  
  
 +
===GetADCValue===
 
{| 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;" | '''SetChannel'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetADCValue'''
 
|-
 
|-
| colspan="2" | Set the ADC Channel 
+
| colspan="2" | Returns the Raw ADC value from the Analogue Channel 
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" | [[File:Fc9-s16-icon.png]] - INT
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | ChannelID
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
  
  
 +
===GetIntegerTemperature===
 
{| 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;" | '''SetMinMax'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetIntegerTemperature'''
 
|-
 
|-
| colspan="2" | Set the minimum and maximum temperature values that can be shown and set on the thermometer readout. 
+
| colspan="2" | Reads the ADC input and returns the calculated Temperature as Integer degrees C 
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
| width="90%" | Min
 
|-
 
| colspan="2" | Minimum Value 
 
|-
 
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
 
| width="90%" | Max
 
|-
 
| colspan="2" | Maximum Value 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
  
  
 +
===GetRealTemperature===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 118: Line 148:
  
  
 +
===SetADCValue===
 
{| 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;" | '''SetTemperature'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetADCValue'''
 
|-
 
|-
| colspan="2" | Sends the given temperature to the display, and calculates the internal values used by the simulated read macros. 
+
| colspan="2" | Used to set the ADC value when an external ADC is being used. 
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
+
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Temperature
+
| width="90%" | AdcValue
 
|-
 
|-
| colspan="2" | Zero to one value - representing min-max of the sensor. 
+
| colspan="2" | Value of the external ADC. e.g. 0-255 for an 8-bit ADC 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 136: Line 167:
  
  
 +
===SetChannel===
 
{| 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;" | '''CalculateTemperature'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetChannel'''
 
|-
 
|-
| colspan="2" | Converts the input ADC value and returns the Temperature in tenths of degree C 
+
| colspan="2" | Set the ADC Channel 
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
+
| width="10%" align="center" | [[File:Fc9-s16-icon.png]] - INT
| width="90%" | ADCValue
+
| width="90%" | ChannelID
 
|-
 
|-
| colspan="2" | ADC Reading to be converted 
+
| colspan="2" |  
 
|-
 
|-
| 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-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
  
  
 +
===SetMinMax===
 
{| 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;" | '''GetADCValue'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetMinMax'''
 +
|-
 +
| colspan="2" | Set the minimum and maximum temperature values that can be shown and set on the thermometer readout. 
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
 +
| width="90%" | Min
 +
|-
 +
| colspan="2" | Minimum Value 
 
|-
 
|-
| colspan="2" | Returns the Raw ADC value from the Analogue Channel 
+
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
 +
| width="90%" | Max
 
|-
 
|-
 +
| colspan="2" | Maximum Value 
 
|-
 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
  
  
 +
===SetTemperature===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetTemperature'''
 +
|-
 +
| colspan="2" | Sends the given temperature to the display, and calculates the internal values used by the simulated read macros. 
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
 +
| width="90%" | Temperature
 +
|-
 +
| colspan="2" | Zero to one value - representing min-max of the sensor. 
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
Line 180: Line 240:
 
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | ADC Properties
 
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | ADC Properties
 
|-
 
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 +
| width="90%" | ADC Configuration
 +
|-
 +
| colspan="2" |  
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-6-icon.png]]
 
| width="10%" align="center" | [[File:Fc9-type-6-icon.png]]
 
| width="90%" | ADC Channel
 
| width="90%" | ADC Channel
 
|-
 
|-
| colspan="2" | The ADC channel to which the thermistor circuit is connected. It is assumed that the thermistor is connected between the ADC pin and 0V, with a fixed resistor connected between the ADC pin and +V. 
+
| colspan="2" | Analogue Input Channel - Which pin is the analogue input connected to? 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
Line 190: Line 255:
 
|-
 
|-
 
| colspan="2" | Defines what is used as the ADC maximum reference. ADC Range = GND to VRef Voltage VDD - Defines the microcontrollers power supply pin as the max reference, VREF+ Pin - Dedicated pin on the microcontroller to allow for a variable reference voltage. 
 
| colspan="2" | Defines what is used as the ADC maximum reference. ADC Range = GND to VRef Voltage VDD - Defines the microcontrollers power supply pin as the max reference, VREF+ Pin - Dedicated pin on the microcontroller to allow for a variable reference voltage. 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | ADC Bit Resolution
 
|-
 
| colspan="2" |  
 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
Line 279: Line 339:
 
| colspan="2" | Number of numbered divisions shown on the thermometer scale. 
 
| colspan="2" | Number of numbered divisions shown on the thermometer scale. 
 
|}
 
|}
 +
 +
==Component Source Code==
 +
 +
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_Thermistor.fcfx FC_Comp_Source_Thermistor.fcfx]
 +
 +
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_Thermistor.fcfx FC_Comp_Source_Thermistor.fcfx]

Latest revision as of 14:41, 19 July 2024

Author Matrix TSL
Version 2.0
Category Environmental


Thermistor component

A generic thermistor component that can be used to simulate and create code for any thermistor with a known temperature/resistance curve. Thermistor is connected in a simple potential divider circuit - thermistor between ADC input and 0V, and a fixed resistor between ADC and the positive supply. Default calibration is for the EBM003 module.

Version information

Library Version, Component Version, Date, Author, Info
9, 2.0, 19-07-24, BR, Added compatibility for external ADC
9, 2.0, 19-07-24, BR, Allowed full bit depth usage of the internal ADC

Detailed description

No detailed description exists yet for this component

Examples

No additional examples







Macro reference

CalculateTemperature

Fc9-comp-macro.png CalculateTemperature
Converts the input ADC value and returns the Temperature in tenths of degree C 
Fc9-u16-icon.png - UINT ADCValue
ADC Reading to be converted 
Fc9-s16-icon.png - INT Return


GetADCValue

Fc9-comp-macro.png GetADCValue
Returns the Raw ADC value from the Analogue Channel 
Fc9-u16-icon.png - UINT Return


GetIntegerTemperature

Fc9-comp-macro.png GetIntegerTemperature
Reads the ADC input and returns the calculated Temperature as Integer degrees C 
Fc9-s16-icon.png - INT Return


GetRealTemperature

Fc9-comp-macro.png GetRealTemperature
Reads the ADC input and Returns the calculated Temperature as Float value in degrees C 
Fc9-f32-icon.png - FLOAT Return


SetADCValue

Fc9-comp-macro.png SetADCValue
Used to set the ADC value when an external ADC is being used. 
Fc9-u16-icon.png - UINT AdcValue
Value of the external ADC. e.g. 0-255 for an 8-bit ADC 
Fc9-void-icon.png - VOID Return


SetChannel

Fc9-comp-macro.png SetChannel
Set the ADC Channel 
Fc9-s16-icon.png - INT ChannelID
 
Fc9-void-icon.png - VOID Return


SetMinMax

Fc9-comp-macro.png SetMinMax
Set the minimum and maximum temperature values that can be shown and set on the thermometer readout. 
Fc9-f32-icon.png - FLOAT Min
Minimum Value 
Fc9-f32-icon.png - FLOAT Max
Maximum Value 
Fc9-void-icon.png - VOID Return


SetTemperature

Fc9-comp-macro.png SetTemperature
Sends the given temperature to the display, and calculates the internal values used by the simulated read macros. 
Fc9-f32-icon.png - FLOAT Temperature
Zero to one value - representing min-max of the sensor. 
Fc9-void-icon.png - VOID Return


Property reference

Fc9-prop-icon.png Properties
Fc9-conn-icon.png ADC Properties
Fc9-type-16-icon.png ADC Configuration
 
Fc9-type-6-icon.png ADC Channel
Analogue Input Channel - Which pin is the analogue input connected to? 
Fc9-type-16-icon.png VRef option
Defines what is used as the ADC maximum reference. ADC Range = GND to VRef Voltage VDD - Defines the microcontrollers power supply pin as the max reference, VREF+ Pin - Dedicated pin on the microcontroller to allow for a variable reference voltage. 
Fc9-type-16-icon.png Conversion speed
Clock setting to select how fast the ADC peripheral will perform an ADC conversion. The FRC setting is based on a RC time base and so will vary with temperature and pressure. Other settings are generally based on divisions of the master clock. 
Fc9-type-14-icon.png Acquisition cycles
Number of micro seconds to wait for the ADC input to charge before starting the analogue sample. 
Fc9-conn-icon.png Thermistor Properties
Fc9-type-16-icon.png Wiring
Specifies the arrangement of the Thermistor and Fixed Resistor. Pull Down - Thermistor connected between ADC pin and GND, fixed resistor between ADC pin and VCC. Pull Up - Thermistor connected between ADC pin and VCC, fixed resistor between ADC pin and GND. 
Fc9-type-21-icon.png Resistor Value
Value in Ohms of the pullup series resistor. i.e. The resistor is connected between the ADC pin and the positive supply rail. 
Fc9-type-21-icon.png -25C Thermistor Value
Value in Ohms of the Thermistor at -25 deg C 
Fc9-type-21-icon.png 0C Thermistor Value
Value in Ohms of the Thermistor at 0 deg C 
Fc9-type-21-icon.png 25C Thermistor Value
Value in Ohms of the Thermistor at 25 deg C 
Fc9-type-21-icon.png 50C Thermistor Value
Value in Ohms of the Thermistor at 50 deg C 
Fc9-type-21-icon.png 75C Thermistor Value
Value in Ohms of the Thermistor at 75 deg C 
Fc9-type-21-icon.png 100C Thermistor Value
Value in Ohms of the Thermistor at 100 deg C 
Fc9-type-21-icon.png 125C Thermistor Value
Value in Ohms of the Thermistor at 125 deg C 
Fc9-conn-icon.png Simulation
Fc9-type-10-icon.png Label
A text label to help you identify the component on the panel. 
Fc9-type-15-icon.png Min. Temp.
Minimum termperature that can be set or displayed on the thermometer slider. 
Fc9-type-15-icon.png Max. Temp.
Maximum termperature that can be set or displayed on the thermometer slider. 
Fc9-type-21-icon.png Scale divisions
Number of numbered divisions shown on the thermometer scale. 

Component Source Code

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

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