Introduction: Raspberry Pi Internet Weather Station

Picture of Raspberry Pi Internet Weather Station

This Instructable will show you how to build a really cool Raspberry Pi Internet-based weather station. Actually, to call this build a "weather station" is a bit of an under statement. This build could easily be extended to provide much more than simply the weather. However, it's a good start and it looks really cool on my desk.

Our family (OK, mostly me) has enjoyed having the family iPad on the kitchen counter, when not in use, quietly showing the current outside weather conditions. However, it's a pain to load and unload the iPad in and out of the arcade cradle case. Plus, just when I go to look at the weather, I discover someone has taken the iPad / weather display. What's needed is a permanent counter-top display that the kids are not going to swipe like the iPad.

Step 1: Gen 1 - the Lunchbox Pi Weather Station

Picture of Gen 1 - the Lunchbox Pi Weather Station

My first thought was to use a little composite video display. I picked up the one in the picture on Ebay for $22 bucks - simply search on "4.3 Inch TFT LCD Car Rear View Monitor Car Monitor". The display has a reported resolution of 656 by 416 pixels which defiantly makes displaying a lot of useful information a challenge! The display requires 12Vdc as the supply voltage. The Raspberry Pi, of course, needs 5Vdc as the supply voltage. To resolve this, I bought a cheap USB car charger from Amazon. For around $6 bucks I found a 5Vdc by 2 Amp car changer. Therefore, the lunchbox has an external 12Vdc wall wart power supply. The 12Vdc powers the display directly. The 12Vdc also goes to the USB car charger which steps the voltage down to a regulated 5Vdc. As a final hack, I soldered a pair of wires directly between the car charger and the Raspberry Pi - not my best idea.

While it all kinda worked I was not really satisfied with the quality of the video on the composite display. The small font on the display was more fuzzy than I would like. Plus, while the lunchbox at first seemed cute later it seemed kinda cheesy.

Step 2: Gen 2 - HDMI Monitor + Laser Cut Plexiglass Arcade Case

Picture of Gen 2 - HDMI Monitor + Laser Cut Plexiglass Arcade Case

Back on eBay I found a nice looking $54 dollar HDMI open frame monitor with a resolution of 800x600. By definition, an open frame anything needs a frame to mount in. Since the cuteness of the lunchbox was long over it was time for some laser cut acrylic. My local hacker space i3Detroit has a really nice 150 watt cutter that can make mince meat of 4.5mm acrylic.

I loosely based my arcade enclosure on the iPad arcade box. If I ever make a Gen 3 design it would defiantly include a removable / slide out tray for the Pi. Turns out, it's a major pain in the neck trying to plug things in and out of the Pi since there is not much room between the Pi and the side walls.

The HDMI monitor also requires a 12Vdc feed. So, I used the same trick of using a USB car charger again. This time, however, I chopped up an old USB cable so soldered wires on the Pi was not required.

If anyone is interested in the arcade case post a comment below and I'll upload the DXF files. Or, the files are on my web site at ph-elec.com.

Step 3: Pi Setup

Picture of Pi Setup

To setup a new Raspberry Pi with the needed software is not that hard. All the software is written in Python with just one added Python module. The extra Python module is called "pywapi". Here is a link where you can download the module. This module makes it easy to get real-time weather from either Yahoo, Weather.com, or NOAA.

First things first, here is a checklist to setting up a raw Raspberry Pi:

  1. Download the latest Raspbian (Debian Wheezy). Unzip to obtain a .img file.
  2. Write the to a SD card with "dd bs=4M if=2014-09-09-wheezy-raspbian.img of=/dev/sdb"
  3. The dd command takes about five minutes. When complete, run "sync" to flush the pipes.
  4. Install SD card in the Pi and reboot. Make sure there is an Ethernet connection to the Pi.
  5. Using the "Attached Devices" page on the router, find the IP address of the new Pi.
  6. Login to the Pi using "ssh pi@192.168.1.???" where ??? is the IP number from above. Password will be "raspberry".
  7. On the Pi, use the command "raspi-config" to setup defaults.
    1. Turn on automatic boot into the GUI.
    2. Set the host name to something like "MyPi".
  8. Install VNC on the Pi with "sudo apt-get install tightvncserver".
    1. Run "tightvncserver" which sets the password.
  9. Back on the big Linux box, use "Remote Desktop" to view the Pi GUI desktop.
    1. Set Protocol to "VNC" and IP number to "192.168.1.???:1". Note the ":1" on the end of the IP number.
    2. Hit the connect button and supply the VNC password.
    3. Bingo, remote GUI Pi desktop!
      1. This saves dragging out a monitor, keyboard, and mouse to connect up to the new Pi.
    4. On the desktop, run the WiFi setup icon. Setup the new Pi / USB WiFi to connect to the network.
    5. Close the VNC connection - we're now done with remote desktops.
  10. Back in the ssh window, reboot the Pi with "sudo reboot". Disconnect the Ethernet cable since the WiFi is now setup.
  11. Back on the home router, find the new IP number the Pi is using with WiFi.
  12. Using ssh, log back in using the new IP number. This time the connect will be over WiFi.
  13. Using the Files Manger on Linux, connect to the Pi using the "connect to server" command.
    1. The server address is "sftp://192.168.1.???/home/pi".
  14. Basic setup complete.

Next, the pywapi needs to be downloaded and installed. Again, this is not too hard with the following steps:

  1. Download the latest from here. Extract the archive into a new directory.
  2. Using File Manger, copy the directory to the Pi home directory.
  3. Using ssh, do the following on the Pi:
    1. cd pywapi-0.3.8
    2. sudo python setup.py build
    3. sudo python setup.py install
  4. Done.

Update, I forgot two mention two other things:

  1. On the Pi run the following command:
    1. sudo apt-get install avahi-daemon
      1. This allows connecting to the Pi by name. So, on your main computer you can connect as "ssh pi@MyPi.local" instead of using IP numbers. With multiple Pi's on the network it's easy to get them confused unless called out by name.
    2. sudo raspi-config
      1. Look for and run the 4th option called "Internationalisation Options" and set your timezone.
      2. With the timezone set and ntpd (network time protocol daemon) running the Pi will always display the correct time to within a couple milliseconds! Gotta love it.
  2. OK, now we're done again.

Step 4: Source Code

Picture of Source Code

All the source code for this little weather display is based on Python, PyGame, and Pywapi. All open source / free software.

PyGame is used to do all the GUI stuff. Really amazing stuff. Using PyGame, the entire display is rebuilt once per second. Near the top of my source code you'll find a section that allows tweaking for different display sizes. There is one section for the small composite video display and a second section for the larger HDMI display. I simply comment out one of the two sections based on the display size I need.

To get my source code running just unzip the attachment and copy the whole directory onto the Pi using File Manage. Once copied, start the code use the following ssh commands:

  1. cd Weather
  2. sudo python weather.py

The sudo command is needed so that Python can control / read the GPIO pins. There is probably some way around this restriction but it eludes me.

Once everything gets working using ssh it's time to get weather to start automatically on a reboot. This is also really easy to do.

  1. Using ssh, run "sudo vi /etc/rc.local"
  2. Just before the last line, which says "exit 0", add the following to lines.

    1. cd /home/pi/Weather
    2. sudo python weather.py &> err.log

This will automatically start the weather application on the Pi after a reboot. If later you want to turn this off, just use ssh to edit the file and add the comment character "#" in front of both lines and reboot.

Note, my source code is a big hack and I'm not very proud of it. However, if I waited until it was presentable it never would be presented. So, take it or leave it just don't cry about as I have a very thin skin.

