Room Thermostat  

CHE 2301L Process and Automation Lab

Fall 2020

Don't use plagiarized sources. Get Your Custom Essay on
Room Thermostat  
Get a plagiarism free paper Just from $13/Page
Order Essay

 Lab: Room Thermostat  

 

Objective

Whether it is for comfort or for saving money, automating the process of maintaining theroom temperature within a comfortable range is essential. Room thermostat plays a big role in aiding this goal. In this project, we will be using a temperature sensor to sense the room temperature. Then, the sensed temperatureis compared against the minimum and maximum set temperature values using the control algorithm, to determine if thethe heater and thefan are to be turned ON or OFF. The LCD display acts as a thermostat display.

Background

Temperature Sensor

The TMP36 is a low voltage, precision, centigrade ICtemperature sensor. It provides a voltage output that is linearly proportional to the temperaturein Celsius (centigrade). These transducers that convert temperature into voltage are referred as Band Gap sensors, named after the principle under which they operate.The energy bandgap of semiconductors tends to decrease with increase in the temperature of the material. This behavior can be understoodbetter, if one considers the fact that the interatomic spacing increases with the increase in amplitude of the atomic vibrations. This increase in atomic vibration results in increasedthermal energy. This effect is quantified by the linear expansion coefficient of a material. Increased interatomic spacing decreases the potential seen by the electrons in the material, which in turn reduces the size of the energy bandgap.

The TMP36 does not require any external calibration to provide typical accuracies of ±1°C at +25°C and ±2°C over the −40°C to +125°C temperature range. The low output impedance of TMP36, its linear output, and itsprecise calibration, simplify theinterfacing of this to thetemperature control circuitry and ADCs. TMP36 provides a 750 mV output at 25°C,and the output scale factor is 10 mV/°C. To use, connect pin 1 (left) to Vcc, pin 3 (right) to ground, and pin 2 to an analog inputof Arduino. The voltage output is 0V at -50°C and 1.75V at 125°C. The output voltage offset is 500 mV. The graph below shows the relationship between the output voltage of the sensor and the temperature reading.The temperature, in Celsius, can be calculated fromthe voltage reading using the formula

Temp °C = 100*(reading inV –0.5)

 

 

Figure 1: TMP36 IC and thegraph representing its characteristics

 

Bipolar junction transistors (BJT)

 

Bipolar junction transistor(BJT)is an electronic device that use both electron and hole charge carriers. These transistors can have two functions depending on how they are incorporated in a circuit: switching and amplification. There are twotypesof these transistors and they are : npn transistors and pnp transistors.In this project, weuse annpn-type and as a switch. We use this switch to turn the motor ON and OFF.

A transistor has three terminals: collector (C), emitter (E), and base (B). An npn-type device is similar to two np diodes connected back to back as shown in Figure 2.For the device to conduct, the current should flowfromthe collector to the emitter i.e, the transistor is fully ON

Figure 2. NPN Transistor

The switch configuration of the transisitor is shown below. This switch is operated by a control signal Vin and usually takes on two voltage level: ON or OFF. When Vin = VB= OFF, the base/emitter branch is reverse biased and the base collector junction is reverse biased. Hence no current flows through the load, RL, and the device is OFF as in figure 3.

 

Figure 3. NPN Transistor as Switch when it is OFF

 

When Vin= ON, both base-collector and base-emitter junctions are forward biased and the current flows through RL and the transistor is ONas in figure 4.

 

Figure 4. NPN Transistor as Switch when it is ON

 

The advantage of a transistor switch is that it will not wear out even if it is opened and closed very rapidly as itdoes not have any mechanical elements in it. Additionally, because the current IB applied to the base (when VB = VON) is very small, the power required operate the transistor switch is also very small (recall that P = I2R). This ability to turn the transistor switch ON and OFF rapidly is used in derivingdifferent average voltage levels when it is combined with Pulse Width Modulation. That is how the input voltage to the motor is changed to achieve different speeds.

DC Motor

DC motor is an electrical device that converts direct current electrical energy into mechanical energy. The most common types rely on the forces produced by magnetic fields. Nearly all types of DC motors have some internal mechanism, either electromechanical or electronic, toperiodically change the direction of the current in motor.

 

A simple DC motor has a stationary set of magnets in the stator,and a rotor with an armature with one or more windings of insulated wire wrapped around a soft iron core to concentrate the magnetic field.A coil of wire with a current running through it generates electromagnetic field aligned with the center of the coil. The direction and magnitude of the electromagnetic field produced by the coil can be changed by changing the direction and magnitude of the current flowing through it, the coil size, and thecore around which it is wound.The sequence of turning the current througha particular coil on or off dictates the direction of the effective rotating electromagnetic fields createdby it.

 

These rotating magnetic fields interact with the permanent magnetic fields of the magnets in the stationary part of the motor (stator) to create a torque on the armature and causes it to rotate. Some DC motor designs use electromagnets to create their magnetic fields in the stator instead of permanent magnets and allow greater control over the motor.

 

