cmsharpe.com

Cheryl's Spot on the Web - since September 1, 1997
Now at cmsharpe.com

Adafruit Reader, version 0.8

DEPRECATED

Please use version 0.9+ instead. This version will be removed from the website in the near future.

Description

This program reads the DHT11 or DHT22 sensor from Adafruit, and provides a display of multiple values and derived values on a Raspberry Pi standard display (800x480). The display consists of the current time, the time the Adafruit sensor was read, the temperature, wet-bulb temperature, dew point temperature, relative humidity, THI, and local station pressure, if available. Beginning with version 0.8, it additionally shows a temperature/relative humidity/THI comparison scale and the equivalent relative humidity if outdoor air were heated to the indoor temperature without adding/removing water vapor. The local station pressure and outdoor air to indoor humidity features require the ability to obtain a weather report (see below).

THI, or Temperature Humidity Index, was used decades ago before the Heat Index was derived. The THI is (T + Tw) * 0.4 + 15, where T is the dry-bulb temperature (or just temperature), and Tw is the wet-bulb temperature. Comfort levels vary from person to person, but 71 is generally considered comfortable, with varying degrees of discomfort with increasing distance from that number.

Station pressure and outdoor dew point temperature (required for the indoor relative humidity equivalent) are available only in the USA and Canada. Locate the closest airport that provides a METAR with altimeter setting, and use the 4-letter identifier (for example, Will Rogers World Airport in Oklahoma City, Oklahoma, USA is "KOKC") to identify your preferred station. Also find the altitude of your sensor above mean sea level in meters. This does not have to be overly accurate, but should be within about 10 m for best accuracy. Edit Configuration.py with these values, and do not update that file with future updates (unless the update specifically instructs you to do this).

System Requirements

For setup info, see also this page, at least the section titled, "Installing the CircuitPython-DHT Library", since the library needs to be installed (pip3 and apt-install commands on that page). If you don't already have pytz, you will need to pip install pytz, too. Also, the (current version) of this program requires user customization (Configuration class—see below).

Installation

Copy the provided files into the directory of your choice (ensuring that main.py is in this directory, and the other files are in a subdirectory called adafruit_reader). Ideally, create a desktop icon set to run the following script (pointing to the main.py file—you may need to include a directory change (cd) in the script, depending on your directory structure):

python3 -m main.py

Alternatively, you can navigate to the directory with main.py, and double-click the icon for that file, then run this program from the Python editor/IDE that is associated with Python programs/scripts.

Components

You can download the files individually below, or get the Zip archive here.

Additional setup

Edit the Configuration.py file under class Configuration: as follows:

Copy this file to a safe place, and copy it back to the adafruit_reader directory whenever the Configuration.py file is overwritten by an update...or just make the same changes each time this file is updated. Note: In this version, the Configuration.py file requires a small update: see the RH COMPARISON SCALE section at the top of the file, and instructions in the list above.

Usage notes

If the program shuts down unexpectedly (not by pressing the Quit button or the window-close button), you may have to restart the Raspberry Pi in order to restart this program. If you see a response such as "unable to start input on line 4" (or something similar), try a restart.

The readings should update about every two to three seconds, and the pressure and remote dew point temperature (if these are available from a nearby airport) should update about every hour. If the pressure/dew point temperature observation becomes more than six hours old, the value will revert to standard pressure (101.32 kPa), adjusted to the provided altitude, and the outdoor-to-indoor relative humidity will become N/A.

The units button (on bottom left) is a toggle. Its label will change when it is clicked. Similarly, the precision button cycles between 0.1, 0.5, and 1 (in that order), indicating the level of rounding. If you have a DHT11, the temperature and relative humidity are limited to integer values, so normally, the precision button should be set to 1. For the DHT22, all three settings are appropriate, according to your preference.

Known Issues

(From version 0.7.1, fixed in version 0.8):

Unresolved:

License

This program is free and open-source software by Cheryl M. Sharpe. The author grants you, the user, free access to the software component(s) listed above, with the understanding that your use of the software is completely at your own risk. Although I have attempted to create a bug-free program, I am not a software corporation, and have neither the time nor the ability to debug this software thoroughly. In addition, misuse of the program, or entry of nonsense data, may provide meaningless or inaccurate results without warning. You are responsible for knowing what data are reasonable and what results are reasonable.

You are permitted to modify the code to suit your purposes. However, you are not permitted to redistribute altered code without notifying the author in advance (use the email link on the left). Sale (for any fee, for any reason) of this program is absolutely prohibited.

Finally, the author does not guarantee technical support of any kind (beyond the scope of this documentation and in-code comments) for this, or any other program - except as noted in the "About" menu item, if one is provided.