A couple of other things to note about my code. Buried down in there you'll notice some code to talk to an X10 device. This was my attempt to control my outside pole lights that are on address A3. I simply wanted the lamps on at dusk and off at dawn. Seems easy enough and I thought I had it working. Using a USB-to-RS232 dongle on the Pi I had connected a CM11A X10 module. The CM11A is an old X10 macro module. The CM11A also has a RS232 port that allows control over the X10 bus. Seems there are still some bugs because the lamp pole lights aren't getting the message!

Also of note, on the larger display there is a nice open gap along the right hand side of the display. My plan is add some status lamps in that area. I'm playing with some IEEE802.15.4 radios and their outputs will one day show up in that open spot.

For the latest and greatest updates please visit my web site at ph-elec.com.

Well, let me know in the comments section below any questions you may have.

Thanks, Jim.

Oh, and don't forget to vote for me! Thanks again.

BTW: There is always more info on my web site: www.ph-elec.com

Step 5: Metric Update

Attached is a new version that allows the display of either metric or imperial.

Hope this helps,

Jim

Comments

dario.maxall made it! (author)2015-04-05

I like your projects, it is a cool on and I have it working. I will soon upload photos as soon as I finish it.

Now, how can I change from Fahrenheit to Centigrade?, how do I add my zip code the weather?, right now I am pulling the information from the east cost. And I have like 10 degrees difference from where i live.

Thank you for your time and Awesome work !!!

jimk3038 (author)dario.maxall2015-04-18

Wow! Very cool to see someone getting it working too. Sorry for the long delay getting back to you.

I'm afraid the code is rather a hack. Really needs a rewrite. However, it does work for me.

I've recently patched up the code enough to run on the Adafruit SPI LCD. The SPI LCD, without an analog signals, looks really sharp and clear even for a small display.

To answer your question, look for the following line (around line #100):

w = pywapi.get_weather_from_weather_com( '48085', units='imperial' )

Change the units to 'metric' and the zip code to where you live. Of course, this should be in a config file that is loaded on startup.

Hope that works for you,

Jim

By the way, I'll attach the new code in an updated step in this instructable. There are some bug fixes for other stuff too.

jimk3038 (author)dario.maxall2015-04-18

Wow! Very cool to see someone getting it working too. Sorry for the long delay getting back to you.

I'm afraid the code is rather a hack. Really needs a rewrite. However, it does work for me.

I've recently patched up the code enough to run on the Adafruit SPI LCD. The SPI LCD, without an analog signals, looks really sharp and clear even for a small display.

To answer your question, look for the following line (around line #100):

w = pywapi.get_weather_from_weather_com( '48085', units='imperial' )

Change the units to 'metric' and the zip code to where you live. Of course, this should be in a config file that is loaded on startup.

Hope that works for you,

Jim

By the way, I'll attach the new code in an updated step in this instructable. There are some bug fixes for other stuff too.

Kalmat made it! (author)2017-11-08

UPDATE: I would like to upload the code so everyone can use it, but I don't know how to do it. Jim, I can send you an e-mail with the code so you can upload it if you want to.

Awesome. Great work!

I was playing with the idea of making a Weather Station on my pi for some time, but I didn't decide until I found this. Thank you so much for sharing, Jim

First off, I am an absolute noob in python. I have never used it before nor anything similar (except C, a long time ago). I say this because it is more than probable that things could be done better, shorter, or smarter... but it works (I tested it on various resolutions: 1024x600, 1920x1080 and 800x600... you can use/adapt your own, just setting the resolution on the Display section).

I made some minor changes that I wanted to share with you (the main core is still Jim's work):

- Removed all code I didn't need (I just wanted weather, so I removed calendar and X10 related code).

- Translated everything into spanish (should you want english back, just remove TranslateD() and TranslateT() functions, and change "Current Condition" literals. You can also remove elimina_tilde(), which will not be necessary)

- Added a "current conditions" section, including current conditions icon and descriptive text (in addition to the current outside temp which was there before).

- Current conditions will now take into account if it is day or night (aprox), and will show the Sun/Moon icon when suitable.

- Changed icons to (IMO) more fancy ones. I put additional icons as well, to cover more weather condition cases. Do not worry, icons are free for non-comercial purposes (special thanks to VClouds http://vclouds.deviantart.com/. See Readme file on icons folder)

- Set some colour-alarms for current temp: if it is higher than 32ºC, it will be shown on orange. If it is lower than 18ºC, it will be shown on blue. Otherwise, it will show on regular colour (very light grey). You can set your own limits (specially for Farenheit values), or disable it.

- Also set some colour-alarms for precipitation probability: 0%: white, 1-30%: orange, > 30%: red. You can also set your own limits or disable it (I am a biker, so this part is very important to me).

I bought a small 7" monitor and I love how it looks in my sitting room. My pi 3 now has Alexa, mpd/icecast2 music streaming station over Internet... and this brand-new Weather Station!

I hope this might be useful for all of you as well and, again, thanks Jim!

Kalmat made it! (author)Kalmat2017-11-19

Well, I was wondering (just for the sake of) how to include News on the screen. After trying many other options, I eventually decided to directly use APIs in my program. It's been hard to me to get it working as I wanted, but I finally got it running.

I use RTVE (Spanish TV) and BBC as News sources, so you may have News in both English and Spanish. Using a different source I believe is not straight thru, since the resulting .json will be slightly different, but you can try!

The News are shown every 15 minutes, for a period of 5 minutes. You can modify this to your needs.

I'm affraid that small screens will not be suitable since the font will be too small. You can blacken, or dim the whole screen (dimmer class is included in the code), then printing the News font bigger,. Ask me if you need help!

I also re-shaped the information on the screen to let more room to the clock. Now it is bigger, thus much more readable.

I hope you like it!

wborrelli made it! (author)Kalmat2017-11-14

I made some other font size modifications, and I am liking the look of this a lot more on a Waveshare 3.5" screen.

Thank you so much for the guidance.

Now, if I can only figure out how to use the touch screen so that I can change screens to display different data sets with just a tap. :)

Kalmat (author)wborrelli2017-11-15

Looks really nice in deed! Congrats!

I would suggest to take the current conditions icon a little bit down (just a little)... I'm a perfectionist, sorry.

Unfortunately I don't have even a clue about touch-screens in python/pygame. Besides, I don't have a touch-screen for testing... some Googling is in your near future ;)

wborrelli (author)Kalmat2017-11-11

I changed the icons on my Pi, but I have no clue about coding in Python. I would love it if you could share your code around the look of your display. You could put it on a Google Drive share, or DropBox.

Your display looks really good.

I finally got mine running, after I found Jim's TFT version of the weather.py script. I had to comment out line 19 to get it to work.

https://cdn.instructables.com/ORIG/FYB/IHMN/IIXF89EI/FYBIHMNIIXF89EI.py

Kalmat made it! (author)wborrelli2017-11-11

Thank you for your comment and the tip to share the file... I didn't realize I could do that!

Here is the code (contact me again in you find any trouble to download)

https://drive.google.com/file/d/1YfAnbRbm92CIoPAfm...

Change disp_units and lang at the very beginning to switch to imperial and english.

I attach last version images in english and spanish (I don't think I will modify it any more).

PS: Again, I am a complete noob in python, so excuse me if my code is not very "nice"... As mentioned before, help/suggestions/comments are welcome

wborrelli (author)Kalmat2017-11-12

Thank you for sharing.

Out of the box, it does not work with my TFT display connected to the GPIO. So, I think a bit of code comparison is in my future.

You may be a noob in python, but that is still more advanced than I in python. I have never coded in python.

wborrelli made it! (author)wborrelli2017-11-12

Figured it out, mostly. The data text next to the time is a little small on the 3.5" screen.

Around line #190, an additional """ (triple quotes) is required.

Then at line #209 I added:

print 'Driver Used:', driver

devices = map(InputDevice, list_devices())

eventX=""

for dev in devices:

if dev.name == "ADS7846 Touchscreen":

eventX = dev.fn

print eventX

"""

os.environ["SDL_FBDEV"] = "/dev/fb1"

#os.environ["SDL_MOUSEDRV"] = "TSLIB"

#os.environ["SDL_MOUSEDEV"] = eventX

pygame.init()

screen = pygame.display.set_mode((480, 320), 0, 32)

Kalmat made it! (author)wborrelli2017-11-12

So happy this was useful to you. Looks really nice!!!

This is my first Python program as well!!!

Perhaps you want to take the forecasts icons a little bit up on the screen. If so, you have to modify line #561 (subwindow 1)

Try changing this:

CURRENT LINE:

self.screen.blit( icon, (xmax*wx-ix/2-xmax*0.015,ymax*(wy+gp*1.2)+yo+ymax*0.05) )

CHANGE TO:

self.screen.blit( icon, (xmax*wx-ix/2-xmax*0.015,ymax*(wy+gp*1.2)+yo+ymax*0.01) )

Note that I changed "ymax*0.05" by "ymax*0.01". I'm just guessing... Try different values between 0.01 and 0.05, and check how it looks like on your monitor.

When you have the right position for the icon, change the same line in Subwindows 2, 3 and 4 (lines #591, #621 and #651).

Besides, you can also change the font for the location and last update time (the text in the upper right side of the screen), if it is un-readable. Try changin this at line #265

self.lSmTh = 0.01

by

self.lSmTh = 0.02

Again, just guessing. Try different values, including 0.015.

Finally, thank you for your feedback!! I will include your code in my program so it is prepared for TFT as well.

Now I'm "playing" with weather and Magic Mirror... Still learning, but with some interesting results as you can see.

Techninja2143 (author)2017-09-27

I have a question: I made this a few days ago and i was wondering how can remove the wind speed and barometer to make the time bigger? my girlfriend is having trouble looking at the time from the distance. I was looking at the source code but couldn't find a way to adjust the time size and remove the other 2.

Kalmat (author)Techninja21432017-11-14

Take a look to my design. Time is bigger. If not, I could try to explain how to make it even bigger.

hometownnerd made it! (author)2017-01-02

I really liked everything about this and made my own and added some code to it as well. I have a weather station and I generate a clientraw.txt file every 15 seconds or so and wanted to actually display info from that. I will never claim it is perfect code but it does do the job fairly well. I display both the wind chill and the heat index as well as rain info, I had some issues with placement since this is my first python code but it is pretty close. I use this as a remote display for my Acurite weather station. Hope it helps some others

mthompson7 (author)hometownnerd2017-10-13

Hi do you have the code

wborrelli (author)mthompson72017-11-11

I also would like the code to grab data from my WeeWx weather data. I like that this grabs the forecast, but would like the actual temperature from my weather station in the back yard.

ginop11 (author)2017-10-14

  1. cd Weather
  2. this command doesnt work on my rasp
  3. it says no such file or directory
  4. help please
Kalmat (author)ginop112017-11-09

After download the Weather.zip file

1. Unzip downloaded Weather.zip file

2. Copy unzipped "Weather" folder (not the file) to your /home/pi/ folder

3. Now "cd Weather" should work on your terminal (be sure you are located at /home/pi folder when executing the command)

ShelbyB32 (author)2017-10-04

Nice tutorial and cool project. I got it working pretty quick. Had more problems learning how to use vi/editing weather.py than I did setting up using your instructions. Thanks for your contribution!

ShelbyB32 (author)ShelbyB322017-10-04

I noticed that ctrl+c changes the display to a calendar which appears to be not fully programmed. Any plans on fleshing that out? Any other commands that are built into the program?

Techninja2143 made it! (author)2017-09-24

GF loves it, thank you!!! great tutorial.

MrD32 (author)2017-09-09

Can i use it on Raspberry Pi Zero,if i can't please tell me which Raspberry i need to use :)

tbenton520 (author)2017-09-06

Very Awesome, My raspberry pi now has a full time job.. dedicated weather station.. The wife loves it ! She pokes that cute little head into the office gets her info and Leaves to do other things :-)

gary.reardon2 (author)2017-04-17

This is just what I have been looking for!! I looked at another one called PiClock. but this seems a lot easier to setup. My question for you how hard is it to ssh from a MacBook into the raspberry pi? I am still a noob with the raspberry pi. I have it connected to the offical 7" screen. but I think to set it all up it would be easier to use the screen on my MacBook.

LorenzoB (author)gary.reardon22017-05-29

Hi!

I found it really difficult too setting up the RPi with SSH, so I decided to use RealVNC. It's really easy to set up and it works quite well on my Pi 3.

Also, it doesn't require internet connection, as long as your Pi and laptop are on the same network.

Hope that helps you.

Elá23 (author)2017-04-05

Excellent tutorial, thank you for the time!

Only problem is I can't see where to change the "F" to "C" now that I've changed the units to metric. It's displaying centigrade units followed by an "F". Where do I find this in the code? I'm relatively new to this python stuff!

Once again, thanks for tutorial. Was good fun to replicate!

jimk3038 (author)Elá232017-04-06

Strange, I just looked at the code and the default units were already metric. On 62 you should have: disp_units = "metric" This should take care of displaying the degree C symbol for you.

To display degree C or degree F I'm using a single unichar character. So, for example, the degree F one character that is both the little open dot plus the F character. It was a cute programming trick, using unichar, that I now regret. Makes it hard to understand the code.

Anyway, if you set the "disp_unit" variable to the string "metric" then near lines 60 to 78 should take care of setting up the correct unichar symbol for metric.

Hope that helps,
Jim

Elá23 (author)jimk30382017-04-06

Thanks for your reply! I may not be using the most up to date code, where would I find this? Line 62 is a get.icon command and I can't find a disp_units command anywhere in the code.

While I have you, which section of the code would I adjust to make use of the whole screen (i.e. remove the black space to the right).

Best wishes,

Alex

Hinschar (author)2017-03-21

​Hi Jim!
I would really like to thank you for all the wonderful things you are doing and for sharing your vast knowledge with us, I tried to send you a private. Message over here but it doesn't seem to be going through, is it possible for you to send me an email address where I can contact you?


My email address is hinschar2@gmail.com.


With much appreciation,


Hinschar

mkerth (author)2017-03-08

Really cool project! I got it working through regular HDMI out but when I add my 3.5'' lcd I get a graphic that says to toggle the shutdown switch. Any idea whats up with that?

jimk3038 (author)mkerth2017-03-08

At one point I added a push button to cause the Pi to go into shutdown mode. The idea was to shutdown before yanking the power so the SDCard doesn't get corrupted. Well, I stop using the switch long ago and the power gets yanked all the time with any trouble.

So, I'm guessing your GPIO is causing the Pi to think you want to shutdown. Simple answer is to just hack the Python code to disable that feature.

mkerth (author)jimk30382017-03-09

Thanks that got me to where I needed to go. I removed all references to GPIO in the weather.py except for one instance where it was part of a giant (looked like the main) IF statement and replaced it with a false statement so whatever it wanted to do with the GPIO wouldn't run.

rbischoff1 made it! (author)2017-02-11

Thanks a lot! This project was my main inspiration for a version I put together. I plan to add sensor data to mine as well..Keep an eye on my repo. Excellent Instructable.

https://github.com/rbischoff/pyweather

zephram33 made it! (author)2017-01-08

jimk3038, great post. I have followed your instructions and have got the ".py" script running on a P2 with an Adafruit 2.8" pitft. However the screen resolution is wrong and I can't figure out how to correct it. Any thoughts?

hometownnerd (author)zephram332017-01-10

Maybe check the .py program....check which self.xmax and self.ymax you are using and compare that to what your display is capable of in pixels. My display was capable of 800 pixels wide and 480 pixels high so my self.xmax = 800 - 35 and my self.ymax = 480 - 5. Hopefully that helps you. If not maybe put your code up so we can see it. Have a great day

zephram33 (author)hometownnerd2017-01-10

Another complete wipe and reinstall today.

@hometownnerd, I tried your suggestions but they didn't correct my problem.

hometownnerd (author)zephram332017-01-11

Another thing, I am new to python and have no idea how much you know, but I got caught by the two different display areas, one is used and the other was commented out by the """ surrounding it. Make sure that the one you have changed is the one that will be used. I am not saying you do not know, just thought I would throw it out there. After that I am not going to be able to help much with why it would do that, my 5" screen looks like the image in the instructable, after I changed to the small display and changed the xmax and ymax. Hopefully you can figure it out.

zephram33 (author)hometownnerd2017-01-12

!! Figured it out !!

You were right. I had to comment out ALL of the Larger Display """ section and adjust the self.xmax = 360 - 35 & self.ymax = 240 - 5 numbers for the Small Display section. Thank you very much for your help.

hometownnerd (author)zephram332017-01-14

Awesome!!! Glad I could help

jimk3038 (author)hometownnerd2017-01-11

Hometownnerd, thanks for your comments.

Yeah, sounds like pygame is getting confused as to the screen resolution. Setting xmax and ymax to different values should have an effect. Try different values until thing look right.

Good Luck,
Jim

EnriqueH7 made it! (author)2016-12-30

Here the result, traducido al español ^^

EnriqueH7 (author)2016-12-30

Hello. I made the necessary modifications to the "weather.py" file to translate it into spanish language, search fthis lines...

self.day[0] = w[f][0]['day_of_week']

self.day[1] = w[f][1]['day_of_week']

self.day[2] = w[f][2]['day_of_week']

self.day[3] = w[f][3]['day_of_week']

put this following, it will translate day of the week into spanish...

if ( self.day[0] == 'Monday' ):

self.day[0] = 'Lunes'

self.day[1] = 'Martes'

self.day[2] = 'Miercoles'

self.day[3] = 'Jueves'

else:

if ( self.day[0] == 'Tuesday' ):

self.day[0] = 'Martes'

self.day[1] = 'Miercoles'

self.day[2] = 'Jueves'

self.day[3] = 'Viernes'

else:

if ( self.day[0] == 'Wednesday' ):

self.day[0] = 'Miercoles'

self.day[1] = 'Jueves'

self.day[2] = 'Viernes'

self.day[3] = 'Sabado'

else:

if ( self.day[0] == 'Thursday' ):

self.day[0] = 'Jueves'

self.day[1] = 'Viernes'

self.day[2] = 'Sabado'

self.day[3] = 'Domingo'

else:

if ( self.day[0] == 'Friday' ):

self.day[0] = 'Viernes'

self.day[1] = 'Sabado'

self.day[2] = 'Domingo'

self.day[3] = 'Lunes'

else:

if ( self.day[0] == 'Saturday' ):

self.day[0] = 'Sabado'

self.day[1] = 'Domingo'

self.day[2] = 'Lunes'

self.day[3] = 'Martes'

else:

if ( self.day[0] == 'Sunday' ):

self.day[0] = 'Domingo'

self.day[1] = 'Lunes'

self.day[2] = 'Martes'

self.day[3] = 'Miercoles'

self.sunrise = w[f][0]['sunrise']

now with the month, search this line...

sfont = pygame.font.SysFont( fn, int(ymax*sh), bold=1 )# Small Font for Seconds

put this following....

tm1 = time.strftime( " %I:%M", time.localtime() )# 1st part

tm2 = time.strftime( "%S", time.localtime() )# 2nd

tm3 = time.strftime( " %P", time.localtime() )#

if (time.strftime( "%b" ) == 'Dec'):

rtm1 = font.render( self.day[0][0:3]+time.strftime( " ,%d" )+' Dic'+tm1, True, lc )

else:

if (time.strftime( "%b" ) == 'Jan'):

rtm1 = font.render( self.day[0][0:3]+time.strftime( " ,%d" )+' Ene'+tm1, True, lc )

else:

if (time.strftime( "%b" ) == 'Feb'):

rtm1 = font.render( self.day[0][0:3]+time.strftime( " ,%d" )+' Feb'+tm1, True, lc )

else:

if (time.strftime( "%b" ) == 'Mar'):

rtm1 = font.render( self.day[0][0:3]+time.strftime( " ,%d" )+' Mar'+tm1, True, lc )

else:

if (time.strftime( "%b" ) == 'Apr'):

rtm1 = font.render( self.day[0][0:3]+time.strftime( " ,%d" )+' Abr'+tm1, True, lc )

else:

if (time.strftime( "%b" ) == 'May'):

rtm1 = font.render( self.day[0][0:3]+time.strftime( " ,%d" )+' May'+tm1, True, lc )

else:

if (time.strftime( "%b" ) == 'Jun'):

rtm1 = font.render( self.day[0][0:3]+time.strftime( " ,%d" )+' Jun'+tm1, True, lc )

else:

if (time.strftime( "%b" ) == 'Jul'):

rtm1 = font.render( self.day[0][0:3]+time.strftime( " ,%d" )+' Jul'+tm1, True, lc )

else:

if (time.strftime( "%b" ) == 'Aug'):

rtm1 = font.render( self.day[0][0:3]+time.strftime( " ,%d" )+' Ago'+tm1, True, lc )

else:

if (time.strftime( "%b" ) == 'Sep'):

rtm1 = font.render( self.day[0][0:3]+time.strftime( " ,%d" )+' Sep'+tm1, True, lc )

else:

if (time.strftime( "%b" ) == 'Oct'):

rtm1 = font.render( self.day[0][0:3]+time.strftime( " ,%d" )+' Oct'+tm1, True, lc )

else:

if (time.strftime( "%b" ) == 'Nov'):

rtm1 = font.render( self.day[0][0:3]+time.strftime( " ,%d" )+' Nov'+tm1, True, lc )

(tx1,ty1) = rtm1.get_size()

misiek1811 (author)2016-12-12

It is possible to change the language if so please help

jimk3038 (author)misiek18112016-12-12

Should not be too hard. There is already a way to flip the default units to metric. Look near the top of the source code. There are comments that describe how to change the units.

For all the rest, just search through the source code file to find all the English words and replace them with your preferred language. Should be really easy. You can't hurt anything so just go for it and make the changes. Worst case, the new language might not fit. However, with enough effort you should be able to abbreviate or otherwise shorten things to make them fit.

Good Luck,
Jim

misiek1811 (author)jimk30382016-12-12

Thank you and look for the file in which I mean a change such as Monday and the name of the month.

debas made it! (author)2016-03-03

Great instructable ! I was able to modify the script to suit my needs. Next step: PiTFT and enclosure

misiek1811 (author)debas2016-12-12

Please help shift hours from 12h to 24h

phofman (author)2016-10-28

Hi all,

I found the TFT version of the script and after remming out line 19, it works! Now I am not a python guru, but I understand the script loops every second to update the seconds on the display and every minute to update weather. To reduce network load, every ten minutes or so would be more than accepatble, but would it be possible to loop through a couple of destinations on the minute... And put the location name somewhere on the screen?

Best regards, Peter

phofman (author)2016-10-27

Hi,

I realise this is dated, but I would love to have this
weather station! I run on a pi3, with the small tft lcd screen on it.
For some reason I get nothing displayed. Alle steps appear to have
worked, but I do not get a display. Please advice what could have been
done wrong.

Best regards, Peter

About This Instructable

134,958views

272favorites

License:

Bio: Founder of Powerhouse Electronics. For more info goto: www.ph-elec.com
More by jimk3038:Easy ESP8266 WiFi Debugging with PythonRaspberry Pi Internet Weather StationMake Your Own Laser Cut Standoffs for Electronic Projects
Add instructable to: