Introduction: Weather Clock
Great looking desktop clock with date & weather display.
Step 1: Download and Install Software for the RaspberryPI
Download "RASPBIAN JESSIE LITE" https://www.raspberrypi.org/downloads/raspbian/
Create your new hard disk for DashboardPI
Insert the microSD to your computer via USB adapter and create the disk image using the dd command
Locate your inserted microSD card via the df -h command, unmount it and create the disk image with the disk copy dd command
$ df -h /dev/sdb1 7.4G 32K 7.4G 1% /media/XXX/1234-5678
$ umount /dev/sdb1
Caution: be sure the command is completely accurate, you can damage other disks with this command
if=location of RASPBIAN JESSIE LITE image file of=location of your microSD card
$ sudo dd bs=4M if=/path/to/raspbian-jessie-lite.img of=/dev/sdb (note: in this case, it's /dev/sdb, /dev/sdb1 was an existing factory partition on the microSD)
Setting up your RaspberriPi
Insert your new microSD card to the raspberrypi and power it on with a monitor connected to the HDMI port
Login
user: pi pass: raspberry
Change your account password for security
sudo passwd pi
Enable RaspberriPi Advanced Options
sudo raspi-config
Choose: 1 Expand File System
9 Advanced Options
A2 Hostname change it to "EnvironmentClock"
A4 SSH Enable SSH Server
A7 I2C Enable i2c interface
Enable the English/US Keyboard
sudo nano /etc/default/keyboard Change the following line: XKBLAYOUT="us"
Reboot PI for Keyboard layout changes / file system resizing to take effect
$ sudo shutdown -r now
Auto-Connect to your WiFi
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf Add the following lines to have your raspberrypi automatically connect to your home WiFi (if your wireless network is named "linksys" for example, in the following example)
network={ ssid="linksys" psk="WIRELESS PASSWORD HERE" }
Reboot PI to connect to WiFi network
$ sudo shutdown -r now
Now that your PI is finally on the local network, you can login remotely to it via SSH. But first you need to get the IP address it currently has.
$ ifconfig Look for "inet addr: 192.168.XXX.XXX" in the following command's output for your PI's IP Address
Go to another machine and login to your raspberrypi via ssh
$ ssh pi@192.168.XXX.XXX
Start Installing required packages
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install vim git python-requests python-smbus i2c-tools python-imaging python-smbus build-essential python-dev rpi.gpio python3 python3-pip libi2c-dev
Update local timezone settings
$ sudo dpkg-reconfigure tzdata select your timezone using the interface
Setup the simple directory l command [optional]
$ vi ~/.bashrc
add the following line:
$ alias l='ls -lh'
$ source ~/.bashrc
Fix VIM default syntax highlighting [optional]
$ sudo vi /etc/vim/vimrc
uncomment the following line:
syntax on
Clone Clock repository
$ cd ~
$ git clone https://github.com/khinds10/EnvironmentClock.git
Install i2c Backpack Python Drivers
$ cd ~
$ git clone https://github.com/adafruit/Adafruit_Python_LED_B...
$ cd Adafruit_Python_LED_Backpack/
$ sudo python setup.py install
DHT11 Install
$ cd ~
$ git clone https://github.com/adafruit/Adafruit_Python_DHT.g...
$ cd Adafruit_Python_DHT/
$ sudo python setup.py install
$ sudo python ez_setup.py
$ cd examples/
$ vi simpletest.py Change the following line:
sensor = Adafruit_DHT.DHT11 Comment the line out
pin = 'P8_11' Uncomment the line and change the pin number to 16
pin = 16 Run the test
python simpletest.py
You should see a metric reading of Temp and Humidity displayed on the command line.
Step 2: Supplies Needed: 1.2 Inch LED Display
Step 3: Supplies Needed: DHT11 Humidistat
Step 4: Supplies Needed: 2.6" Digole Display
Step 5: Supplies Needed: RaspberriPi Zero (or Regular RaspberriPi Should Work)
Step 6: Build and Wire the Display
Prepare the Digole Display for i2C
On the back of the Digole Display, solder the jumper to assign the display to use the i2c protocol
Step 7: Print the Project Enclosure
Using a 3D printer print the enclosure files included in the 'enclosure/' folder. .x3g files are MakerBot compatible. You can also use the .stl and .blend (Blender Program) files to edit and create your own improvements to the design.
Using 4 screws drill and attach the front panel (with the 2 holes) to the 4 sided body. Then fit the displays in each of the holes.
Step 8: Attach the 7 Segment and Digole Display Using Hot Glue Gun to Hold Them in Place.
Step 9: Prepare the Wires for Connection
I use standard jumping wires and a wire cutter to strip the wire bare in the middle of the wires so I can have a bunch connected together glued with a hot glue gun. (In the image below is my grouped together 5V / GND / SCA / and SCL wires.)
Step 10:
Begin wiring the unit using the wiring diagram below as a guide.
The 7 Segment display
D -> SDA
C -> SCL
+ -> 5v
GND -> GND
IO -> 5v
Digole Display
GND -> GND
DATA -> SDA
CLK -> SCL
VCC -> 3V
DHT11 Humidistat
VCC -> 5V
GND -> GND
DATA -> GPIO 16 / PIN 36
Step 11: Connect All the Parts Inside the Printed Case
Step 12: Connect All the Parts Inside the Printed Case
Step 13: Finish the Construction
Glue the humidistat to the back panel, and run a USB cable through the other back panel hole to power the unit. Attach the back with only 2 screws in case you need to disassemble for repair.
Step 14: Setup Startup Scripts
Configure Application to run correctly in settings.py config file
Find the file settings.py and adjust to your current settings
# forecast.io API key for local weather information
weatherAPIURL = 'https://api.forecast.io/forecast/'
weatherAPIKey = 'YOUR API KEY FOR FORECAST.IO'
# optional for running the remote temp/humidity logger
deviceLoggerAPI = 'mydevicelogger.com'
# search google to get the Latitude/Longitude for your home location
latitude = 41.4552578
longitude = -72.1665444
$ crontab -e
Add the following lines:
@reboot nohup python /home/pi/EnvironmentClock/clock.py >/dev/null 2>&1
@reboot nohup python /home/pi/EnvironmentClock/display.py >/dev/null 2>&1
Verify the display starts working on reboot
$ sudo reboot
OPTIONAL: Temp Logger to API script each 10 minutes
$ crontab -e Add the following lines:
*/10 * * * * python /home/pi/EnvironmentClock/temp-check.py
OPTIONAL: Creating your own weather images to render on the display
Upload your own 128x128 file to the following URL:
http://www.digole.com/tools/PicturetoC_Hex_convert...
Choose your image file to upload, add what size you want it to be on the screen (Width/Height)
Select "256 Color for Color OLED/LCD(1 byte/pixel)" in the "Used for" dropdown
Obtain the hex output.
Add the hex output to a display/build/ header (.h) file, use the other ones as guides for syntax.
Include the new file in the digole.c file #include "myimage.h
Include a new command line hook to your image file in the. Note: the command below is saying draw your image at position 10 pixels over 10 pixels down. You can change it to different X,Y coordinates, you can also change the values 128,128 to whatever size your new image actually is.
} else if (strcmp(digoleCommand, "myimage") == 0) { drawBitmap256(10, 10, 128, 128, &myimageVariableHere,0); // myimageVariableHere is defined in your (.h) file }
Now rebuild (ignore the errors) below to have your new image render with the following command.
$ ./digole myimage
Re-Building [Included] Digole Display Driver for your optional changes
$ cd display/build $ gcc digole.c $ mv a.out ../../digole $ chmod +x ../../digole
Step 15: Finished! (alternate White Construction)

Participated in the
Raspberry Pi Contest 2017
15 Comments
1 year ago
Could I make this smaller by displaying the clock on the display instead of having a separate seven segment display?
Reply 1 year ago
They look like this, with X,Y and color and font values set as ints.
5 years ago
I have a straight digital clock using the same display. I used the same Python clock script but have made some substantial modifications that you might like. I got rid of the zero on the hours tens column, changed it to a 12 hour clock with an am/pm indicator (upper left dot), and flashing colon. Other additions that aren't visible are support for an LDR module (light dependent resistor) to allow dimmer normal brightness and a brighter display in bright ambient light. Also there is hysteresis coding on the LDR coding so the brightness doesn't change unless the Hi/Lo value has stayed constant on the new value for so many seconds (I use 4 seconds).
Let me know if you'd like the py script and I'll get it to you. It's got a different name so it can be tested without removing or renaming your clock.py file. Mine is called Clock_1.2in.py.
Reply 4 years ago
Could you send me the code as well? Thanks.
Reply 3 years ago
Could you send me the code as well? I made a modification to the display.py to show the temperature with the degree symbol ° . {subprocess.call(["/home/pi/EnvironmentClock/digole", "printxy_abs", "70", "230", "Inside: " + str(insideTemperature) + chr(176) + "F [" + str(insideHumidity) + " %]"])} . Use without the braces {}. Thanks
Reply 5 years ago
The LDR addition sounds interestign. I am planning of making one for my wife as a christmas gift. Could you share your code?
Reply 5 years ago
Bubbleologist, I sent you a private message with a link to my modified clock python file.
5 years ago
Awesome idea, voted!
5 years ago
That is a cool project I am planning of giving it a try. The display is not that common in the UK, do you think a slightly different size would work?
5 years ago
Does this poll local weather for outside weather? or just read off the sensor for internal temps?
Reply 5 years ago
I has the little humidistat inside then asks for outside conditions using the darksky.net API, thanks for the visit.
5 years ago
?12.11.2017
Interesting project.
Would it not be possible to download the 3D printer files from Internet?
This makes it easier to get the case made by a company.
One could also scan the internet pages of a weather service to get accurate and up to date weather situation.
I think I would use an RPi3 for extra services and add an alarm (need 3 buttons)
Reply 5 years ago
Hey I have everything in my github! thanks for visiting
https://github.com/khinds10/EnvironmentClock
5 years ago
Awesome. A thing that I may try to make.
5 years ago
This would be really useful here. It changes so quickly the predictions are usually off.