It's displaying weather forecast for Cambridge, UK.
The awesome bit is you can make this with 20 lines of scripting and in less than 5 mins. Here is how it works:
- Grabs the weather data from Yahoo weather feed.
- Extracts key weather data from the xml feed, and
- Displays the data to the LCD.
Most of the script above is for converting the rss weather feed xml into those few lines to display. It writes the information in a file which is then read and displayed to LCD by a python script. Here's the python script to display the info in green color only:
#!/usr/bin/env python from pylcdsysinfo import BackgroundColours, TextColours, TextAlignment, TextLines, LCDSysInfo from time import sleep d = LCDSysInfo(); d.clear_lines(TextLines.ALL, BackgroundColours.BLACK) d.dim_when_idle(False);d.set_brightness(127);d.save_brightness(127, 255) d.set_text_background_colour(BackgroundColours.BLACK) f = open('yw', 'r'); col = TextColours.GREEN; c = 1; for line in f: d.display_text_on_line(c, line, False, TextAlignment.LEFT, col) c = c + 1
That's 20 lines of scripting doing it all! Yet another example of how awesome shell and python scripts are.
You can run this every hour simply by adding a cron job. There is a bit of details involved before you can use this code. You need the python lib for the LCD and also a bit of info on how Yahoo weather feed works: http://developer.yahoo.com/weather/. To get the forecast for your location, you need the WOEID (Google: WOEID finder) and to pass it to the Yahoo weather feed url.
I understand I should provide detailed steps for beginners, perhaps as an instructable. If you want to see the detailed steps, do let me know in the comments :).
Detailed steps would be apreciated. We have holiday cottages and I can see putting one of these in each cottage could be a nifty idea.
ReplyDeleteThanks
That's enough interest to post an instructable :). I hope to post the detailed steps next week. Thanks!
ReplyDeleteAlthough it has been used a weather station. I believe we can use it for email or rss feeds, can we not?
ReplyDeleteWe definitely can use it to display email or rss feeds.. even share prices :).
DeleteNicely done!. I guess I will have to do some research on this. Any advice?
DeleteFor email count, I guess there should be some simple linux script or tool to get count of unread emails using POP/IMAP.
DeleteRss/xml feeds can be stripped using similar scripts I've shown. Hope that helps.
Check out the adafruit.com tutorials, there is some code there that parses an email feed and lights an led when a new email arrives. That should help!
DeleteThanks for the info Andy, will check it out.
DeletePut me down for detailed steps!
ReplyDeleteI would love the details as well
ReplyDeleteVery well done - a really excellent mini project. Going to reblog it at http://www.recantha.co.uk/blog
ReplyDeleteThanks for the great project, I would like to an instructable also
ReplyDeleteRoss Bell
Instructable please.
ReplyDeleteThanks so much for the overwhelming interest! I'll write up the instructable and hope to share it this Sunday (April 21st)! :)
ReplyDeleteI apologize, I couldn't make the time it needs to write the details. I hope to do so later this month.
DeleteI pretty much got the LCD to work as follows:
ReplyDeleteGo here https://github.com/walac/pyusb and download files
Then
$sudo apt-get install python libusb-1.0
$ sudo python setup.py install
Then go here https://github.com/dangardner/pylcdsysinfo
download files
I also did this as is in Readme
"You may need to copy the provided 99-lcdsysinfo.rules file into /etc/udev/rules.d/"
To test i ran the demo.py and it works.
I then copied the two scripts above and only get the date to display. So not sure what is missing
Ok, I got the info to display but it only scrolls across the display and date is displayed at the end. Obviously I am not proficient in python to figure it out as far. Looking for to the info to make it work correctly.
DeleteI've uploaded the files here:
Deletehttps://code.google.com/p/kontroller/source/browse/#svn%2Ftrunk%2Fweather-station
Please download and run 'weather.py' and 'weather.sh' files in RPi. You can use 'wget' command to download in RPi. Please put the files in the directory where demo.py is and use:
sudo ./weather.sh
The weather.sh will generate 'yw.htm', I've uploaded a sample file in the same location. That xml is stripped into 'yw', please check the content of the 'yw' file if it is not displayed correctly.
Very nice...It works great. nicely done and much better than what I came up with. Thank you.
DeleteGreat! Happy to know you liked it :).
DeleteCould it be done to display the results on an android phone instead of an LCD? I would also like an instruct-able please. Thank you!
ReplyDeleteI can imagine a number of ways.. if I got it right, simplest would be to use some browser/feed viewer to see the link in the phone.
DeleteNice. I have just received one of these displays. I'm going to use pylcdsysinfo to display meeting room bookings. I've already worked out how to get the data out of google calendar now this will make a perfect display.
ReplyDeleteGreat! Will love to see some photos/links. :)
DeleteYeah, I'd love to see an instructible. Once I have this working, I want to put it together with the raspberry pi opensprinkler project.
ReplyDeleteThat sounds interesting.. always wanted to use a rpi in the garden.. :)
DeleteI've also bought this screen and have been busy writing a driver for it so that it can be an automatic facebook picture frame :)
ReplyDeleteSounds cool! Do share a link to you work!
DeleteHello:
ReplyDeleteWhat happened to the instructable you were about publish? Are still considering doing one?
Thank you Ross Bell.
You asked for it, here it is: http://hajos-kontrapunkte.blogspot.de/2013/05/raspberry-pi-as-rbn-client.html
ReplyDeleteThat's ham radio related. The R-Pi listens to a Telnet Server, which monitors ham radio stations all over the world. http://www.reversebeacon.net/main.php And the spots will be shown on the LCD.
Thanks again for the inspiration.
72 de Hajo
Just wondering if this is Linux only? Trying to start up saying d = LCDSysInfo() tells me
ReplyDeleteimport usb, time, struct
ImportError: No module named usb
and pyusb seems to have different naming. I don't lind using the Linux box, just wondering if using Windows is possible. (Win 7 SP1)
I'd be interested in your instructable. This would be a great first project for me and my Pi!
ReplyDeleteWhere on earth is this instructable?
ReplyDeleteAnd also, would this work directly from a HDMI output from the RPi itself?
Does anyone know how to get the large images to display in Python? I have pictures uploaded from a Windows machine whoch run as a picture frame loop but the Python scripts don't seem to be able to access them. There's a script called image-loop.py but it doesn't seem to work properly.
ReplyDeleteplease write a instruction
ReplyDeleteThank you so much for sharing this great blog.Very inspiring and helpful too.Hope you continue to share more of your ideas.I will definitely love to read. galaxy projector
ReplyDelete