A Kindle Weather Display, the Easy Way

WeatherDisplay

I’m not the first person to turn a Kindle e-reader into a weather display, but I believe I’ve found an easier way to do it.

Matthew Petroff wrote an overview of the procedure but left the Kindle work as an exercise for the reader. Jennifer built upon Matthew’s work and added a lot more details. MobileRead has the files and some descriptions of the work you need to do, but warns that it’s not a step-by-step guide. Liraz Siri has a great description of the jailbreaking process.

WeatherDisplayCloseUp
My Kindle Weather Display

My display is based on the Kindle 4 Non-Touch (K4NT). I bought the version with ads, used on eBay. I wrote server software in PHP that delivers a PNG file to the Kindle. My display includes the current weather, forecasts for the next 6 hours along the side, forecasts for the next four days at the bottom, and today’s sunrise, sunset, moonrise and moonset, and phase of the moon.

Instructions found elsewhere on the web involve setting up USB networking on the Kindle, installing the corresponding driver on the PC, downloading and running an ssh client application, and executing Linux commands on the Kindle. My method eliminates those steps.

Preparing the Kindle

My Kindle came with firmware version 4.1.1. Kindles this old can not upgrade to the latest version automatically; you need to do it manually by downloading a file, copying to your Kindle over USB, and telling the Kindle to upgrade. Amazon has a help page describing the procedure.

Jailbreaking the Kindle

I downloaded the Kindle 4NT jailbreak code from MobileRead (here‘s my copy of it). Unzip the file. The zip file contains a README file with instructions for installing the jailbreak. Follow them; they’re very simple. Remember, this file and procedure are for the K4NT. If you have a different Kindle, refer to this thread.

Install Kite

This is where my procedure differs from others’. They guide you though setting up a LAN over USB, installing the necessary driver on Windows (which turns out to be a lot harder than you’d think), setting up ssh, getting an ssh client for the PC, logging into the Kindle and issuing Linux commands. But there is an app for the Kindle, called Kite, that can run arbitrary shell scripts. These scripts can do everything you need to do, eliminating all the LAN/USB/ssh/Linux command rigmarole.

Kite creates a directory, called ‘kite’, in the Kindle’s main folder – the one you see when you connect a Kindle to your PC. You can put shell scripts in the kite folder, restart your Kindle, and your scripts will show up as documents. Select a script from the list of documents and instead of reading it like a document, Kite executes the script. So instead of issuing Linux commands manually, all you need to do is install Kite, copy my shell scripts (which you can get below) to the Kindle, and run them.

I assembled versions of Kite for Kindle 3 and 4 into a zip file, and you can download them here. The official source for Kite is this MobileRead thread, but it doesn’t include the Kindle 4 version and people have had mixed results installing the K3 version on a K4. Nevertheless, you should go to the MobileRead thread for the instructions on installing Kite; basically you copy the appropriate .bin file to your Kindle and tell the Kindle to upgrade. It’s even easier than jailbreaking.

Setting Up the Server

As with other Kindle weather displays, you need to set up your own server. You can download my server code here. You don’t need to use my server code; you can use Matt Petroff’s or Jennifer’s or anyone else’s. As long as the server delivers a 600×800 PNG image, it will work with this Kindle code.

My code relies on the GD graphics library. If this is not set up on your server, my PHP script will fail. If this happens, you need to install or enable GD. Here’s some information about doing that: http://php.net/manual/en/image.installation.php

Setting Up the Kindle to Display the Weather

Once Kite is installed, connect your Kindle to your PC again. Download and unzip my Kindle code from here. It includes four scripts I prepared that should be copied to the Kindle:

  1. Display_Weather: this script reads a URL from the ‘weatherurl’ file, fetches the PNG image at the URL, and displays it. This script doesn’t go in the ‘kite’ directory because it should not be run directly.
  2. kite/Add_Weather_cron_Job: this script creates a cron job (Linux’s way of running a program at a regular interval). The cron job will cause Display_Weather to be run every 30 minutes. In this way, the weather display gets refreshed. Since this script is in the kite directory, you will be able to run it from the Kindle’s list of documents.
  3. kite/Remove_Weather_cron_Job: this script removes the cron job created by Add_Weather_cron_Job. This allows you to return your Kindle to its regular e-reader behavior. Since this script is in the kite directory, you will be able to run it from the Kindle’s list of documents.
  4. kite/Start_Weather_Updates: this script shuts down the Kindle’s screen saver and, if you have a Kindle with “special offers” (ads) shuts down their display. Then it runs Display_Weather.

