2020 CoE2DX4 W5
2020 CoE2DX4 W5
Engineering
2DX4
Implementing Signal Transfer Functions &
Calibration
Week 5
mcmaster.ca |
Introduction Observe
Week 3:
Week 0: Week 1: Week 2:
Timing, I/O, &
Embedded Systems & Signals Around Us Transduction & Analog
Structured Program
Architecture (Digital & Analog) Signal Acquisition
Organization
Reason
Course Organization Week 4:
Week 5: Week 6:
Act Overview
Week 7:
Week 8: Week A & B:
Week 9:
Event Based
Communication Embedded Systems &
Programming & Data Visualization
Protocols Architecture + Overview
Interrupts
mcmaster.ca | 2
o Brief review of transduction and data acquisition
chain.
o Acquiring real-world data and giving it meaning
• Transfer function and calibration
o Digital Transducers (sensors)
Lecture Objectives
• Distance
• Displacement
mcmaster.ca |
Thermistor
The non-linearity and ambient temperature variance make using just a thermistor, such as the
NTCLE10003338, a little more complicated.
At ~room temp
we see a possible
deviation from
0.25 – 1.2 K. At
the upper end, the
deviation ranges
from 1.4-2.9 K.
Temperature Deviation as a
Function of
Ambient Temperature
For this example, the sensor is powered using 5.0V supply and the output is shown in the figure below.
Evaluate the sensor for use in an embedded application. Describe the circuit interface. What is the
meaning of the digital value?
mcmaster.ca |
http://ww1.microchip.com/downloads/en/DeviceDoc/21498D.pdf
Discuss the Design
• Using the TC2047A, how would you go about designing an embedded device to
measure and display temperature?
o Quantify signal(s)
o Signal condition
o Process
o Control/Communicate
mcmaster.ca |
Quantify the Signal
• Frequency?
mcmaster.ca |
Quantify the Signal
• Frequency?
The typical output is slow to change (e.g., weather), thus for a given
temperature can treat as DC. May not always be the case given context
(e.g., rapid heating and/or cooling)
• Voltage output range?
mcmaster.ca |
Signal Conditioning
• What do I need?
o Amplification?
o Level Shifting?
mcmaster.ca |
Signal Conditioning
• What do I need?
o Amplification
Chosen: ADC VREFN = 0, VREFP = 3.3V
Thus our maximum amplification would be 3.3/1.75 = 1.9
o Level Shifting
Assuming a single supply amplifier that accommodates
our VREFN and VREFP this application does not require
level shifting.
mcmaster.ca |
Signal Conditioning
• What do I need? Assuming 12-bit ADC then
3.3/2^12 = 0.80mV/step
o Amplification Chosen: ADC VREFN = 0, VREFP = 3.3V
Thus our maximum amplification would be 3.3/1.75 = 1.886
Assuming 12-bit ADC then
3.2/2^12 = 0.78mV/step
Chosen: ADC VREFN = 0.1, VREFP = 3.3V
Thus our maximum amplification would be 3.2/1.75 = 1.829
o Level Shifting
Assuming a single supply amplifier that accommodates
our VREFN and VREFP this application does not require
level shifting.
mcmaster.ca |
Recall
ADC Conversion Result
MSP432E4 Reference
Manual
mcmaster.ca | 16
The Transducer Output
ADC
Amplified Decimal Temperature
TC1047A (V) Value (C)
3.3 4095
An ADC value
of 3277 is what
temperature?
0 0
mcmaster.ca |
What is the Temperature?
• The ADC will simply assign a binary representation to the measurement based
upon the ratio of the measurement to the full scale voltage.
• If you were to communicate the temperature directly from the microcontroller (not
the ADC value), how could this be implemented?
o Use a transfer function equation
o Use a look up table (LUT)
mcmaster.ca |
“rounded” up or down?
• The impact of ADC resolution is
that with more bits we have more
steps, thus allowing a smaller Δ
RECALL
• This explains why our digitization
cannot be exactly the input analog
ADC Resolution, value.
Quantization, and
• The process of mapping our
Quantization Error analog input to a discrete step
(digital code) is called
quantization.
Consider the Digital Output for
voltage upto 1 delta.
• In quantizing our data, we
introduce quantization errors, as
illustrated in Razavi’s Fig. 6.1-b)
• As can be expected -- as
resolution increases, Δ decreases
and quantization error decreases.
mcmaster.ca |
Compute the Temperature (Equation) cont’d
• Given a Temperature measurement, what voltage do we expect output from
transducer?
Vout(-40) = 0.1 V
mcmaster.ca |
Compute the Temperature (Equation) cont’d
• Remember, the output from the transducer needs to be processed to optimize it
for the ADC stage. For our example we only need to amplify the signal.
o Gain = VREFP/(maximum voltage output from transducer)
o Gain = 3.3/1.75 = 1.886
mcmaster.ca 2/23/21 | 22
Compute the Temperature (Equation) cont’d
• Now consider, what ADC value do we expect from our amplified transducer
voltage?
o ADC value = (2^n-1)*VADCin/(VREFP-VREFN), where n is the number of ADC
bits
o Test 12 bit ADC at limits
• Maximum measurement of 3.3V
o ADC value = 4095 * 3.3 / (3.3-0) = 4095 (0b1111 1111 1111)
• Minimum measurement of 0V
o ADC value = 4095 * 0 / (3.3-0) = 0 (0b0000 0000 0000)
Recall ADC VREFN = 0, VREFP = 3.3
mcmaster.ca |
Compute the Temperature (Equation) cont’d
• Now consider, what ADC value do we expect from our amplified transducer
voltage?
mcmaster.ca |
Compute the Temperature (Equation) cont’d
• Now consider, once we have an ADC value how can we convert that to the actual
temperature?
Isolate temp:
ADCval = (2^n-1)*(1.886 * (0.01 * temp + 0.5))/(VREFP-VREFN)
Temp(ADCval) =((3.3*ADCval)/(4095*1.886)-0.5)/0.01
Temp(ADCval) = 0.043*ADCval-50
mcmaster.ca |
Show the Temperature (LUT)
ADCval Temp
• Use a look up table (LUT)
o For each ADC measurement, the
equation would be used as the offset 3276 88.7
from the top of a table or the index into an 3227 88.8
array.
3228
o Time to acquire conversion would be only
the time for a memory access
mcmaster.ca |
Calibration
ADC
Amplified Decimal Temperature
TC1047A (V) Value (C)
3.3 4095
Transfer
Function
Or LUT
An ADC value
of 3277 = 90
degrees!
0 0
mcmaster.ca |
Sensors with Digital Output
The TC72 Digital Thermometer
§ Ten-bit resolution and SPI interface
§ Pin assignment and block diagram shown below. Transducer limitation
§ Capable of reading temperature from -55oC to 125oC.
§ Can be used in continuous temperature conversion or one-shot conversion mode.
§ Has internal clock generator to control the automatic temperature conversion sequence.
TC72
V DD Internal
diode Transducer, Conditioning,
temperature and ADC are all taken care
sensor
of using an IC like the
Manufacturer TC72.
ID register
NC 1 8 V DD 10-bit
sigma Delta
CE 2 7 NC A/D
TC72 CE
converter
SCK 3 6 SDI Serial SCK
Port SDO
GND 4 5 SDO Interface
temperature SDI
register
GND Control
Register
Table)10.3)TC72)Temperature)output)data
Binary
Hex Temperature
high)byte/low)byte
mcmaster.ca |
Application Specific
Lets assume now we are designing an embedded temperature sensor for a coffee maker. Justify which of the
two curves would be best suited. The optimal water temperature for coffee is 96 degrees Celsius.
mcmaster.ca |
Digital
Transducers &
Sensors
Distance
Displacement
mcmaster.ca |
Displacement
Inertial measurement unit (IMU)
The MPU-9250 is Motion Tracking
device.
https://www.invensense.com/wp-content/uploads/2015/02/MPU-9250-
Datasheet.pdf?ref_disty=digikey
mcmaster.ca |
Looking Forward
• Studio
o Sensor data
mcmaster.ca | 34