0% found this document useful (0 votes)
26 views34 pages

2020 CoE2DX4 W5

This document discusses implementing a temperature sensor and signal conditioning circuit in an embedded system. It describes using a TC1047A temperature transducer that outputs a linear voltage between 0.1V to 1.75V corresponding to temperature. This signal would need amplification to scale it to the ADC input range, but no level shifting. The amplified analog signal is then converted to a digital value by the ADC to be processed and displayed as temperature data.

Uploaded by

Shahram Shirani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views34 pages

2020 CoE2DX4 W5

This document discusses implementing a temperature sensor and signal conditioning circuit in an embedded system. It describes using a TC1047A temperature transducer that outputs a linear voltage between 0.1V to 1.75V corresponding to temperature. This signal would need amplification to scale it to the ADC input range, but no level shifting. The amplified analog signal is then converted to a digital value by the ADC to be processed and displayed as temperature data.

Uploaded by

Shahram Shirani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

Computer

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:

Implementing Signal System Integration &


Peripherals
Transfer Functions & Abstract Data Types
Calibration

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 February 23, 2021 | 3


Review of
Transduction and
Data Acquisition

mcmaster.ca | February 23, 2021 4


Acquiring an Analog Signal for a Digital System

mcmaster.ca February 23, 2021 | 5


Transfer
Function &
Calibration
Temperature Example

mcmaster.ca | February 23, 2021 6


Perhaps, like me, each morning you
check the weather forecast.

Have you ever considered how that


information gets to our favourite weather
channel?

The image on the right displays


temperatures around Hamilton, Ontario.

Temperature The information is from the Weather


Underground which allows individuals to
add information from their own weather
stations (www.wunderground.com)

What if we wanted to build our own


temperature station?

Thermistors (temperature sensitive


resistors) are an option, but would likely
require you to use the non-linear
relationship shown on the following
slide. There are alternatives which we
will discuss.

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

mcmaster.ca https://cdn.sparkfun.com/datasheets/Sensors/Temp/ntcle100.pdf February 23, 2021 | 8


Temperature Sensor (TC1047A)
The TC1047A is a 3-pin temperature sensor with an analog output voltage directly proportion to the
measured temperature. See below for the voltage relationship to 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?

While the TC2047A also exhibits some deviation, it is


typically less than the sole thermistor and more easily
accommodated with the linear relationship

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?

• Voltage output range?

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?

From the transducer, 0.1V to 1.75V

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

Chosen: ADC VREFN = 0.1, VREFP = 3.3V


Thus our maximum amplification would be 3.2/1.75 = 1.8

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

Transducer Processing ADC Computation

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 “Principles of Data Conversion System Design” by Razavi


|
Compute the Temperature (Transfer Function Equation)
• Use a transfer function equation
o For each ADC measurement, the equation would be used to calculate the
temperature
o This case, an equation of a line
• Y(x) = mx + b
• Vout(temp) = 1.65/165 * temp + 0.5
• Vout(temp) = 0.01 * temp + 0.5
o Assuming the programmer does not compute the slope every time (fixed slope)
then each conversion will require one multiplication and one addition.

mcmaster.ca |
Compute the Temperature (Equation) cont’d
• Given a Temperature measurement, what voltage do we expect output from
transducer?

o Vout(temp) = 0.01 * temp + 0.5

Quick test: temperature of -40

Vout(-40) = 0.01*-40 + 0.5

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

o Thus the amplified voltage to the ADC is:


• VADCin(temp) = Gain * Vout(temp)

= 1.886 * (0.01 * temp + 0.5)

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?

• Lets assume the voltage read in by the ADC is 2.64V


o ADCval = (2^n-1)*VADCin/(VREFP-VREFN)
= 4095 * 2.64 / (3.3 – 0)
Recall ADC VREFN = 0, VREFP = 3.3
= (3276)10

o Combining what we have done:


• ADCval = (2^n-1)*(1.886 * (0.01 * temp + 0.5))/(VREFP-VREFN)

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

Test: What temperature is ADC value 3227?

Temp(3227) = ((3.3 * 3227)/(4095*1.886) -0.5)/0.01


= 89 degrees C (rounded)
Recall ADC VREFN = 0, VREFP = 3.3

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

Transducer Processing ADC Computation

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

Figure 10.13 TC72 pin assignment and functional block diagram


mcmaster.ca |
Temperature Data Format
§ Temperature is represented by a 10-bit two’s complement word with a resolution of
0.25oC per least significant bit.
§ The converter is scaled from -128oC to +127oC with 0oC represented as 0x0000.
§ The temperature value is stored in two 8-bit registers.
§ Whenever the most significant bit is 1, the temperature is negative.
§ A sample of temperature reading is shown in Table 10.3.

Table)10.3)TC72)Temperature)output)data

Binary
Hex Temperature
high)byte/low)byte

0010)0001/0100)0000 2140 33.25oC


0100)1010/1000)0000 4A80 74.5 oC
0001)1010/1100)0000 1AC0 26.75oC
0000)0001/1000)0000 0180 1.5 oC
0000)0000/0000)0000 0000 0 oC
1111)1111/1000)0000 FF80 F0.5 oC
1111)0010/1100)0000 F2C0 F13.25 oC
1110)0111/0000)0000 E700 F24oC
1100)1001/0100)0000 C900 F55oC

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.

Output Voltage vs. Temperature

mcmaster.ca |
Digital
Transducers &
Sensors
Distance

Displacement

mcmaster.ca | February 23, 202131


Distance

• Distance can be measured in various


ways.
• We will be using “time of flight” (ToF)
• The ToF is based upon the time it takes
a laser light reflection
• The reflection is collected and the time
delay measured
• Same principle as LIDAR (Light
https://hub.hamamatsu.com/us/en/application-note/measuring-distance-
Detection and Ranging) with-light/index.html

mcmaster.ca |
Displacement
Inertial measurement unit (IMU)
The MPU-9250 is Motion Tracking
device.

Three-axis rate gyroscope sensor with 16-bit ADC


Three-axis accelerometer sensor with 16-bit ADC
Three-axis magnetometer sensor with 16-bit ADC

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy