Second assignment
Assigned: November 5, 2012
Due: November 14, 2012
After your 1st Project, you have a functioning circuit that can communicate with your
computer and you can control it from Matlab. By communicating with your system,
you can measure voltage (potential difference, V) between different pins of the
Ruggeduino interface. Our next task is to: (a) measure the voltage across your sensor
(thermistor); (b) convert the measured voltage into the resistance of the thermistor
(R4 on your schematic), which depends on temperature; and then (c) convert the
resistance measurements into the corresponding temperature. The measured
temperature can then be used to control the temperature of the heated resistor
(R2 on your diagram) by using the feedback control.
For temperature measurements we exploit the fact that thermistors change their
resistances as their temperature changes. The resistance is known as a function of
temperature from standard calibration diagrams. In our case, you would need to use
the temperature-resistance calibration curve for 10K NTC thermistors, which you can
find at the manufacture’s web site ( Technical specifications for our sensor are found
As you remember from your basis Physics class, the resistance of a component is
equal to R=V/I. Since we only measure voltages with our microcontroller, but not the
current, I, we can calculate the resistance using voltage dividers, like the one shown
in Figure 1 (for our purposes, there is no difference between resistance R and
impedance Z).
Figure 1: A simple voltage divider
If you now examine the schematic used to build your experiment during Project 1,
you will notice that a voltage divider is part of your circuit, shown again in Figure 2.
Figure 2: The schematic of the circuit built as Project 1.
Your project assignment is to complete the following tasks:
1. Identify and mark the voltage divider sub-circuit in the schematic of Figure
2. Identify Z1, Z2, Vin and Vout specific to Figure 2.
2. Show that the resistance of the thermistor R4 is given by the following
𝑅3 ∗ 𝑉𝐴0
𝑅4 =
𝑉5𝑉 − 𝑉𝐴0
where R3 is the known resistance (=15KΩ), 𝑉𝐴0 is the potential difference of
the pin A0 relative to the ground potential of the pin 0V, and 𝑉5𝑉 = 5 𝑉 is
the nominal output voltage measured between the 5V pin and ground pin 0V.
3. Use the calibration curves provided by thermistor manufacturer to write a
Matlab function that converts R4 into the corresponding temperature. Your
calibration curve should cover the range of temperatures from 0 C to 80 C.
o Hint: After you establish connection to the hardware in Matlab, use the
following command to measure the potential of pin A0,
signal0 = a.analogRead(0)*(5/1023)
The signal is multiplied by 5/1023 because the analog signal, which
ranges from 0V to 5V, is converted to a 10 bit digital signal in 210 =
1024 divisions.
4. Validate the temperature measurement developed in Step 3 by using some
other means to measure the temperature (e.g. use known room
5. To control the temperature of R2, we adjust the electrical current thought it.
The typical way to control an average current and power (which determines
the heating rate) through an element is to use Pulse Width Modulation
(PWM). In your report, briefly describe how PWM works. What parameters of
PWM can we use to control an average current?
6. Measure the potential difference between the 5V pin and 0V pin under no
load (PWM duty cycle set to 0) and full load (PWM duty cycle set to 255). Use
multimeter (which you can borrow from me, Nathan, or in the Senior Lab) to
obtain these measurements.
o Is there a difference in results?
o If “yes”, what can be the cause of it? In what way can this phenomenon
make the measurements less accurate? Propose a way to correct for a
Hint: You can adjust the duty cycle (DC) of PWM (the frequency is fixed)
with the following Matlab commands:
This will output a PWM signal with duty cycle DC to pin 3 on your
diagram. Use DC=0…255. DC=0 will result in no output, while DC=255
will produce the maximum output (current/power). Those curious
among you and with an access to an oscilloscope or other suitable test
equipment may want to measure the signal between pins 3 and 0V
which, however, is not required for this project.