logo Hurry, Grab up to 30% discount on the entire course
Order Now logo
827 Times Downloaded

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Jeremiah BennetttEconomics
(5/5)

613 Answers

Hire Me
expert
M. HilliardNursing
(5/5)

868 Answers

Hire Me
expert
Chris EldredgriggMathematics
(5/5)

643 Answers

Hire Me
expert
HimanshuComputer science
(/5)

883 Answers

Hire Me
R Programming
(5/5)

In this project, we will build a thermostat. A thermostat is a device that controls a heater, an air conditioner,

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Overview

In this project, we will build a thermostat. A thermostat is a device that controls a heater, an air conditioner, and a fan so as to keep the temperature within a certain range. Since we don’t have a heater, an air conditioner, or a fan, we’ll turn on a red LED to represent turning on the heat, a blue LED to represent turning on the air conditioner, and a green LED to represent turning on the fan.

Here are the basic rules governing the operation of our thermostat:

 

If the temperature is below the desired range, turn on the heater and the fan.

If the temperature is above the desired range, turn on the air conditioner and the fan.

If the temperature is within the desired range, turn off any of the air conditioner, heater, and fan that are on.

 

We’ll also have two buttons to change the desired temperature range. Pressing the first will shift both endpoints of the desired temperature range up by one degree. For example, if the current range is between 20 and 25 degrees Celsius, pressing this button will shift the desired range to between 21 and 26 degrees Celsius. Pressing the second button will similarly shift both endpoints of the range down by a degree.

Note that the heater and the air conditioner should never be on at the same time. Also, whenever either the heater or the air conditioner is on, the fan should also be on.

 

Wiring

First, we’ll work on the wiring for this project. Do not remove the wiring and devices you used for Project 1. The projects for CS0010 are designed such that you will not need to remove any wiring from past projects, allowing you to run all of the programs you have written so far throughout the term without re-wiring.

With Pi Cobbler plugged in to d1-20 and h1-20 (GPIO pin 21 on h20):

 

black wire from a20 (GND on the Pi Cobbler @d20) to Neg rail

560 Ohm resistor (Green, Blue, Brown, Gold) from Neg rail to a30

 

red LED short leg (cathode) to e30 (to resistor/Neg rail), long leg (anode) to f30 (to red wire/GPIO pin 21)

red wire from j20 (GPIO pin 21 @h20) to j30

560 Ohm resistor (Green, Blue, Brown, Gold) from Neg rail to a35

blue LED short leg (cathode) to e35 (to resistor/Neg rail), long leg (anode) to f35 (to blue wire/GPIO pin 12)

blue wire from j16 (GPIO pin 12 @h16) to j35

560 Ohm resistor (Green, Blue, Brown, Gold) from Neg rail to a40

green LED short leg (cathode) to e40 (to resistor/Neg rail), long leg (anode) to f40 (to green wire/GPIO pin 25)

green wire from j11 (GPIO pin 25 @h11) to j40

purple wire from a1 (3.3V power @d1) to Pos rail

BME280 e45-e51 (VIN @e45, CS @e51)

purple wire from Pos rail to a45 (VIN @e45)

black wire from Neg rail to a47 (GND @e47)

orange wire from a48 (SCK @e48) to a3 (SCL @d3)

yellow wire from a50 (SDI @e50) to a2 (SDA @d2)

white wire from j3 (GND on the Pi Cobbler @h3) to other Neg Rail

button with pins in e55, e57, h55, h57

red wire from j9 (GPIO pin 24 @h9) to j55

grey wire from Neg rail to j57

button with pins in e60, e62, h60, h62

blue wire from j8 (GPIO pin 23 @h8) to j60

grey wire from Neg rail to j62

 

Part 1: Design a thermostat class

First, we will design a class Thermostat to represent our thermostat. Write this class in a file named thermostat.py.

Your class should include the following attributes:

 

Desired temperature range (represented by the 2 endpoints of the range)

 

An object for the each of the red, blue, and green LEDs. To do this, recall that you will need to use the LED class in the gpiozero module. You can import this class by including this line at the top of your file:

 

from gpiozero import LED

 

Recall that you can then obtain an object for the red LED (connected to GPIO pin 21) using the following code:

 

red_led =  LED(21)

The methods red_led.on() and red_led.off() turn the LED on and off, respectively. The attribute red_led.is_lit is True if the corresponding LED is lit and is False otherwise.

You can create objects for the blue LED (connected to GPIO pin 12) and green LED (con- nected to GPIO pin 25) in the same way; they will have the same attributes and methods.

An object for each of the two buttons. To do this, you will need to use the Button class in the gpiozero module. You can import this class by including this line at the top of your file:

 

(5/5)
Attachments:

Expert's Answer

827 Times Downloaded

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme