Jump to content

Component: Analogue Temp Sensors (Environmental)

From Flowcode Help
Author Medelec35
Version 1.0
Category Environmental


Analogue Temp Sensors component

A range of the most popular temperature analogue sensors which are: AD22100, AD22103, LM135, LM235, LM335, LM34, LM35, LM60, MCP9700, MCP9701, TC1047, TMP35, TMP36, TMP37 & TSIC301. Uses a single ADC pin which will allow you to display the temperature in C or F. If your sensor is not listed, there is a Custom option. You will be able to enter the scale factor, offset voltage, Temperature Compensation, min and maximum temperatures If the temperature is outside the min and max values, then 999.9 will be displayed.

Component Source Code

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

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

Detailed description

No detailed description exists yet for this component

Examples

Example Program showing how to show the temperature in Celsius and Fahrenheit and expected ADC pin voltage on an LCD.

Analogue Sensors Example

Macro reference

GetTempFloatC

GetTempFloatC
Value of the temperature in deg C 999.9 = temperature outside of sensor range 
- FLOAT Return


GetTempFloatF

GetTempFloatF
Value of the temperature in deg F 999,9 = temperature outside of sensor range 
- FLOAT Return


GetTempIntCX10

GetTempIntCX10
Value of integer temperature in deg C x10 E.g 22.5C will give the result of 225 This allows more contol if using integers to save memory 9999 = temperature outside of sensor range  
- INT Return


GetTempIntFX10

GetTempIntFX10
Value of integer temperature in deg F x10 E.g 62.5F will give the result of 625 This allows more contol if using integers to save memory 9999 = temperature outside of sensor range 
- INT Return


GetTempStringC

GetTempStringC
String value of integer temperature in deg C to one decimal place. E.g 22.5 999,9 = temperature outside of sensor range 
- STRING Return


GetTempStringF

GetTempStringF
String value of integer temperature in degF to one decimal place. E.g 70.2 999,9 = temperature outside of sensor range 
- STRING Return


IntValueADC

IntValueADC
The Integer ADC value of the sensor output volttage  
- INT Return


VoltageADC

VoltageADC
Calculates what the approximate voltage should be based on Vref, Scale factor, Offset. For TSIC301, based on Max temp and Min temp only.  
- FLOAT Return


Property reference

Properties
Select Sensor
Select the required sensor. Custom allows you to enter parameters of an analogue sensor not covered. 
ADC Properties
Channel
Analogue Input Channel - Which pin is the analogue input connected to? 
Vref (mV)
For a more accurate reading, enter the exact referance voltage.  
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. 
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. 
Acquisition cycles
Number of micro seconds to wait for the ADC input to charge before starting the analogue sample. 
Total average samples
The number of ADC samples taken. The higher the number the more stable the reading.  
Sensor Characteristics
Temp compensation x10
Set value to compensate for sensor and other vairations. E.g. -10 = Set the temperature 1 degrees lower 5 = Set the temperature 0.5 degrees higher 
Scale factor (mV x100)
for a scale factor of 22mv/C or 22mV/F it's 2200. Scale factor is set for you automatically. It can only be adjusted when custom is selcted.  
Offset (mV)
Offset is set for you automatically. It can only be adjusted when custom is selcted. 
Max Temp
Max Temp the sensor can reach is set for you automatically. It can only be adjusted when custom is selcted. 
Min Temp
Max Temp the sensor can reach is set for you automatically. It can only be adjusted when custom is selcted. 
Centigrade
0 for a fahrenheit sensor. 1 for a centigrade sensor. Can only be changed when custom is selected. 
Kelvin
1 for a kelvin sensor. Can only be changed when custom is selected.