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.
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. I connected the Kindle to my WiFi and registered it with my Amazon account. After about half an hour, the Kindle automatically updated to version 4.1.2. I fiddled with it a little after that, laid it aside, and it updated to 4.1.3. I don’t know if the second update would’ve happened if my fiddling had not woken up the Kindle.
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.
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. 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:
- 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.
- 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.
- 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.
- 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:
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. Sorry, my server code only works for United States locations. You also need to go to Weather Underground, 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.