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 Features Current Time and Temperature display User selectable threshold temperature Fahrenheit and Celsius 0.1° F precision via RPG rotation H – Heating mode Green LED active when temp above threshold Temperature data logger with time stamp Red LED active when temp below threshold A – A/C mode Actual Temp (C) Heating mode or A/C mode Actual Temp (F) Stores temperature in EEPROM on a user selected interval Mode - Heat - A/C Serial interface to computer terminal Commands: “T” – Time change request “D” – Date change request “H” – Temperature history request “C” – Change storage interval User Desired Temp Current Time 11:49 11:53 11:56 11:59 12:03 12:06 12:09 12:13 12:16 12:19 12:23 12:26 12:29 12:32 12:36 12:39 12:42 12:46 12:49 12:53 12:56 12:59 1:03 1:06 1:09 1:13 1:16 1:19 1:23 Temperature Logging Terminal - Enter “H” Import data to EXCEL Temperature Vs. Time 79 78.5 78 77.5 77 76.5 Temp Use EXCEL to plot Temp vs Time Software Initialize/Configure USART, LCD, I2C, ADC, and Timers Determine RPG rotation Check pushbutton 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 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 Toggle heat or A/C mode Update LED outputs Increment or Decrement desired temperature setting 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 Analog to Digital Converter 1 1 0 0 ADC Enable 1 0 Start Conversion VIN 1024 ADC VREF LM34 outputs 10 mv / °F 1 Conversion Complete INT Flag Resolution = 1.1V / 1024 = 1.074 mV => ADC value of 1 = 1.074 mV 0 0 0 ADC Channel Select = ADC0 VREF = Internal 1.1 V 1 0 1 1 ADC INT Enable 1 0 Freq Prescaler: 50-200 kHz Choose 8MHz/128 = 125 kHz 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” Demonstration