项目作者: danielwohlgemuth

项目描述 :
Shows the current weather from OpenWeatherMap on an LCD using a Raspberry PI
高级语言: Python
项目地址: git://github.com/danielwohlgemuth/pi-lcd-weather.git
创建时间: 2017-06-11T21:24:04Z
项目社区:https://github.com/danielwohlgemuth/pi-lcd-weather

开源协议:MIT License

下载


Pi LCD Weather

This project uses a Raspberry Pi to show the current weather downloaded from
OpenWeatherMap on an 16x2 LCD

Layout

The corresponding Fritzing file can be found in the images folder.

Raspberry Pi

Layout

Raspberry Pi 2 and 3

Layout

To check if the display was connected correctly the simple_lcd.py script can be used.
It contains just the minimal configuration to show a message on the display.

Final result

Final result

Setup

The initial configuration of this project can be made by running the setup.sh script file with

  1. source setup.sh

It installs the virtualenv package, if its missing, creates a virtual environment
and install the dependencies listed in requirements.txt.

A systemd unit file is copied to /etc/systemd/system/pi-lcd-weather.service,
which points to the current project location, it then gets enabled to start on boot
and is then started.

The config.ini file contains the OpenWeatherMap API key, a city ID
and the temperature measure unit. The API key can be obtained
here. The city ID can be extracted from the url
after searching and selecting a city here.
Possible values for temperature measure units are metric (for Celsius) and
imperial (for Fahrenheit)
The config.ini file is created if its missing.

If the setup was done with setup.sh, the program can be started with

  1. sudo systemctl start pi-lcd-weather.service

or restarted after a change with

  1. sudo systemctl restart pi-lcd-weather.service

It can also be started by activating the virtual environment first and then executed with

  1. source venv/bin/activate
  2. python lcd.py

Errors are logged into lcd.log

Sources: