As a project I
wanted to be able to monitor the temperature in my apartment and
display it on an LCD screen. I also decided that I would also like to
simultaneously display the local city temperature.
Setup
In addition to the
BeagleBone Black I purchased from AdaFruit
AdaFruit provide two
Python libraries
For the OS I am
running the latest version of Debian wheezy
#
lsb_release -a
No
LSB modules are available.
Distributor
ID: Debian
Description:
Debian GNU/Linux 7.7 (wheezy)
Release:
7.7
Codename:
wheezy
After following the
wiring instructions from Adafruit and installing the two python
libraries as mentioned above I could display the temperature from my
Apartment on the LCD screen. The next step was to get the local
temperature in Vancouver, Canada. I looked at a few options such as
screen scraping using the Python Beautiful Soup library on the
Environment Canada website. The screen scraping did work but not
consistently. Looking around for some other options I found the
fantastic OpenWeatherMap
project, which for Canada uses Environment Canada as a data source.
There is a Python library pyowm
for OpenWeatherMap. This can be installed using pip :
# pip install pyown
From OpenWeatherMap you can register for free and obtain an API key. Using the pyowm library is relatively straight forward which then allows the data to be obtained and displayed on the LCD screen.
I have a cron job that runs every 15 minutes during the hours I want the screen to display. I posted the Python script I used on my GitHub repository in case anyone finds it a useful reference.