Arduino: Simple LCD Thermometer with USB interface

From Luky-Wiki
Revision as of 19:45, 26 March 2014 by Lukas Dzunko (talk | contribs) (Version)

Jump to: navigation, search

Attention: this page is work in progress.

My motivation for "Simple LCD Thermometer with USB interface" is my server room. It is important to keep temperature and humidity in correct range. I am using automatic monitoring to be sure that everything is in "green" state. Previously I was using Conrad TFD 128 logger. It is good product but it have several design problems. To fulfill my needs I created my own device.

Technical specification

  • Temperature and humidity collected in 10 second interval
  • LCD interface with warnings (hot/cold, wet/dry)
  • LCD interface with 5 tactile keys
  • History and diagnostic information on LCD
  • USB interface with simple text oriented protocol
  • Historical data stored in RAM memory readable via LCD and USB interface
  • Historical data with 5 minute interval (up to 60 minutes) and 1 hour interval (up to 72 hours)
  • Minimum and Maximum values
  • Temperature range: +1C - +50C, Resolution 0.1C
  • Humidity range: 1% - 99%, Resolution: 1% (display), 0.1% (USB)
  • Internal mCPU temperature monitoring
  • TODO: ranges (temperature 20-25C, humidity 40-70%, dew point: 10 - 16C)
  • TODO: buzzer ?

LCD Interface

Temperature sensor need at least two seconds to settle down. This make space to display reboot source. If it is necessary to wait, then it is possible to use this time to show why device was rebooted.

Startup screen stay for approximately 3 seconds and then device move to "Normal screen". If there is no activity for 60 seconds then device automatically move back to "Normal screen".

Blinking text indicate out of range condition (hot/cold, wet/dry, reading out of range).

Note: all display examples use illustration values. For more details check ranges in technical specification.

Startup screen

Displayed up on device reboot. Indicate source of reboot.

+----------------+ +----------------+ +----------------+ +----------------+
|Please wait ... | |Please wait ... | |Please wait ... | |Please wait ... |
|(Watchdog)  WDRF| |(Brown-out) BORF| |(External) EXTRF| |(Power-on)  PORF|
+----------------+ +----------------+ +----------------+ +----------------+

Normal screen

Displayed during "normal" operation. First two characters on second line show device status:

  • position 1: "heart" show sensor / device activity (♡ is altering with ♥ after each successful sensor read).
  • position 2: "arrows" indicate USB activity (⇅ pop up if there is USB activity).
+----------------+ +----------------+ +----------------+
|T: 21.3C H: 50% | |T: 28.8C H: 90% | |T: 10.2C H: 10% |
|♡⇅   NORM   NORM| |♥⇅   HOT    WET | |♡⇅   COLD   DRY |
+----------------+ +----------------+ +----------------+

Dew point

+----------------+ +----------------+ +----------------+
|Dew point: 14.1C| |Dew point: 20.2C| |Dew point:  9.1C|
|     Comfortable| |        Too high| |         Too low|
+----------------+ +----------------+ +----------------+

History + min/max

Minimum/Maximum and value from past (history) is indicated in left down corner of screen.

Temperature and humidity:

+----------------+ +----------------+ +----------------+ +----------------+
|T: 21.3C H: 50% | |T: 21.3C H: 50% | |T: 21.3C H: 50% | |T: 21.3C H: 50% |
|-05m NORM   NORM| |-55m NORM   NORM| |-01h NORM   NORM| |-72h NORM   NORM|
+----------------+ +----------------+ +----------------+ +----------------+

+----------------+ +----------------+
|T: 20.0C H: 30% | |T: 25.0C H: 30% |
|MIN  NORM   NORM| |MAX  NORM   NORM|
+----------------+ +----------------+

Dew point:

+----------------+ +----------------+ +----------------+ +----------------+
|Dew point: 14.1C| |Dew point: 14.1C| |Dew point: 14.1C| |Dew point: 14.1C|
|-05m Comfortable| |-55m Comfortable| |-01h Comfortable| |-72h Comfortable|
+----------------+ +----------------+ +----------------+ +----------------+

+----------------+ +----------------+
|Dew point: 12.1C| |Dew point: 16.1C|
|MIN  Comfortable| |MAX  Comfortable|
+----------------+ +----------------+ 

Diagnostic screen

System support following diagnostic screens:

+----------------+ +----------------+ +----------------+ +----------------+ +----------------+
|Diag: uptime    | |Diag: history   | |Diag: history   | |Diag: CPU temp  | |Diag: version   |
|    123d 21h 45m| |  m: 30  h: 20  | |  m: ok  h: ok  | |                | |Sys: AA Boot: AA|
+----------------+ +----------------+ +----------------+ +----------------+ +----------------+

From left to right:

  • device uptime
  • position of first unknown history data (due to sensor problem or device reboot). "m" is for minute history and "h" for hour history.
  • all history data valid
  • internal CPU temperature (approximate)
  • system and bootloader version

Screen position

Screen can be selected by tactile keyboard and position of screens are following:

                     +----------------+   +----------------+
                     |T: 25.0C H: 50% |   |Dew point: 16.1C|
                     |MAX  NORM   NORM|   |MAX  Comfortable|
                     +----------------+   +----------------+
                             ↑ ↓                  ↑ ↓       
                     +----------------+   +----------------+
                     |T: 20.0C H: 30% |   |Dew point: 12.1C|
                     |MIN  NORM   NORM|   |MIN  Comfortable|
  Device boot-up     +----------------+   +----------------+
        ↓ ↓                  ↑ ↓                  ↑ ↓       
+----------------+   +----------------+   +----------------+   +----------------+
|Please wait ... | → |T: 21.3C H: 50% | → |Dew point: 14.1C| → |Diag: uptime    | →
|(Power-on)  PORF| → |♡⇅   NORM   NORM| ← |     Comfortable| ← |    123d 21h 45m| ← all other diag screens
+----------------+   +----------------+   +----------------+   +----------------+
                             ↑ ↓                  ↑ ↓       
                     +----------------+   +----------------+
                     |T: 21.3C H: 50% |   |Dew point: 14.1C|
                     |-05m NORM   NORM|   |-05m Comfortable|
                     +----------------+   +----------------+
                             ↑ ↓                  ↑ ↓       
                       history up to        history up to 
                          72 hours             72 hours
                       for temperature     for dew point
                        and humidity

If there is no action for 60 seconds then screen move back to "Normal screen".

Serial (USB) interface

Device use virtual serial port over USB. Protocol is text oriented and request is made by sending upper case character. All undefinied characters are silently ignored. Additional requests are ignored while device is sending response. Configuration of serial port is 9600, 8-N-1, HW: no. Device send blank (space) character before responding to query.

Format of response

Example: TEMP: 12.3C, HUM: 70.1%, 1 *CC

  • all values are send in format: "type: value unit"
  • more values in one message are separated by coma (,)
  • last value is message sequential id. Number from 0 to 3.
  • CRC is separated by asterisk (*) and is calculated as simple 8bit CRC

Message id start at 0. Increment sequentially to 3 and then wrap around to 0. This ensure that each message is unique even when temperature / humidity reading result in same number.

Commands / data query

Version

V -> Sys: AA, Boot: AA, 0 *CC

Reboot

Temperature / Humidity

Temperature only

Humidity only

Dew point

Alarms

History

Minimum / Maximum + clear

Diag

Internal details

Physical connections

Timer (wall clock)

Scheduler

Serial interface

Display

Sensor reading