There are two other files you’ll need to copy. weather-image-error.png is the image that Display_Weather will show if it can’t get the image from the URL. weatherurl is the file that contains the URL, and you need to edit this file.

weatherurl contains one line of text:

<your URL>/iweather.php?zipcode=<zipcode>&openweathermapapikey=<apikey>

You need to edit this and put in the URL of your server and the zip code for the area you want to display weather for. If you’re outside of the United States, replace <zipcode> with your postal code, followed by a comma and your country’s ISO code, e.g. Berlin, Germany would be 10115,DE. You also need to go to OpenWeatherMap, sign up for a free API key, and put it in the file. One tricky part of editing the file is that it uses Unix line endings, which are different from Windows line endings. Don’t edit this file in Notepad. If you’re on a PC, I recommend downloading Notepad++ and editing weatherurl with that.

Remember that you don’t need to use my server code. Put any URL you want in weatherurl. The only requirement is that the URL provides a 600×800 PNG image.

So to summarize: download my Kindle code, unzip it, edit weatherurl, and copy the unzipped files (including the kite subdirectory) to the root of the Kindle’s drive. My code’s kite directory should be merged with the kite directory already on the Kindle.

Safely disconnect the Kindle from your computer and restart the Kindle. The list of documents should now contain Add_Weather_cron_Job, Remove_Weather_cron_Job, and Start_Weather_Updates. I’ve found that any time you add or remove Kite scripts, you need to restart the Kindle.

Using the Weather Display

At this point, your Kindle is still usable as an e-reader. To use it as a weather display, select Add_Weather_cron_Job. Now, the Kindle will display the weather every half hour, on the half hour. But the Kindle is still operating as an e-reader, so the weather display is just going to mess things up. Next, select Start_Weather_Updates. This will shut down the e-reader code, including the screen saver and ads, and immediately display the weather. Your Kindle is now a weather display.

To get the Kindle back to normal operation, hold the power button in for 30 seconds. The Kindle will restart. When it starts up again, it will be an e-reader, but the cron job will still cause the weather to be displayed every 30 minutes. You should either stop that by selecting Remove_Weather_cron_Job, or you should disable the e-reader functions by running Start_Weather_Updates. If you want to change the weather URL (e.g. to change the zip code), you can connect your PC to the Kindle and edit the weatherurl file.

 

Follow-Up

I got another Kindle 4, went through my own instructions, and wasn’t able to get it working. The problem was that Add_Weather_cron_Job was not updating the crontab and so the weather would not get updated ever 30 minutes.

And so I resorted to setting up the USB network. If you end up here, here’s some advice. First, install the USB network code on the Kindle. I used this file that I got from here. But it didn’t work for me; when I connected the Kindle to the PC, it still mounted as a drive instead of a network. I needed to go into the usbnet folder on the Kindle and rename the DISABLE_auto file to auto, then restart the Kindle.

In my struggles before I renamed the file, I tried installing an RNDIS driver on my PC (it’s necessary to use USB networking). I used this file. I have Windows 10, so in retrospect I don’t know if I needed to install the RNDIS driver or if it was already there, and it just wasn’t showing up until I renamed DISABLE_auto.

Once the Kindle was showing up as a network, you need to configure the network just right. The best explanation I’ve found of that is here.

I then used Tera Term to ssh into the Kindle and edit the crontab directly (essentially doing the same thing the Add_Weather_cron_Job script does). When I was don, I went back to the usbnet directory (/mnt/us/usbnet) and renamed auto back to DISABLE_auto.

16 thoughts on “A Kindle Weather Display, the Easy Way

  1. Hello!

    Thank you for this guide and the work you’ve done on your code! I’ve been taking a shot at getting this setup for myself but I’m running into an issue on the server side. Do you have a list of dependency packages that your iweather.php requires? I’ve given it php, imagemagick and pngcrush. I’m also not greatly familiar with php. The primary symptom is that I get an error at line 600 “call to undefined function imagettfbbox.” And I feel like I’m missing something. I’ll keep troubleshooting but it might be nice also for anyone else tripping across this in an effort to make their old kindles useful again.

    1. I’m sorry to hear you’re having trouble setting up the server. I don’t have a list of the dependencies; I’ve actually never set up a PHP environment on my own, I’ve just used environments set up by others, like my web host. I can tell you that imagettfbbox is part of the GD library, and I’m expecting GD 2, which made some significant changes from GD 1. The documentation for GD is at http://php.net/manual/en/book.image.php. It includes installation instructions.

      You’ll also need the HTTP_Request2 library (https://pear.php.net/manual/en/package.http.http-request2.php), which is frequently installed by running the PEAR application. I haven’t done that myself either.

      Good luck.

  2. Are the brackets used or not in the weatehrurl?
    Should it be like this: /iweather.php?zipcode=&wundergroundapikey=

    Or like this:
    192.168.XXX.XXX/iweather.php?zipcode=33XXX&wundergroundapikey=abcdefghijkl

    If on a Raspberry PI, is the IP address sufficient or do I need to add “http://” to the IP address also?

      1. Thanks a lot. I have been looking for a solution for my Nook Simple Touch and yours is the best I can have. I confirm that it works for Berlin by manipulating some values.

  3. Hi Bob
    Thanks for the app which I’d like to try.
    Is it difficult to switch display to centigrade?
    Rupert

    1. It’s fairly easy. Edit the server file iweather.php. There are several occurrences of the word “fahrenheit”. Replace them with “celsius”.

      Hope this helps.

      – Bob

  4. Hi Bob

    Do you have any further instructions on the server setup.

    I get following using xampp apache when opening iweather.php in chrome:

    Warning: require_once(HTTP/Request2.php): failed to open stream: No such file or directory in C:\xampp\htdocs\iweather.php on line 3

    Fatal error: require_once(): Failed opening required ‘HTTP/Request2.php’ (include_path=’C:\xampp\php\PEAR’) in C:\xampp\htdocs\iweather.php on line 3

    Rupert

    1. Hi Rupert,

      It sounds like the HTTP library is not installed in your PHP setup. Typically, you can install it using the PEAR utility. I haven’t worked with xampp, but if you google “xampp pear” you might find some helpful information.

      – Bob

  5. hi Bob

    server sorted now. Do I really ned to jailbreak as mobilethread Kite page says jailbreaking isnt neccessary?

    “no jailbreak is necessary to install this application.”

    Rupert

    1. I tried doing it without jailbreaking but it didn’t work for me. If it works for you, great!

      – Bob

  6. Thank Bob
    My Kindle 3g is in fact already jail broken from when I insalled screen savers years ago. I installed KUAL rather than Kite. Do you know if I can get your scripts to run on KUAL? Will my existingscreensavers need to be removed.

    I have another Kindle 3g which is not as yet jailbroekn and you’re rigt I have been unable to install Kite on that.

    I’ll like jail break the second kindle unless you think KUAL might work.

    Rupert

  7. Hi Bob

    There is no jailbreak for March 2016 update to Kindle 3 as yet.

    So had to stop. Frutratingly the 3,2.1 version appear to work but in fact doesnt. The deveopers seem to be hibernating and killed off the thread where they conced b3.4.2 was outstanding.

    http://www.mobileread.com/forums/showthread.php?t=190969&page=2

    Out of interest thought how would I go about modifying your code for UK on the optimistic assumption I ever get that far.

    Thanks for your help and sorry didnt succeed – I was going to try a Florida zip in case I ever go there so I can dodge the hurricanes.

    Rupert

Comments are closed.