A DC motor’s speed can be controlled either by using a variable supply voltage or by changing the strength of the current in thearmature windings.When the motor reachesitsdesignated speed, the current needs to be maintained at that level forthe torque to be constant.However, if the input voltage is increased, more torquewill be produced that results in increase in speed within the limit it is rated for. That is, at a steady state speed,the speed can be increased/ decreased withincrease/decrease inthe input voltage.

 

Part 1.  LCD interface

In this project, we are usingthe LCD display as the thermostat display.First step is to make sure that the LCD displayis working properly with the native sketch. Then, we change the sketch to customize the display for using it as a thermostat display.

 

Hardware

Components

  • 16×2 LCD Screen

We are using the pre-built Arduino-LCD circuit. So, bring that circuitto the circuit environment and make sure it works properly. The potentiometer may need to be adjusted to change the contrast of the LCD.

 

 

 

Figure1a. ThePre-built LCD circuit setupFigure 1b.  Modified LCD Display

 

Software

Sketch

You will find a sketch in the code area when you added the LCD circuit. After making sure the circuit works with the existing sketch, modify the sketchto show on the display “Room Temperature” on the first line and the  read temperature and Fon the second line as show in Figure 1b.

 

Simulate

Checkif the LCD is showing the display as in Figure 1a and then as show in Figure1b. Modify the sketch and center the display.

 

Part2: Interfacing Temperature sensor

The temperature sensor is wired to Arduino and the sketch is modified  to read the sensor output voltage, and then convert the read voltage  into temperature in °F .

Hardware

Components

  • Temperature SensorTMP36
  • wires

 

Wire it up

To interface the temperature sensorwith Arduino, we need to connect the pinouts of the sensor to +5 VDC, analog input A0,and GND of Arduino respectively. Consider the wire diagram below.

 

 

Consider the wiring diagram below and wire the temperature sensor.

 

Figure 2: Wiring diagram of TMP 36

Software

Algorithm

  1. Read sensor output using analogRead(—–)
  2. As the read output is a number between 0=1023, convert read value into analog voltage of range 0-5V using this formula:reading V: reading N * 5.0/1024.0
  3. Convert the voltage into temperature by using this formula:Temp °C = 100*(reading V – 0.5)
  4. Convert Celsius to Fahrenheit Temp °F= (Temp°C * 9.0 / 5.0) + 32.0
  5. Print on Serial printer reading V, Temp °F,and Temp °C.
  6. Display“ Room Temperature” and Temp°F on LCDin two lines

 

Sketch

Develop the sketchusing the following instructions.

 

Variable declaration

int Temp_sensor = A0;// pin for sensor

int Temp_sensor_read;               // sensor reading

float voltage= 0;             //Voltage read from the temperature sensor

float temperatureC = 0;

float temperatureF = 0

 

Setup

// add Serial Monitor init

Continuous Loop

// Follow the algorithm above and translate that into sketch

Simulate

Now move the slider control for the temperature sensor and checkif the serial monitor output and LCD show the correct values.

 

Part 3: Interfacing Heater control

We are using a red LED to mimic the heating element. The heating element(red LED) is turned ON when the room temperature falls below Minimum Set Value and the heating element(red LED)is turned OFF when the room temperature exceeds Minimum Set Value. The LED is controlled by Arduino’s D13 signal.

Hardware

Components

  • A Red LED for heating element
  • 220 Ω resistor
  • Wires

Wire it up

Consider the wiring diagram below with a redLED connected to the D13 signal via acurrent limiting resistor.

 

 

 

 

Figure 3: Heater and Temperature Sensor.

Software

Let’s add the sketch for the heater control. We setthe acceptable range of temperatures by defining the maximum temperature  set value and the minimum temperature set value  in the sketch. Once that is established, we  check to see if the temperature read is less than minimum set valueor in the defined range or above the maximum set temperature and turn the heater(red LED) ON when needed.

Algorithm

  1. If temperature is less than Minimum Set Value
    1. Turn on Heater LED
  2. If temperature is greater than Maximum Set Value
    1. Turn off Heater
  3. if measured temperature is less than Maximum Set Value and greater than Minimum set Value
    1. Turn off Heater

Sketch

Variable declaration

//Declare Minimum and Maximum set values for the Thermostat

float MinTemp_setvalue = 63;  //Minimum set value in Fahrenheit

float MaxTemp_setvalue = 77;  //Maximum set value in Fahrenheit

int Heater_pin = 13;          //RED Led for heater

Setup

//Add hardware declaration for Digital output (Heater LED)

Continuous Loop

//Add the code by translating the algorirhm

Simulate

 

Part 4: InterfacingFan control

Here, a motor is used to mimic the fan, and the speed of the fancan be adjusted using a potentiometer. The fan is set to run at the designated speed using the PWMdigital output. When the base of the NPN transistor is high during the width of the pulse, the transistor is ON and hence the motor is ON. The base of the transistor is low during the rest of the period of the pulse, the transistor is OFF, and hence the motor is OFF. The speed of the motor is controlled by actually turning it off and on thus reducing and increasing the speed. However, as the period of the pulse is very small,the effective speed of the motor is realizedwith the average value of the pulse.

