Digital Thermostat and Data Logger Brandon Wagner and David Southwick.

7
Digital Thermostat and Data Logger Brandon Wagner and David Southwick

Transcript of Digital Thermostat and Data Logger Brandon Wagner and David Southwick.

Page 1: Digital Thermostat and Data Logger Brandon Wagner and David Southwick.

Digital Thermostat and Data Logger

Brandon Wagner and David Southwick

Page 2: Digital Thermostat and Data Logger Brandon Wagner and David Southwick.

Schematic ATmega88PA

MAX232 Level Shifter 5V to 15V

PCF8583 Real Time Clock

LM34 precision Fahrenheit Sensor 10 mv/ °F

24LC256 EEPROM 32K x 8 storage

EVE-GA1F2012B Rotary Pulse Generator

GDM1602K 2x16 LCD

2 LEDs

Pushbutton Switch

I2C Serial CLK

I2C Serial DATA

ADC0 pin

Page 3: Digital Thermostat and Data Logger Brandon Wagner and David Southwick.

Features Current Time and Temperature display

Fahrenheit and Celsius User selectable threshold temperature

0.1° F precision via RPG rotation Heating mode or A/C mode

H – Heating mode Red LED active

when temp below threshold A – A/C mode

Green LED active when temp above threshold

Temperature data logger with time stamp Stores temperature in EEPROM on a user selected

interval Serial interface to computer terminal Commands:

“T” – Time change request “D” – Date change request “H” – Temperature history request “C” – Change storage interval

Actual Temp (F)

Actual Temp (C)

User Desired Temp

Current Time

Mode - Heat- A/C

Page 4: Digital Thermostat and Data Logger Brandon Wagner and David Southwick.

Temperature Logging

0.492881944444444 0.510706018518518 0.528287037037037 0.046111111111111176.5

77

77.5

78

78.5

79

Temperature Vs. Time

Temp

Terminal - Enter “H”

Import data to EXCEL

Use EXCEL to plot Temp vs Time

Page 5: Digital Thermostat and Data Logger Brandon Wagner and David Southwick.

Software Initialize/Configure USART, LCD, I2C, ADC, and Timers Determine RPG rotation

Increment or Decrement desired temperature setting Check pushbutton

Toggle heat or A/C mode Update LED outputs

If A/C mode: activate green LED if desired temp < actual temp If heat mode: activate red LED if desired temp > actual temp

If (Timer0 flag set) – set every second Read ADC register Convert to value to Fahrenheit and Celsius Read RTC for date and time Update LCD with actual and desired temp, mode, and time

If (Timer1 flag set) – set every user defined number of minutes Format temperature and time/date from RTC into a string Write data string to EEPROM

Process any input from USART “H” - Read data from EEPROM “T”, “D” - Write to data to RTC

Page 6: Digital Thermostat and Data Logger Brandon Wagner and David Southwick.

Analog to Digital Converter

ADC =VIN ×1024

VREF

VREF = Internal 1.1 V

ADC Channel Select = ADC0

ADC Enable

Start Conversion

Conversion Complete INT Flag

Freq Prescaler: 50-200 kHzChoose 8MHz/128 = 125 kHz

1 1 0 0 0 0 0 0

1 1 0 1 1 1 1 0

Resolution = 1.1V / 1024 = 1.074 mV=> ADC value of 1 = 1.074 mV

LM34 outputs 10 mv / °F

Example: Temperature is 74.8 °F => Sensor outputs 74.8 x 10 mV = 0.748 V

ADC =0.748V ×1024

1.1V= 696.32

Convert back to °F: 696.32 x 1.074 = 747.8 display “74.7°F”

ADC INT Enable

Page 7: Digital Thermostat and Data Logger Brandon Wagner and David Southwick.

Demonstration