Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
P
PT100
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
João Lino
PT100
Commits
093e6051
Commit
093e6051
authored
Nov 24, 2015
by
João Lino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v0.1
parent
140a397c
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
451 additions
and
0 deletions
+451
-0
PT100.cpp
PT100.cpp
+365
-0
PT100.h
PT100.h
+86
-0
No files found.
PT100.cpp
0 → 100644
View file @
093e6051
This diff is collapsed.
Click to expand it.
PT100.h
0 → 100644
View file @
093e6051
/*
PT100.h - Library for measuring temperature with a PT100.
Created by João Lino, June 24, 2015.
Released into the public domain.
*/
#ifndef PT100_h
#define PT100_h
#include "Arduino.h"
#define DEBUG
#define CONSTANT_ADC_STEP_COUNT 1024.0
#define TEMPERATURE_AVERAGE_VALUE_I 50
#define TEMPERATURE_AVERAGE_VALUE_F 50.0
//#define TEMPERATURE_AVERATE_INIT_VALUES 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
#define TEMPERATURE_AVERATE_INIT_VALUES 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
#define TEMPERATURE_AVERATE_INIT_VALUES_I 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
#define TEMPERATURE_SETTING_MAX_VALUE 120
class
PT100
{
public:
// PT100(PT100_OUTPUT_PIN, PT100_INPUT_PIN, PT100_TIME_BETWEEN_READINGS, PT100_DEFAULT_ADC_VMAX, PT100_DEFAULT_VS, PT100_DEFAULT_R1_RESISTENCE, PT100_DEFAULT_LINE_RESISTENCE, PT100_DEFAULT_OPERATION_RESISTENCE);
PT100
(
char
*
name
,
int
OutputPin_SensorPower
,
int
OutputPin_ThirdLinePower
,
int
InputPin_TemperatureReading
,
int
InputPin_ThirdLineReading
,
int
TimeBetweenReadings
=
100
,
float
ADCVmax
=
1.081
,
float
Vs
=
4.87
,
float
R1
=
606.0
,
float
R2
=
606.0
,
float
m
=
1.0
,
float
b
=
0.0
);
void
setPower
(
float
ADCVmax
=
1.081
,
float
Vs
=
4.87
);
void
measure
(
boolean
ln
);
void
measure1
(
boolean
ln
,
boolean
rline
);
void
safeHardwarePowerOff
();
float
getCurrentTemperature
();
float
getMeasuredTemperatureDeviation
();
float
setMeasuredTemperatureDeviation
(
float
measuredTemperatureDeviation
);
float
setSampleDeviation
(
float
sampleDeviation
);
private:
char
*
_name
;
int
_OutputPin_SensorPower
;
int
_OutputPin_ThirdLinePower
;
int
_InputPin_TemperatureReading
;
int
_InputPin_ThirdLineReading
;
int
_TimeBetweenReadings
;
float
_ADCVmax
;
float
_Vs
;
float
_R1
;
float
_R2
;
float
__m
;
float
__b
;
float
_temperatureAverage
;
float
_measuredTemperature
;
float
_measuredTemperatureDeviation
;
float
_sampleDeviation
;
unsigned
long
_lastTemperatureRead
;
int
_VoutAnalogSample
;
int
_VoutRAnalogSample
;
float
_VoutPreviousAnalogSample
;
int
_temperatureMeasurementsMarker
;
int
_rPT100MeasurementsMarker
;
int
_rLineMeasurementsMarker
;
float
_temperatureMeasurements
[
TEMPERATURE_AVERAGE_VALUE_I
]
=
{
TEMPERATURE_AVERATE_INIT_VALUES
};
int
_rPT100Measurements
[
TEMPERATURE_AVERAGE_VALUE_I
]
=
{
TEMPERATURE_AVERATE_INIT_VALUES_I
};
int
_rLineMeasurements
[
TEMPERATURE_AVERAGE_VALUE_I
]
=
{
TEMPERATURE_AVERATE_INIT_VALUES_I
};
void
xFilterNoise
(
int
position
);
float
GetMedian
(
int
array
[]);
float
GetMode
(
float
array
[]);
};
#endif
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment