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:
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
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
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme