Close
0%
0%

PiClock - A Raspberry Pi Clock & Weather Display

This project is a fancy Clock and weather display built around a monitor and a Raspberry Pi.

Similar projects worth following
The PiClock is a clock (duh), weather forcast, and radar map display based on the Raspberry Pi and a display monitor. The display monitor is assumed to be an HDMI monitor, but it will probably (possibly) work with the composite output as well, but this is not a design goal.

The main program (Clock/PyQtPiClock.py) will also run on Windows, Mac, and Linux, as long as python 2.7+ and PyQt4 is installed.

The Weather data comes from DarkSky using their API ( https://darksky.net/dev/ ). The maps are from Mapbox ( https://mapbox.com ) or Google Maps.

The PiClock can be customized with several supported additional things:
* RGB LED strips (NeoPixel) to create an ambilight effect
* gpio buttons for changing the view
* IR Remote Control for changing the view
* Streaming the NOAA weather radio

Introduction

The PiClock is a clock (duh), weather forcast, and radar map display based on the Raspberry Pi and a display monitor. The display monitor is assumed to be an HDMI monitor, but it will probably (possibly) work with the composite output as well, but this is not a design goal. The main program (Clock/PyQtPiClock.py) will also run on Windows, Mac, and Linux, as long as python 2.7+ and PyQt4 is installed.

The Weather data comes from DarkSky using their API ( http://darksky.net/dev/ ).  The maps are from Google Maps API.  You must get API Keys from DarkSky and Google in order to make this work.  It is free for low usage such as this application.

The Weather data comes from OpenWeatherMap or Tomorrow.io.  The maps are from Google Maps API or Mapbox.  You must get API Keys from OpenWeatherMap or Tomorrow.io and Google or Mapbox in order to make this work.  It is free for low usage such as this application.

The PiClock can be customized with several supported additional things:

  • RGB LED strips (NeoPixel) to create an ambilight effect
  • gpio buttons for changing the view
  • IR Remote Control for changing the view
  • Streaming the NOAA weather radio stream for your area

The power usage I've measured is about 35watts with a 19" HDMI Monitor, 27 LEDs and the Pi. The LEDs contributed 3 or so watts, and I think the Pi is about 2-3 Watts normally.

This is the basic PiClock, with some options added. PiClock Picture

I chose to remove the plastic frame from my monitor and mount the Pi directly on it, as well as tap power from the display's power supply. PiClock Pi Mounting

I've made it work on multiple platforms and form factors. PiClock Pi Mounting

And I've made some for friends and family with different customizations. PiClock Pi Mounting

Overview on GitHub

There's an overview, install guide and hardware guide along with the source on GitHub. https://github.com/n0bel/PiClock/blob/master/Documentation/Overview.md

PiClocks have been successfully built and proudly displayed around the world by many people. Some examples can be seen on closed github issues, as well as my public facebook page. I can't tell how many PiClocks are out there. The github page shows 123 forks and 395 stars. Here on Hackaday.io, there are almost 273 skulls (likes) 158,000 views and over 2,000 followers. As well as 189 comments in the form of questions and answers.

I try to answer questions mostly on github, open new issues here: https://github.com/n0bel/PiClock/issues.

I've made several PiClocks for friends and family. A few friends have made their own as well.

Maybe you'd like to give it a try.

Here are some successful PiClock build pictures.

Craig Moench


blboyd



Micheal Jacques


  • 1 × A Raspberry Pi (revision 2) Model B, or B+ or Pi 2 Model B or Pi 3 or Pi Zero
  • 1 × A Display Monitor & Cable
  • 1 × 5V Power Supply (for Pi) Power Supply (or if you're ambitious tap your display power supply, you'll probably need a switching down regulator to 5v) Remember the Pi likes something that can source up to 2A.
  • 1 × A USB Keyboard and Mouse for setup (if you want something small and semi-permanent, I've had good luck with this: https://www.google.com/search?q=iPazzPort+2.4G+Mini+Wireless+Keyboard I like the one with the mousepad on the side)
  • 1 × USB Wifi or Internet Connection

View all 10 components

View all 23 project logs

View all instructions

Enjoy this project?

Share

Discussions

marathonpc wrote 11/14/2016 at 19:13 point

Recently, on 2 separate installs of pi clock, the weather icon in the top left has disappeared, no changes have been made on either install.. thoughts?

  Are you sure? yes | no

Kevin Uhlir wrote 11/22/2016 at 06:41 point

It is possible they changed the condition icon name.  Is this in the usa?

  Are you sure? yes | no

marathonpc wrote 11/22/2016 at 11:52 point

Thanks for the info, is there a way to see what icon is being called for the current weather?

  Are you sure? yes | no

marathonpc wrote 11/22/2016 at 12:31 point

I made a small change to the Lat and Long and this corrected the issue.

  Are you sure? yes | no

zipidy66 wrote 11/13/2016 at 05:31 point

Great work on the PiClock, I have just got it all up and running and looks great. I am putting it into my vehicle and was wondering hard hard it would be to have the location updated automatically from a NMEA GPS signal on the Pi's serial port.

  Are you sure? yes | no

Kevin Uhlir wrote 11/22/2016 at 06:43 point

Someone with experience with serial ports on the pi, and python, would probably find it easy.  Others may find it difficult.

  Are you sure? yes | no

mike wrote 11/02/2016 at 00:11 point

Is there a reference to the font specification for the digital clock output? I have a zombie themed piclock and a zombie font I would like to use only for the clock portion. 

I have added a somafm.com channel instead of noaa since there doesnt seem to be a noaa channel close to me....more enjoyable to listen to:)

  Are you sure? yes | no

Kevin Uhlir wrote 11/02/2016 at 16:05 point

Pretty much every setStyleSheet on all the widgets use "font-family:sans-serif;"   Thats what you'd change.    clockface.setStyleSheet near line 893.  I've not tried to add fonts to the Pi, so I can't give you direct instructions how to do it.  But once you've accomplished adding fonts, then you'd reference it with font-family in the style sheet.

  Are you sure? yes | no

Patrick Woods wrote 01/24/2017 at 17:29 point

Worked great for me.  Line 897. - I added a Truetype font called Digital-7 which works well.  Thanks!

#clockface { background-color: transparent; font-family:Digital-7;" 

  Are you sure? yes | no

mike wrote 11/01/2016 at 21:35 point

Had fun with this project

  Are you sure? yes | no

yasha.sinitski wrote 09/28/2016 at 13:28 point

Followed your instructions and it ended up perfect. Many thanks Kevin! I now have a wall mounted information display right to my bed :)

  Are you sure? yes | no

Kevin Uhlir wrote 09/03/2016 at 06:29 point

A PiClock of a different flavor?


I subscribe to http://www.hackerboxes.com Every month they send me a box of "stuff". My main reason for doing this is because I'm exposed to some random parts, some of which I've not seen before, and may find useful. 


This month's Hackerbox included an Orange Pi Lite. They included instructions and parts for
an lcd display and a push button thingy, and other things to get you started.


Well of course I didn't bother with that, and simply went straight to my PiClock. After burning an SD card (with armbian), a few minutes fussing and searching how to connect to my WiFI, and then a few more minutes of apt-get's the PiClock main program was up and running.

Question? Should I target the Orange Pi series of boards as an alternative PiClock platform? Orange Pi Lite (Wifi): $12USD+shipping from AliExpress ($20USD Amazon). Orange Pi One (Ethernet) $10USD+shipping from AliExpress ($17USD Amazon).

  Are you sure? yes | no

Chris Muncy wrote 08/29/2016 at 19:46 point

lol I thought you were talking about a file name. Sorry.

  Are you sure? yes | no

Chris Muncy wrote 08/29/2016 at 19:39 point

Kevin,

Maybe my old eyes are failing me but where is qtstart?

  Are you sure? yes | no

Kevin Uhlir wrote 08/29/2016 at 19:43 point

Doesn't your editor have a search function?

Just before class Radar()

Line 294

  Are you sure? yes | no

Chris Muncy wrote 08/29/2016 at 17:29 point

Wakeup Kevin!

Where can I change the code so the side by side radar images show first?

  Are you sure? yes | no

Kevin Uhlir wrote 08/29/2016 at 18:35 point

At the bottom of qtstart:

    nextframe(1)

diff --git a/Clock/PyQtPiClock.py b/Clock/PyQtPiClock.py

index 7e88ed0..beeeff5 100644
--- a/Clock/PyQtPiClock.py
+++ b/Clock/PyQtPiClock.py
@@ -292,6 +292,7 @@
     temptimer.timeout.connect(gettemp)
     temptimer.start(1000*10*60+random.uniform(1000,10000))
     
+    nextframe(1)
 
 class Radar(QtGui.QLabel):

  Are you sure? yes | no

mbrocher303 wrote 08/07/2016 at 08:05 point

Awesome, that was just the ticket. Appreciate the help!

  Are you sure? yes | no

theballisback wrote 08/06/2016 at 22:35 point

hi there! Came across this project on Lifehacker and couldn't wait to try it. Ive run into an odd problem though. Whenever I input my latitude / longitude, and API keys, everything works fine. But none of that info is being saved. When I go back into the Configs, all the info has been reset. I re-input the localization info for the maps and such, load the clock and it's just like it should be. But if I reboot, all the info once again resets and I have to do it all over again.

  Are you sure? yes | no

Kevin Uhlir wrote 08/07/2016 at 05:41 point

I've never ran into that at all.  Perhaps the SD card is bad or write protected?  Does the config file disappear, or is it the one you copied?   Are you doing reboot with sudo reboot, and not just pulling the power?

  Are you sure? yes | no

theballisback wrote 08/27/2016 at 07:19 point

It turned out that the SD card went bad. Replaced it and got it running! For NOAA, do I just copy the the mp3 URL? The "stock" address works just fine, but when I enter a different address, nothing plays.

  Are you sure? yes | no

Kevin Uhlir wrote 08/27/2016 at 15:27 point

Yes you just replace the mp3 url.   Check that your new url woks in a browser or an internet audio player first.

  Are you sure? yes | no

mbrocher303 wrote 08/06/2016 at 15:23 point

Is there anyway to adjust the font sizes? I'm currently running the PiClock on a 3.5 touchscreen and some of the text is absolutely tiny. Thanks in advance and keep up the good work, this is one of my favorite projects!

  Are you sure? yes | no

Kevin Uhlir wrote 08/06/2016 at 17:00 point

There is no global variable that modifies font size.

You could try fontattr = 'font-weight: bold;' in the  Config.py.   fontattr is added to every qss string on all text.   But since all text uses the same variable, it affects everything. which is to say that setting font size won't work well.

Font sizes are set as part of the QSS strings in PyQtPiClock.py, and computed based on the x and y resolution of the screen. They look something like 

<code>

font-size: "+str(int(50*xscale))+"px;

</code>

So you'd have to touch each one of those to adjust the font size.

I'm totally surprised you can see anything at all on the 3.5" screen, there's just not enough dots.  But perhaps trying those ideas may work.

  Are you sure? yes | no

mbrocher303 wrote 08/07/2016 at 05:34 point

Thanks for the tips! That certainly helped me squeeze a few more dots in there. My next question is would it be possible to split the sun rise/set times and moon phase onto separate lines?

  Are you sure? yes | no

Kevin Uhlir wrote 08/07/2016 at 05:38 point

You can try.. just put a \n in the string that is put together... look for sunrise in the code.

  Are you sure? yes | no

colonia27 wrote 07/22/2016 at 21:57 point

Me again Kevin, sorry, but can't reply to your last post.

To make sure it's not my ISP I tethered my phones network, same problem.

But using e.g. New York for lat/long works fine. Could this be due to some sort of problem on the wundermap side? As said, the first few hours everything was good. For now I can live with non-moving rainclouds :-) Everything else, like temperature, etc works perfekt.

Thank you very much for your help

  Are you sure? yes | no

Kevin Uhlir wrote 07/22/2016 at 22:21 point

If you shoot me your config at n0bel at n0bel.net, i'll see what i get here.

  Are you sure? yes | no

colonia27 wrote 07/22/2016 at 06:57 point

Great project there, Kevin. Followed your guide and installed everything (except for the sensor stuff) on my pi. Everything worked fine untill suddenly the radar stopped moving. Already cleared everything and pulled a new copy from git, configured it but the problem remains. Any ideas?

  Are you sure? yes | no

Kevin Uhlir wrote 07/22/2016 at 19:49 point

Just the radar, or more likely all weather data?

My experience would tend to point to  a poor wifi connection.  The underlying http request stack in pyqt doesn't deal well with retrying, so it doesn't, it just stops.  I've also had to experiment with different wifi dongles to get one that isn't flakey.   Even with that all said... My PiClock in my kitchen stops updating weather after I microwave my breakfast.  (2.4ghz ya know)

Also check to see if your weather underground api key hasn't "maxed out".  This can happen with more than one PiClock running using the same api key, since the frequency of updates is tuned to be just below the maximums imposed by weather underground.

Kevin

  Are you sure? yes | no

colonia27 wrote 07/22/2016 at 19:58 point

No it's just the radar. I'll prepare a small video tomorrow and link you to it. WiFi connection is at 100% and the dongle is one of the recommended ones for the Pi. No microwaves nearby 😀. I even reinstalled raspbian an installed piclock from scratch using a new api key. Radar still not working,still seeing yesterdays rainclouds. 

It's strange because it's been working flawlessly for a few hours and then suddenly stopped 

  Are you sure? yes | no

Kevin Uhlir wrote 07/22/2016 at 20:32 point

As an experiment, change your radar lat/long... Its possible that WU is having some troubles in an area acquiring radar information.    However you're statement "Still seeing yesterdays rainclouds", makes me think that your ISP (or something else in your internet connection) may be caching urls.   The .gifs sent by weather underground specifically tell proxies to not cache, but I've seen this kind of thing before.   Changing lat/long would also help diagnose a caching issue.

Something else to try might be to manually construct the URL for the radar .gif file, which is constructed in the function radarurl, and plug that into a browser to see if it works... well this proves rather difficult, due to the complexity of the url.. so give this a try:  

api.wunderground.com/api/yourapikey/radar/image.gif?centerlat=45¢erlon=-93&radius=50&width=300&height=275&newmaps=1&reproj.automerc=1&num=5&delay=25&timelabel=1&timelabel.y=10&rainsnow=1&smooth=1&radar_bitmap=1&xnoclutter=1&xnoclutter_mask=1&cors=1

  Are you sure? yes | no

super_ben79 wrote 07/18/2016 at 16:53 point

not sure if i do anything wrong. this is the only thing shows up. nothing else happens

 sh startup.sh

numid=1,iface=MIXER,name='PCM Playback Volume'  ; type=INTEGER,access=rw---R--,values=1,min=-10239,max=400,step=0  : values=400  | dBscale-min=-102.39dB,step=0.01dB,mute=1sudo httpserver on port  48213

  Are you sure? yes | no

Kevin Uhlir wrote 07/19/2016 at 03:39 point

I'm guessing you're running sh startup.sh from either ssh or a serial connection.   The command given must be run in a terminal session in the rapspi gui.

  Are you sure? yes | no

super_ben79 wrote 07/19/2016 at 09:59 point

Hi, I also added the job below in crontab but nothing happened as well

@reboot sh /home/pi/PiClock/startup.sh

  Are you sure? yes | no

Kevin Uhlir wrote 07/19/2016 at 22:00 point

check the log files in the Clock directory. PyQtPyCLock.x.log  I'm sure some clue will be in there.

  Are you sure? yes | no

Simon wrote 07/13/2016 at 10:31 point

Hi - great project - I have everything working..... except the API key for Google maps!   If I leave the key empty (as you suggest) it works fine but when I go get a key I don't get any maps (just a grey square).  Any thoughts on what I'm doing wrong?  I've tried creating new keys  both 'Browser keys' and 'Server keys' but none seem to work.

  Are you sure? yes | no

Rick wrote 07/08/2016 at 10:07 point

Kevin, I've tried everything and can't get the maps to load in the background of the Radar boxes. I see the rain clouds and they move, but the boxes are gray. The api key is perfect no spaces. I've tried it with and without the key. I saw someone else posted the same issue, but never saw if it was resolved.

  Are you sure? yes | no

Kevin Uhlir wrote 07/09/2016 at 15:55 point

Firstly leave the google api key as an empty string  (''),
as in the original example, you don’t need to use an api with the low usage
that the program uses.

Try some troubleshooting….

Here’s the google maps URL for London.

http://maps.googleapis.com/maps/api/staticmap?center=51.5286416,-0.1015987&zoom=7&size=640x480&maptype=hybrid&markers=51.5286416,-0.1015987

And new york

http://maps.googleapis.com/maps/api/staticmap?center=40.7128,-74.0059&zoom=7&size=640x480&maptype=hybrid&markers=40.7128,-74.0059

Does it work for you in a browser?

So next try substituting your latitude/longitude again using
your browser…

(change the 51.5286416,-0.1015987 to your lat/long)

Also double check the values in your config for center , zoom,
and location.

  Are you sure? yes | no

Canonmasta wrote 05/16/2016 at 19:51 point

Another one Kevin (i'm your worst nightmare, i know, i know)

This time is the 'inside the house' temperature sensor.

Everything is connected and working.

As you can see it reads like that:

pi@raspberrypi:~ $ sudo modprobe w1-gpio

pi@raspberrypi:~ $ sudo modprobe w1-therm

pi@raspberrypi:~ $ cd /sys/bus/w1/devices/

pi@raspberrypi:/sys/bus/w1/devices $ ls

28-80000003689c  w1_bus_master1

pi@raspberrypi:/sys/bus/w1/devices $ cd 28-80000003689c

pi@raspberrypi:/sys/bus/w1/devices/28-80000003689c $ cat w1_slave

96 01 ff ff 7f ff ff ff a3 : crc=a3 YES

96 01 ff ff 7f ff ff ff a3 t=25375

pi@raspberrypi:/sys/bus/w1/devices/28-80000003689c $ cat w1_slave

9a 01 ff ff 7f ff ff ff 9c : crc=9c YES

9a 01 ff ff 7f ff ff ff 9c t=25625

pi@raspberrypi:/sys/bus/w1/devices/28-80000003689c $ cat w1_slave

9a 01 ff ff 7f ff ff ff 9c : crc=9c YES

9a 01 ff ff 7f ff ff ff 9c t=25625

As you can see the sensor is reading and giving 25.6 degrees celsius

Now is time to make it work on the PiClock and when i try to start the clock it gives me those errors:

Traceback (most recent call last):

File "TempServer.py", line 7, in <module>

from w1thermsensor import W1ThermSensor

ImportError: No module named w1thermsensor

The PiClock works but the inside temperature don't show data

Any help?

Thank you again!

  Are you sure? yes | no

Kevin Uhlir wrote 05/18/2016 at 15:18 point

You didnt perform this step in the instructions:

Get the DS18B20 Temperature driver for Python (optional)
(you must still be root [super user])
git clone https://github.com/timofurrer/w1thermsensor.git && cd w1thermsensor
python setup.py install

  Are you sure? yes | no

Canonmasta wrote 05/18/2016 at 15:53 point

ups. I swear i've done it!

I'll done it again. Thank you Kevin.

  Are you sure? yes | no

Canonmasta wrote 05/18/2016 at 16:32 point

Solved. I had to do it step by step instead of using && command. But now the problem is that it gives me Fahrenheit instead of Celsius. Hints? Thank you Kevin

  Are you sure? yes | no

Canonmasta wrote 05/10/2016 at 20:35 point

I Kevin. It works! Shows the forecast shows the maps but it don't show the rain clouds (right now here in Spain is raining like hell) I left Minnesota on the last radar square and it really shows rain clouds there. Any hint? Thank you for your patience

  Are you sure? yes | no

Canonmasta wrote 05/11/2016 at 14:17 point

Kevin, Is possible to show just the satellite instead of the radar? i think it would fix the issue for me. Tell me how to change the API parameters and i'll try to implement it. Thanks!

  Are you sure? yes | no

Kevin Uhlir wrote 05/18/2016 at 15:23 point

In PyQtPiclock.py there is a line that says:

return (Config.wuprefix+ApiKeys.wuapi+'/animatedradar/image.gif'+

you can try changing /animatedradar/ to /animatedsatellite/  This documentation is contained within the weather underground API documentation:  https://www.wunderground.com/weather/api/d/docs?d=index

  Are you sure? yes | no

Kevin Uhlir wrote 05/12/2016 at 03:43 point

It won't show rain clouds, but it will show rain.   What you see on the radar is completely dependent on weather underground.   Does weather underground radar maps work for your location?   https://www.wunderground.com/cgi-bin/findweather/getForecast?query=madrid+spain

  Are you sure? yes | no

Canonmasta wrote 05/16/2016 at 18:26 point

Radar maps don't work properly for spain but Satellite maps does the trick. Is possible to retrieve satellite instead of radar? I hope that in a no long future the guys from Wunderground fix this but for the moment... Thank you Kevin.

  Are you sure? yes | no

Canonmasta wrote 04/17/2016 at 21:34 point

kevin, thank you very much for this project. It's fun and is helping me a lot to understand linux and the raspberry way of doing things. While the screen I've purchased is coming I'm configuring all the project carefully. The problem came with the first boot: 

pi@raspberrypi:~/PiClock $ sh startup.sh
numid=1,iface=MIXER,name='PCM Playback Volume'
  ; type=INTEGER,access=rw---R--,values=1,min=-10239,max=400,step=0
  : values=400
  | dBscale-min=-102.39dB,step=0.01dB,mute=1
sudo: Button/gpio-keys: command not found
Started httpserver on port  48213
pi@raspberrypi:~/PiClock $

As I told I'm a newby on raspberry and I need a little help here. Thank you in advance

  Are you sure? yes | no

Kevin Uhlir wrote 05/01/2016 at 20:45 point

Button/gpio-keys: command not found is caused by missing this step:

chmod +x PiClock/Button/gpio-keys

The rest of the lines there are not errors.

startup.sh assumes you're running from the pi desktop.  The clock PyQtPiClock.py won't find the display if you run it from ssh, or tty.

If you put

@reboot sh /home/pi/PiClock/startup.sh

in your crontab (its in the instructions too), and simply reboot, things should work also.

  Are you sure? yes | no

Canonmasta wrote 05/01/2016 at 20:51 point

Thank you. i'll give it a try!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates