Raspberry Pi Clock with Temperature

This project is for a building a digital clock that includes temperature display. It uses OpenWeatherMap to retrieve outside temperature information and a MCP9808 sensor for inside temperature. The assembly is fairly simple and requires the following components:

Raspberry Pi Clock with Temperature


This guide assumes the Raspberry Pi is already setup with a working internet connection. First, make sure all the common dependencies have been installed:

Time Configuration

For the clock to be accurate the local time of the Raspberry Pi will need to be correct. First make sure the time zone is set correctly:

Then make sure the time is being updated correctly by installing ntpd:

The default NTP configuration should be good enough, but can be modified to specify the time server by editing /etc/ntp.conf.


PyOWMClock uses OpenWeatherMap to retrieve temperature data for our clock. An OWM API key will be required, but the free tier is sufficient.

The pyowmclock.py script uses the excellent OWM wrapper library, PyOWM and can be installed using pip.


If you haven't already, clone the pyowmclock project:

The pyowmclock.py script takes several command-line arguments, use -h to show the usage:

The –api_key and –zip-code arguments are required, but the others are optional. By default the script will display temperature in Celsius, so use –use_f 1 for Fahrenheit. The –display option is the time in seconds between flipping between time and temperature display; the default is 5 seconds. The –weather option is the time between temperature updates from both OWM and the temperature sensor; the default is 300 seconds (5 minutes).


Using the default display and weather intervals but Fahrenheit display for us here in the US:

Read more: Raspberry Pi Clock with Temperature

About The Author

Ibrar Ayyub

I am an experienced technical writer with a Master's degree in computer science from BZU Multan University. I have written for various industries, mainly home automation, and engineering. I have a clear and simple writing style and am skilled in using infographics and diagrams. I am a great researcher and is able to present information in a well-organized and logical manner.

Scroll to Top