Hardware

components

  • 2N2222 NPN Transistor
  • 250 k Ω potentiometer
  • 470 Ω resistor
  • DC motor for Fan
  • wires

Wire it up

An NPN transistor,a motor, a resistor, and a potentiometer are added to the existing circuit and wired as shown in figure 4 controlling the fan-both for turning on and off and the speed. The collector of the transistor is connected to the motor inputand the base is connected to the digital PWM output(D6) to control the speed of the motor. The speed of the motor can be changed by moving the wiper of the potentiometer. This setting,in turn is read using an analog input(A1) and then a proportional pulse is applied to the motor using Arduino PWM output D6.

 

 

Figure4: Control Circuitry for Motor and Heater

 

Software

We read the potentiometer setting for the fan speed and then in the three ranges previously defined in part add where the motor needs to be ON and add where the motor needs to be  OFF

Algorithm

  1. Read the speed setting from potentiometer using analogRead(—–)
  2. If temperature is less than Minimum Set Value
    1. Turn on Heater LED
    2. Turn off Motor
    3. Then Display ”Temp is HIGH” and “Fan is ON” on LCD.
  3. If temperature is greater than Maximum Set Value
    1. Read speed setting and map the value in the range 0 to 255
    2. Turn off Heater
    3. Turn on Motor to the speed set in speed setting
    4. Display ”Temp is LOW” and “Heater is ON” on LCD.
  4. if measured temperature is less than Maximum Set Value and greater than Minimum set Value
    1. Turn off Heater
    2. Turn off Motor
    3. Display “Temp is OK” and the room temperature on LCD

 

Sketch

Variable declaration

//add these variable declaration

int Fan_pin = 6;              //FAN_pin: DC motor is used to mimic PWM Digital output

int Motor_speed_adjust = A1; // potentiometer read for speed

int Motor_speed=0;

Setup

//Fan motor as output

Continuous Loop

 // translate the algorithm above into sketch by adding what is necessary in the three ranges. 

//Add the following statement for reading the speed and converting the range

 

Motor_speed = map(analogRead(Motor_speed_adjust), 0, 1023, 0, 255); //Read speed setting and map the value in the range 0 to 255

Simulate

Adjust the temperature using the bar to check if the thermostat works properlyfor temperatures in all the three ranges

Report

The report could be written in 3rd person past tense and in complete sentences.

 

  1. Introduction (1-3 paragraph, what is the application or motivation for the lab?)
  2. Objective (1-2 sentences, what was the goal or objective of the lab in your own words?)
  3.  Procedure (3+ or more paragraphs)
  4. Discussion (3+ paragraphs)
    1. Discuss the algorithm and sketch for parts 2,3, and 4.
  1. Conclusion (1 paragraph, summarize main points of the project)

 

 

 

Master Homework
Order Now And Get Your Paper Done!
Pages (550 words)
Approximate price: -

Advantages of using our writing services

Custom Writing From Scratch

All our custom papers are written by qualified writers according to your instructions, thus evading any case of plagiarism. Our team consists of native writers from the USA, Canada, and the Uk, making it convenient for us to find the best to handle your order.

Unlimited Free Revisions

If you feel your paper didn't meet all your requirements, we won't stop till it's perfect. You're entitled to request a free revision within 7 days after we submit your paper.

Quality Writing In Any Format

If you have issues with citing sources and referencing, you need not worry. Our writers are highly knowledgeable in referencing, including APA/MLA/Havard/Chicago/Turabian and all other formatting styles.

Fast Delivery And Adherence To The Deadline

All our custom papers are delivered on time, even the most urgent. If we need more time to perfect your paper, we may contact you via email or phone regarding the deadline extension.

Originality & Security

At Master Homework, your security and privacy is our greatest concern. For this reason, we never share your personal information with third parties. We use several writing tools to ensure your paper is original and free from plagiarism.

24/7 Customer Support

Our agents are online 24 hours a day, 7 days a week, and are always ready to serve you. Feel free to contact us through email or talk to our live agents whenever you need assistance with your order.

Try it now!

Calculate the price of your order

We'll send you the first draft for approval by at
Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

We work nonstop to see the best client experience.

Pricing

Flexible Pricing

We offer pocket-friendly prices that coincide with the preferred client's deadline.

Communication

Admission help & Client-Writer Contact

Our support team is always ready to ensure vital interaction between you and the writer whenever you need to elaborate on something.

Deadlines

Paper Submission

We deliver our papers early within the stipulated deadlines. We are glad to help you if there should be an occurrence of any alterations required.

Reviews

Customer Feedback

Your review, positive or negative, is of great concern to us and we take it very seriously. We are, consequently adjusting our policies to ensure the best customer/writer experience.