Kindle Weather Display

Ever since I first learned about electronic paper, I’ve thought it would be perfect to display some sort of regularly updated, but not real-time, data such as the current date, an agenda, or the weather forecast. Unfortunately, e-paper displays have always cost more than I was willing to spend on such a project. However, with the price of Amazon’s cheapest Kindle recently dropped to $69, I decided e-paper displays were finally cheap enough for me to pursue such a project: an e-paper based weather forecast display.

The system consists of two parts, one running on the wall-mounted Kindle and one running on a server. The server fetches and processes weather data to create an image, and the Kindle downloads and displays it. While the Kindle is capable of handling both parts, I already had a server, and utilizing it saved me the time and hassle of setting up a build environment for the Kindle.

The server side of the system uses shell and Python scripts to convert weather forecast data into an image for the Kindle. The scripts first download and parse forecast data from NOAA via the National Digital Forecast Database XML/SOAP Service. After parsing the data, the data then needs to be converted into an image. This is accomplished by preprocessing a specially crafted SVG file to insert temperatures, forecast symbols, and days of the week. This SVG is then rendered as a PNG using rsvg-convert and converted to a grayscale, no transparency color space as required by the Kindle using pngcrush. Finally, it is copied to a public location on the web server.

Weather Icons Used for Forecasts

Before running anything on the Kindle, one must first jailbreak it and obtain shell access; this is left as an exercise for the reader. The Kindle portion of the system consists of a shell script that downloads the rendered image from the server, clears the screen twice to prevent ghosting, and then displays the image on the Kindle’s screen. On both the server and the Kindle, cron is used to execute the required scripts twice a day, with the server executing its scripts five minutes earlier than the Kindle to ensure a new image is ready. In addition, the Kindle requires an initialization script to disable the framework and power daemons to prevent the screen from being overwritten and to prevent the Kindle from going into sleep mode, which would disable the WiFi as well as cron, preventing any forecast updates. This initialization script was made easily accessible on power on of the Kindle using kite.

To create the icons, I started off with public domain icons from the Noun Project. Either using pieces of these icons or from scratch, I created icons for the weather conditions there were no icons available for and for those where there were no public domain versions. I am releasing the icons under the CC0 Public Domain Dedication and the source code for the scripts under the MIT License.

Files:
Weather Icons
Source: Archive, GitHub

Ads

Ads

This entry was posted in and tagged , , , , . Bookmark the permalink.

