Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Temperature Monitor In this assignment you will use the DigitalIn, AnalogIn, and BusOut interfaces on the mbed microcontroller board to implement a simple indoor/outdoor temperature

Temperature Monitor

In this assignment you will use the DigitalIn, AnalogIn, and BusOut interfaces on the mbed microcontroller board to implement a simple indoor/outdoor temperature monitor. The pinout of the LM35 temperature sensor is shown to the right. Connect the LM35s +Vs pin to the mbeds VOUT pin, the LM35s Vout pin to the mbeds p18 pin, and the LM35s GND pin the mbeds GND pin. Do not confuse the LM35's Vout pin with the mbed's VOUT pin. The voltage on the LM35s Vout pin is related to its temperature by the following equation (with V in volts and T in degrees Celsius):

V=0.010 T

The pinout of the LMT87 temperature sensor is identical to the LM35, but it can measure colder temperatures. Connect it to the mbed the same way as the LM35 except connect the LMT87's Vout pin to the mbed's p17 pin. Also connect the LMT87's Vout pin to a 2.2 k resistor connected to GND (this presents a slight load on the LMT87's output, which it needs for the temperature to be detected correctly). The voltage on the LMT87s Vout pin is related to its temperature by the following equation (with V in volts and T in degrees Celsius):

V=2.633-0.0134T

Although both sensors should be mounted on your solderless breadboard along with the mbed, if this were a real product, the LMT87 could be installed outdoors (with appropriate weatherproofing) and connected to the mbed indoors with a cable.

Connect one of the pushbutton switches between p21 and VOUT and the other switch between p22 and VOUT. Connect the 7-segment LED display to the mbed (although I recommend inserting 220 ohm resistors in series with the LED segments, rather than a direct connection so that the current though the USB cable strictly complies with the specification).

Write a program for the mbed (use C and C++) that will periodically read and display the temperatures from the LM35 and the LMT87. Your program should use the mean average voltage from the temperature sensor (computed over at least 1000 samples) so that the displayed value does not fluctuate due to noise when the temperature is stable.

The temperatures should be displayed as the nearest integer on the 7-segment display in Celcius or Fahrenheit, depending on the current mode. Since the display can only display one digit, you must display the temperature one digit at a time. Display each digit for 0.5 1 seconds, then blank the display for 0.1 seconds (this way the user can distinguish a digit shown once from two digits with the same value shown consecutively). After showing the temperature, the display should show "C" for Celcius or "F" for Fahrenheit for 0.5 1 seconds and then blank the display for 0.1 seconds. Then the display should show "i" for indoor or "o" for outdoor for 0.5 1 seconds and then blank the display for 0.1 seconds. Use lowercase "i" and "o" so that they are distinguishable from "1" and "0" on the display. Note that the outdoor temperature might be less than 0, in which case you will need to display the leading negative sign (if you want to test this without a freezer, disconnect p20 from the LMT87 and connect it instead to the mbed's VOUT; this corresponds to a temperature of around -50 C or -58 F).

Pressing the switch connected to p21 selects the Celcius mode. Pressing the switch connected to p22 selects displaying the Fahrenheit mode. If neither switch is pressed, the temperature is unchanged. When your program starts, it may default to whichever mode you prefer. Your program should check the state of the switches at least once per set of indoor/outdoor temperatures displayed (so the user might have to hold down the switch for an entire display cycle to switch modes). If you want to, you can detect mode changes more often, but you should completely display the temperature in one mode or the other (for example, don't display the first digit from the indoor temperature and the second digit from the outdoor temperature). Note that your program should display temperatures even if the switches have never been pressed.

Hints: For debugging purposes, it might be useful to use the Serial object to display intermediate results on your computer, although this is not a requirement for the assignment. Also, since the voltages being measure from the temperature sensors are very small, even slight resistive voltage drops can skew the results; you should minimize this effect by sampling the temperatures only when the LED display is blank.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual Basic 4 Ole Database And Controls Superbible

Authors: Michael Hatmaker, C. Woody Butler, Ibrahim Malluf, Bill Potter

1st Edition

1571690077, 978-1571690074

More Books

Students also viewed these Databases questions