94 Responses to Kindle Weather Display

  1. Pingback: Turning a Kindle into a weather display - Hack a Day

  2. Patrick says:

    Rather humorously – this may be the perfect application for gifsockets.

    github.com/videlalvaro/gifsockets

    Rather than have the server poll to update the png file, you could ‘stream’ the gif.

    • Matthew Petroff says:

      Unfortunately, the Kindle’s built-in screen test utility that is used to display the images only supports PNG and bitmap images.

      • Jesse says:

        The kindle touch has a webkit based browser which might be able to be used with gifsockets.

        I’m not sure of the non-touch version, but I’d imagine it would be possible to install it on a rooted device.

        • Matthew Petroff says:

          The non-touch version also has a WebKit-based browser. Just making a web page would have been much easier, but it would not be nearly as clean as there is no way to hide the browser chrome.

      • Patrick says:

        Ah! I didn’t know that.

        Thanks for the awesome hack.

  3. David Runion says:

    I love the simplicity of this project, thanks for sharing everything! I’m going to try to create my own display modeled after yours to display my solar power generation #s.

    I assume the SVG “preprocess” file is part of the MIT-licensed source code and not the CC0 icons? At a glance I can’t tell the difference between the two licenses.

    How did you create the SVG file initially?

    I’m assuming the wget works over wifi, and you just use USB to power it?

    Why update this on half-day intervals? NOAA’s API license states their data updates hourly.

    It seems like you could turn off wifi when you’re not updating to save power, allowing you to run this wirelessly for some time. Do you have any idea how much life it will have with the power daemon turned off?

    • Matthew Petroff says:

      The SVG “preprocess” file is with the MIT licensed code. The main difference being, the MIT License requires attribution, while the CC0 license does not.

      I initially created the SVG “preprocess” file and the icons using Inkscape, saved them as “Optimized SVG” to strip out various unneeded information, and finally edited them extensively by hand to simplify them. I then inserted the icons into the “preprocess” file as “” and replaced what had been blank boxes with markup to use one of the icons. This left me with a sample output file. I then replaced the links to the icons, the temperatures, and the days of the week with strings to be replaced by the Python script.

      Correct, it uses wget over WiFi and uses USB power.

      I only update twice a day because the forecast doesn’t change that much with more frequent updates. Also, at some point in the evening, NOAA starts returning the forecast starting with the next day. I suppose I could use this and change the large image to “tomorrow,” but it’s easier just updating less frequently.

      If I were to look closely at the power daemon and rc.d, I probably could get it to turn off everything but the cron daemon and let cron turn on the WiFi as needed, but I think it’s not worth the effort as I don’t mind having it plugged in. I haven’t tested how long the battery lasts with the current configuration, but I think it’s probably only a few days.

      • Brad says:

        Disregard my other comment or don’t let it through moderation :) … I was wrong about the GMT thing – I see now that it does indeed roll over to forecasting for the next day and gives the valid start time in local time. So my preferred easy solution is to simply preface all forecasts with the day of week, rather than Today and Tomorrow. I made the following two changes to do this.

        In weather-script.py, add just before “# Write output”:
        output=output.replace(‘Today’,days_of_week[(day_one).weekday()]).replace(‘Tomorrow’,days_of_week[(day_one+one_day).weekday()])

        And to keep the top label in a good spot, make the “Today” line in weather-script-preprocess.svg look like:
        Today:

        (change text-anchor to begin and x to 25)

        Thanks again for the cool hack :)

  4. Pingback: Hack A Kindle Into A Weather Display | Lifehacker Australia

  5. lesle says:

    Can you use private weather stations, such as WeatherLink? Here’s a station in Xenia:
    http://www.weatherlink.com/user/brentcharltonxen/?view=summary

    Here’s a worldwide WeatherLink map:
    http://www.weatherlink.com/map.php

    • Matthew Petroff says:

      You can you any source for weather information you want, you just need to write the code to retrieve and parse the data.

  6. Jared Bares says:

    Which specific model is this Kindle?

  7. Gustavo Garcia says:

    What a great idea! I suppose doing this for the $25 Pandigital Novel 6″ ePaper would be a complete re-write?

    • Matthew Petroff says:

      It would be a complete rewrite of the Kindle-side image display code. The server-side data parsing and image rendering would remain the same.

  8. Dave says:

    Hi Matt, your project turned out really nice. I think I’m going to give this a shot… thanks!

  9. Richard Dawson says:

    Love this project, its simplicity and useability are quite brilliant.
    A few questions (as I know very littel about the programming side)

    Does this completely re-write the useage of the kinde? i.e. can it still be used as an e-reader?

    Can this be implimented on older versions, say the 3G keyboard?

    Could it be produced to run as a screensaver for a functioning e-reader kindle?

    Once again great work.

    • Matthew Petroff says:

      The Kindle can still be used as an e-reader. When it is first turned on, it functions normally until the initialization script is selected and run.

      It should work fine on the Kindle 3; I don’t know about older versions.

      It can’t be run as a screensaver, as the cron daemon is stopped when the Kindle goes into sleep mode, so it wouldn’t be able to update. I think it could, however, be modified to run as a screensaver as long as one is okay that it won’t update until the next time the Kindle is turned on and off.

  10. Van says:

    I love your project! It’s a very elegant way to display the weather information.

    I’m new to SVG graphics and I’ve been trying to figure out how you added the icons to the “preprocess” file as “”, as you said in a comment above. When I open the “preprocess” file in Inkscape, I can only see the placeholder txt. Are the icons invisible? I am hoping you can point me in the right direction. Thanks!

    • Matthew Petroff says:

      If you open the SVG file in a text editor, you’ll notice the section. That is where all the icons are. Specific icons are then used by linking to their definitions. Since the “preprocess” file doesn’t have valid links, no icons are shown.

  11. Jonny Fosnight says:

    Hey thanks for this awesome project. It took me a couple days to get everything figured out, but I believe that I fully have it running now.

    I’m using a Kindle 3 Keyboard and it displays the image perfectly. I did however have some problems with the init script on the Kindle. I placed it in the power on folder for Kite, and that just screwed up everything and sent the Kindle into a boot loop. I finally got things reset and moved the init script to just the Kite folder and selected to run it manually. It worked fine then. It also took a bit to get the SSH and jail break initially setup, but I was able to find some other people that had done that and had posted good instructions. The final thing that I just now got setup is the Cron table. Now that it’s going I think that everything should be good to go.

    Like I said it was a fun, though challenging little project and I thank you for sharing it with the rest of us.

    (Just as a side note, I’m using a Raspberry Pi I already had setup as a web server to process the server side files, it works perfectly and only takes about 5 seconds to run the script.)

  12. Herzog says:

    Hello,

    how to add exisiting ra1.svg and additional new icons to weather-script-preprocess.svg’s xml?

  13. John says:

    Funny, I was just thinking about this exact same project. Would it be possible to modify it to display the time/date too? Maybe update the display once a minute or once every 5 minutes?

    • Matthew Petroff says:

      Both could easily be done; modifiying the server-side code will change what is displayed, and changing the cron settings on both the server and the Kindle will change the update rate.

  14. andy says:

    Good idea – best next step is to do all the processing on the Kindle, obviously. That makes it a killer reason to jailbreak and a new use for the Kindle when not reading for many users who would not have the server to plug into it all the time.

  15. Jared says:

    I had seen this when you posted it but didn’t think much of it since my price threshold was a bit lower for a similar device. As it turns out, I came into one of these Kindles through some unrelated business, so now I’m trying to get this working. In any case, can you explain a little more about how you got kite installed? I followed the link, but the install process doesn’t seem to work as documented on the newer models of Kindle. Specifically, I don’t see any option to do a system update to pull in the kite mod. If you have any further, more detailed information about how you got that working, that’d be great. Thanks.

    • Matthew Petroff says:

      I used the “installation of kite as a script” method listed in the post; the “installation as update” method did not work for me either.

  16. grundy says:

    Hi!
    Nice work :-)
    I think I will try it too, but need to buy a Kindle first. Amazon (Austria) sells a Kindle 4 for 79€, which looks exactly like yours; would it work with that one?

    Also, I have an idea:
    I could make a little hardware hack that closes the power button about every hour, so maybe it’s possible to alter the scripts to update the picture when turned on and then go back to sleep with that pic on the screen…do you think that’s possible? Maybe there is another way to wake the Kindle up every hour, I can check the hardware if I have one :-)

    • Matthew Petroff says:

      I used a Kindle 4, so yes, it should work on one.

      There is no limitation as to how often the screen is updated; no hardware hacks need. To make it update more frequently, one simply needs to edit crontab to have the script run more often.

  17. This is awesome; I’ve been hoping to do this for some time and will be shamelessly copying your efforts.

    I’ve been thinking of using pwnazon to serve the images as “ads,” so even the Kindle I use as an ereader can benefit. Did you chose to pull the images yourself to better control update frequency?

  18. Daniel K. says:

    I spent hours trying to figure out why my Kindle 3 would zoom the PNG image horizontally while appearing to be proper vertically. The following change to the last two lines of weather-script.sh fixed the problem.

    pngcrush -c 0 -nofilecheck weather-script-output.png weather-script-output-new.png
    cp -f weather-script-output-new.png /var/www/weather-script-output.png

    • Daniel K. says:

      I don’t really need -nofilecheck flag. The point being that the original command did not work because of the -ow flag. I think that pngcrush actually needs input and output file.

      • Matthew Petroff says:

        You’re probably running an old version of pngcrush. The “-ow” flag was added with pngcrush 1.7.22, released December 2011.

  19. Pingback: How to Replace a Kindle 2 Battery | Hack Writing

  20. Scott Beaudry says:

    Any chance you could post step by step directions? I love doing these mods to my devices, but I don’t want to take a wrong turn anywhere. So far my device is “jailbroken,” and kite is installed; where do I go from there?

    • Matthew Petroff says:

      First, you need to set up the server-side scripts. Then, you need to copy “init-weather.sh” to your kite folder and copy “display-weather.sh” and “weather-image-error.png” to a “weather” directory on your Kindle. Finally, you need to edit your Kindle’s crontab to run the “display-weather.sh” script at specified intervals. Running “init-weather.sh” will start the display.

  21. Tim says:

    Will this work with a Kindle Touch?

  22. Tim says:

    and one other odd question-
    How did you mount it to the wall?

  23. Sebastian says:

    Amazing project! Since my weather station finally broke and all the new ones I could find were either aesthetically acceptable but absolutely not informative or just way too techie. So I decided to follow your lead. Given my rather marginal working knowledge of linux and total incomprehension of any programming language, it took me a while to get tha basics together, but in the end it worked and in an attack of megalomania I even decided to extend the setup by a raspberry pi and a temperature/humiditychip to measure the conditions inside and include them in the script.
    As you can see I took a typographic approach. You may have noticed that the text is in German, but it’s not really coherent, so it wouldn’t make sense to translate it here. The information consists of the current condition outside (including temperature, pressure and wind speed/direction), inside (temp and humidity) and minimum/maximum temperatures and conditions for the next two following days.
    The pi extracts the sensor data every minute, so the display is updated every minute as well (the weather data from the internet is just included every twenty minutes). To prevent ghosting (which I didn’t notice so far but would probably occur sonner or later), the screen is blanked once an hour. For simplicity, the pi acts as the webserver as well.

    Again, thanks a lot for the instructions! Without them I probably wouldn’t have known where to start at all.

  24. Jennifer says:

    Thank you so much for sharing this project. It’s fantastic! I’ve wanted to do something with an e-ink device for awhile and wasn’t sure how to start. I’m also not as knowledgeable with Linux and I didn’t have a web server so this was an excellent opportunity to learn more about both.

    At present, I’ve basically re-created your entire project with a minor change – I added a date and time stamp for my own sanity check. I wrote up my experience and the steps I took in case anyone else is in my shoes and isn’t quite sure why something isn’t working properly. They can be found here: http://www.shatteredhaven.com/2012/11/1347365-kindle-weather-display.html

    I plan on making modifications down the road and adding extra sensors hooked the the Raspberry Pi. Thanks so much for the inspiration.

  25. Prospect says:

    Wow, great project. Thanks for sharing.

    I need the same but with a higher refresh rate. Do you think that it would work with if the data was updated every 30 seconds? Further if I skip clearing the screen before displaying the new image would I then prevent the screen from flickering during the update?

    • Matthew Petroff says:

      Updating every 30 seconds should work. The screen would still flicker if one doesn’t clear it due to the nature of the “eips” utility; not clearing the screen would, however, reduce the delay.

  26. Prospect says:

    Thanks, Matthew. I will test it.

  27. Reventlov says:

    Thank you for the code! Since I live in Europe, I had to modify the code to get data from weather.com. I have to fix icons and some details, but it works!
    I’ll upload the code in a week, when everything will work.
    http://www.kirikoo.net/images/14Anonyme-20121209-213813.png

    • Reventlov says:

      Hello! Everything works fine! I finally used the wunderground service, which provide a wonderful API! The only thing I regret is I’m too lazy to modify the icons to reflect some weather conditions.

      So, here is the new Python file to generate the image: http://sprunge.us/feFc

      And here is the SVG file “weather-script-preprocess.svg” modified to reflect most of weather condition icons:
      http://sprunge.us/dMOb

      Thanks for the code!

      To do: modify the chancesnow, chanceflurries, chancesleet, chancerain, and chancetstorms icons to indicate the incertitude; make the code less ugly.

  28. Michael says:

    If you have your own server, why not create a html file, include the weather information, and displayed with Kindle’s web browser?

    • Matthew Petroff says:

      While that would certainly be simpler, the final result is not nearly as clean as one can’t hide the browser interface.

  29. michael says:

    If I install the above scripts and use the Kindle as a weather display, can I still use the Kindle as an eBook reader?

    Thanks!

    • Matthew Petroff says:

      The Kindle can still be used as an eBook reader, but doing so will be inconvenient as the only way to exit the weather display is to restart the Kindle.

    • Reventlov says:

      You can use this script: http://sprunge.us/MCLj
      It launches the weather display from kite and waits for the user to press any key to resume the Kindle’s Java virtual machine and go to the homepage.
      You may want to add a loop to refresh the data or add the power management command.

  30. Tom Priest says:

    Hello,

    Great hack!

    Is there any way to display the temperature in Celsius?

    Many thanks,

    Tom

    • Matthew Petroff says:

      Change part of line 19 of “weather-script.py” from “&Unit=e” to “&Unit=m” and change the eight instances of “°F” in “weather-script-preprocess.svg” to “°C”.

  31. Camilo Jimenez says:

    Brilliant idea!!

    As a fun project, I made a version of this. You can check it out here http://origami.phys.rpi.edu/~jimenc/public/pjs/weather_kindle/server2/weather.php

  32. Pingback: Kindle Weather Display on the Nook | Ethan's Makerblog

  33. Pingback: Ordered A Kindle - Webomatica

  34. Jay says:

    I figured everything out, except for the cron job running on my Kindle 4nt. Crontab -e gives me an empty file – is that right? Or are the cronjobs located somewhere else on my device?

  35. Pingback: Disassembling an eReader | Terence Eden has a Blog

  36. Pingback: Kids and weather station | Annalog

  37. Matt McCormick says:

    Awesome project! I’m trying to recreate this on my own, but I’m running into an issue displaying the image on the Kindle 4. When I call `eips -g weather.png` my image displays, but it is stretched very wide. Here is a picture: http://sdrv.ms/12vwWks

    Any idea why the image is distorted? I can open this in various image viewers and see that the image is in fact 600 x 800.

    • Matthew Petroff says:

      Your PNG uses a RGB color space; it needs to be grayscale.

    • Uli Fuchs says:

      @Matt: This can be fixed simply by use of ‘pngcrush’.
      Please take a look at Matthew’s server side scripts.
      (Or search this site for ‘pngcrush’)

    • Karim says:

      Hey,

      I have the same problem, that the picture is stretched. Could you fix the problem and find a solution? The two short answers are not enough for me, sorry…

      Thanks and greetings!

      • Matthew Petroff says:

        If the picture is stretched, you’re using an RGB formatted PNG image instead of a grayscale formatted PNG image. If you look at weather-script.sh in the server-side code, you’ll see that it runs pngcrush on the image, which converts the RGB image produced by rsvg-convert into a usable grayscale image.

        • Karim says:

          Thank you for your fast reply! I’m exactly using your code for the weather-script.sh. I only did a few changes in the other parts to make it working for europe. And there is the point… It seems like pngcrush is not doing right. Maybe I should switch to a different version.

  38. Jay says:

    Can you advise how I get this to work for a UK location? When I change the Lat and Lon, the script errors out on line 43 of the weather-script.py. Also reports IndexError: List index out of range

    Thanks for a great project.

    • Matthew Petroff says:

      The scripts sources forecast data from the United States’ National Weather Service; not surprisingly, this data is US only. In order to get the script to work in the UK, one needs to modify it to use a different source for forecast data.

    • Owen says:

      I’ve modified Mathew’s code to pull data from the UK Met Office – code here https://github.com/obitoo/kindle-weather-display

      I tweaked the icons a little – unsurprisingly we have more types of rain.

  39. George says:

    Hi,
    It looks wonderful! However, it seems to me to be way easier to set up a simple webpage that refreshes itself. It might even display unread emails, etc. :D How about something like that? Do you know any such initiatives?

  40. Owen says:

    I had an issue with pngcrush on Debian – it couldnt handle the grayscale conversion properly, even when i forced the bitdepth. Solution was on the ‘convert’ step, to do ‘convert -depth 8′

  41. Pingback: Informational Display Ideas and Inspiration - jpreardon.com

  42. Fabian Lamaestra says:

    Wow, this project looks great…

    Has anyone gotten this project to work on the Kindle as a stand alone without the web server?

    How about just getting a date/time to show up in big fonts without a server call?

    Thanks again for the great post.

    • Matthew Petroff says:

      I’ve briefly tried to get it to work standalone, but getting all the required software compiled for the Kindle is easier said than done.

  43. Jeremy says:

    Is there any way you could send me a Kindle such as this, but that shows the date and time? This would be also a tad simpler for you since it wouldn’t require the server. I would pay for the Kindle and shipping and for your work.

    You can email me at [email removed].

    • Matthew Petroff says:

      It would actually be a little more complicated; the server would still be needed as it generates the images, and as the Kindle would be updating every minute, one would have to be more careful with image generation and refresh timings. I neither have time for something like this right now, nor do I want to take on the support obligations that would be involved with selling something.

  44. JobsLam says:

    Display with something wrong in my Kindle Paperwhite.
    The png looks like too large in my Kindle. How to fix?

    • Matthew Petroff says:

      The Paperwhite has a higher screen resolution than previous models. You need PNG files that are 758 x 1024 pixels instead of 600 x 800 pixels as for the older Kindles. Also, make sure your PNG uses true grayscale, not RGB.

  45. Vincent says:

    How do you do this without hacking and using calibre?

    • Matthew Petroff says:

      It’s a hack; it involves hacking. The post doesn’t mention calibre anywhere as it has nothing to do with calibre.

  46. Marc says:

    I know this hack is kinda “old” know but I am a little bit desperate about what svg programm you used to edit the icons? I have found no tool which is able to direclty manage/edit the graphics inside of the weather-script-preprocess.svg ? Any suggestens other then manual copy-paste them in seperate svg files for editing?

    • Matthew Petroff says:

      As I created the file by manually copying and pasting the separate icons in, I’d recommend doing the opposite to edit them, as you suggest.

  47. Pingback: Code Something! » EInk Walldisplay

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>