Literary Clock Made From E-reader

89,618

306

207

About: I am a freelance journalist and maker. I love to make my ideas become reality, and show others how easy it is to make things. Tech savvy only means someone has tried a few things! Among techniques I still wa...

My girlfriend is a *very* avid reader. As a teacher and scholar of English literature, she reads eighty books per year on average.

On her wishlist was a clock for our living room. I could have bought a wall clock from the store, but where is the fun in that? Instead, I made her a clock that tells the time by quoting time indications from literary works, using an e-reader as display, because it's so incredibly appropriate :-)

It updates every minute, so for instance at 9.23 in the evening, the Kindle will read

My father met me at the station, the dog jumped up to meet me, missed, and nearly fell in front of the 9.23pm Birmingham express.

The way I made this, the Kindle can still be used as a normal e-reader. If the clock is turned on though, as an added bonus, it doubles as a literary quiz. The clock shows the quotation without the title and author of the book, so you can guess. If you want to know the answers, pressing the buttons on the side (normally used to advance pages of e-books) will reveal them.

-----

Update August 5:

Thank you all very much for all the nice compliments! Also, the feedback has been very useful. If you have any trouble making your own Kindle clock, please see the comments.

This Instructable has been featured on Hackaday, Gizmodo, The Verge and Hacker News. I am one very proud and happy maker :-)

Meanwhile, Johannes Enevoldsen made a web version of my clock, as did Davide. I am excited that my project inspired theirs.

Step 1: Tools and Materials

Really the only thing needed is an e-reader (and a USB cable to connect to it). For this project, a Kindle was donated to me by a friend. It is a Kindle 3 WiFi (nicknamed K3, or K3W). You will find many second-hand earlier models like that on eBay for instance.

You'll need a computer (any operating system), with an SSH client like vSSH and an sFTP client like Filezilla installed (both are free). It helps to have a bit of experience with Linux, because that is what the Kindle runs on.

To have the Kindle stand upright in our cupboard, I made a stand from concrete. If you want to do the same, you'll need a food container in a shape you like, cling film, styrofoam, cement, hot glue or double sided tape, and a bucket (to mix the cement).

Step 2: Jailbreaking the Kindle

In order to change the Kindle into a clock, we need to get into the system files. In order to do that, we need to open it up through a process called 'jailbreaking' (don't worry, it's not illegal if it's your property). An explanation to jailbreak the Kindle and a zip file with the necessary files can be found here. Also see this overview of all available software custom software. Find out which Kindle model you have on this page.

For this project, you only need to install the jailbreak hack and the usbnet hack, not the screen saver hack. USBNetwork will grant you remote shell access to your Kindle, either over USB or WiFi. What you will need, if you want to use the keyboard's keys, is the Launchpad hack.

Warning: I read this can potentially ruin your Kindle. Follow the instructions. Jailbreak at your own risk.

If you connect the Kindle to your computer, it will show up as an USB drive.

Basically, all you need to do is put Update_jailbreak_0.13.N_***_install.bin (where *** is your Kindle version, in my case 'k3w') in the root folder of the Kindle when it is connected to your computer.

From the README file in the zip file: "Now, eject & unplug your Kindle, and go to *[HOME] -> [MENU] > Settings -> [MENU] > Update Your Kindle*. It should be quick.” (note: that's two times clicking the menu button).

Then do the same for the USBNet and Launchpad files. You should now be able to log in to the device using SSH. On the Kindle, connect to the WiFi network. One way to find out its IP address is by logging into your WiFi router and looking it up there. Username is 'root', and the default root password for your model can be calculated.

Then install Python on the Kindle, again using the files on the excellent Mobileread.com forum (thanks VoltaX2 in the comments below).

Step 3: Making an Image for Every Single Minute of the Day

There are 1,440 minutes in a day. Compiling a list with quotes for each and every one of them from different literary works is a massive undertaking. Big relief: others already did that for us.

In 2011, newspaper The Guardian asked its readers to submit quotes from books which mention times. They wanted to build an installation for a literary festival. So they have two versions of a list on their website (1, 2).

I combined the two lists, cleaned them up, added a few times I found myself, and turned them into one CSV file.

Unfortunately the list does not cover all minutes of the day. I worked around this by using some quotes more than once, for instance if it can be used both in the AM and PM. More vague time indications can be used around a certain time, so this quote from Catcher in the Rye is used at 9.58AM: "I didn't sleep too long, because I think it was only around ten o'clock when I woke up ... "

Even with this pleasant list, two things took me an unreasonable amount of time. I needed to turn every single quotation from the list into an image. I wanted to make them fit nicely to the screen, so the font would be as large as possible for each quotation.

While scaling a text box to a certain height and width is easy to do manually in most photo editing software, it would have been an immense amount of work to create them one by one. Creating a script to do it for me however proved to be quite the task as well. In PHP (I used that programming language because it has nice functions to deal with text) I wrote a recursive function to find the best fit for each quotation, long or short. For each line, the script creates two PNG images, one with and one without metadata.

It uses the Libertine font, which I like because of its stylish look, because it is very complete (numbers, punctuation, diacritics) and because it's open source.

The other thing that took me a long time is identifying all time mentions in the quotations, because I wanted to write them in bold text. That makes the clock easier to use, especially when a quote is quite long. The problem is that in books, an impressive variation of time descriptions is used. It can be anything from '6.00 p.m.' or '18:11:00' to '0600h', 'around six o'clock', just 'at six', or 'twenty-eight minutes past eleven'. I made a script to try and find most of these variations, did the ones it couldn't find myself, and added them to the csv file.

If you want to make your own Kindle clock, you may use my scripts (find them attached below), but you can also just download all the resulting images.

Step 4: Starting and Stopping the Clock

I wanted to be able to start my literary clock by pressing the shortcut Shift+C on the small keyboard of the e-reader. Pressing it again stops the clock and turns the clock into a normal e-reader again.

First, create this folder: /mnt/us/timelit and then put the scripts I attached below in there.

The images (see previous step) go into /mnt/us/timelit/images and /mnt/us/timelit/images/metadata/

When you install the Launchpad hack, the folder /mnt/us/launchpad is created. Create a new file there called startClock.ini and put this text in there:

[Actions]
C = !sh /mnt/us/timelit/startstopClock.sh &

That creates the shortcut Shift+C. If we press that, the bash-script startstopClock.sh starts. It stops the Kindle framework (the normal user interface), prevents the Kindle from going into power save mode and creates a small file (/mnt/us/timelit/clockisticking) to indicate the clock has started.

If the user presses Shift+C again and the clockisticking file is already there, startstopClock.sh will remove it and restart the Kindle.

startstopClock.sh also executes another script, showMetadata.sh, to enable the keystrokes that will show the metadata (using the command /usr/bin/waitforkey). If the user pushes the 'next page' button on the sides of the Kindle, it will check if the clock is ticking and if it is, will show the same image as currently is shown (which file that is, is saved in the clockisticking file) but then with title and author at the bottom.

Changing the time on the display every minute is done by adding this line to /etc/crontab/root:

* * * * * sh /mnt/us/timelit/timelit.sh

and then restart crontab like this: /etc/init.d/cron restart

Every time it is run, timelit.sh checks if the 'clockisticking' file is created. If it is, timelit.sh proceeds to show the image for the current minute.

Note: you'll probably want to change the timezone in timelit.sh where it says 'TZ=CEST'.

Step 5: Making a Stand

I was inspired by other Instructables to make a concrete stand for my Kindle clock. I could also have made something out of wood (or even a book), but I liked to try cement because I never did before and also because I thought the grey color would go nicely with the e-reader.

I cut a piece of styrofoam the size of the e-reader, plus a little extra for the USB cable to go in. I wrapped it in cling film and a bit of clear tape, so the cement would come off easily afterwards. I taped it to the bottom of the food container using double-sided tape.

Then I mixed enough cement to fill the food container to about 5 centimeters (2") deep. I'm not sure, but I may not have used enough water, because the cement was less pourable than I had expected. I definitely should follow the concrete class before my next try :-)

I put the cement in the container using a garden shovel, tamped it a bit, and then let it dry for two days.

The next time I will try for a smoother surface by first sifting the cement to get rid of the small rocks, adding a bit more water and spend more time sanding the result. Then I will also make a small recess in the base so the USB cable goes to the back of the stand. This can be done using a straw.

Step 6: Further Ideas

The literary clock looks really nice, and the quiz part works well. My girlfriend now and then checks to see from which book a quotation is from (she usually guesses correctly :). The stand did not come out quite how I hoped, but I'm looking forward to trying making a better one.

I will probably also add a lamp, either clamped on the device or incorporated into the new base. When the clock sits in the cupboard, sometimes it is a little too dark to be able to tell the time.

Instead of getting power for a lamp separately, one could power a lamp using power from the hinge slot in the Kindle. Two slots are there for Kindle cases that have a lamp built in. You'd have to open the Kindle and do some soldering, or make your own metal clamps, but that would be sweet. One could even connect a light sensor, so the lamp will only switch on when it's getting dark.

Extra features I hope to get round to are

  • having the clock stop between 1am and 6am, to save power
  • turn of wifi for the same reason, but turning it on daily for a couple of minutes to synchronise the system clock
  • showing the percentage of the current minute that has passed as small blocks at the bottom, just like the Kindle indicates the progress the reader is making in a book
  • show a warning when the Kindle's battery is running out

(these last two could be done by overlaying small images on the larger image using the Kindle's eips command, see my scripts for examples).

Other possible ideas are

  • using keys on the Kindle to set the time
  • show a default image when the clock starts and/or when no image is found
  • using a shortcut (shift-Q for instance) to toggle quiz mode
  • have the Big Ben sound chime at the top of the hour (only during the day), as the Kindle has a nice speaker built in. Other sounds could be the sound of slamming a book shut or turning pages or even reading out a quote.

I hope you like the idea and this Instructable. Let me know if you have any questions or suggestions!

Clocks Contest

Second Prize in the
Clocks Contest

Share

Recommendations

  • Party Challenge

    Party Challenge
  • Classroom Science Contest

    Classroom Science Contest
  • Gardening Contest

    Gardening Contest

207 Discussions

0
None
zenbuffy

5 weeks ago on Step 3

Thanks for this project, I had a lot of fun doing it!

I've made some modifications to the original image generation script, so that it checks to see if the image already exists before generating a new one (which is handy if you just want to run the script to add one or two more images, since it only does the memory intensive stuff if the image isn't already there), and have uploaded that modified script to github.

https://github.com/zenbuffy/LiteraryClock

I've also added some new times to the csv file (also in github) and some new images (also in github) if anyone wants to grab some additional minutes for their clock.

Further plans include tweaking the setup a little since my kindle (and others it seems) doesn't have buttons, so the launch script idea doesn't quite work for me.

Thanks for the inspiration!

WhatsApp Image 2019-04-16 at 14.42.11.jpegWhatsApp Image 2019-04-16 at 14.42.17.jpeg
0
None
landinmorocco

6 weeks ago

Tried to install on kindle 4 but stuck because there is no launchpad for k4...

1
None
fishter

4 months ago

This fantastic idea inspired me to try it out with my old Kindle (non-touch version 4).
I hit a couple of road-bumps on the way, but nothing major - a good learning experience!
But, I hit one major roadblock. I could not get the Python installation to succeed. I thought all was lost until I realised that the python was only used to generate a random number to select between several quotes.
I know a little bit of shell scripting and thought there should be a way to generate a random integer without using python. As the Kindle uses a busybox shell which has some features removed (for instance there is no $RANDOM variable), this is a little tricky.
In the timelit.sh script you can replace this line:
ThisMinuteImage=$( find /mnt/us/timelit/images/quote_$MinuteOTheDay* 2>/dev/null | python -c "import sys; import random; print(''.join(random.sample(sys.stdin.readlines(), int(sys.argv[1]))).rstrip())" 1)

with these several lines.
#generate random number (compatible with busybox)
n=65536
while [ $n -ge 65536 ]; do
n=1$(</dev/urandom tr -dc 0-9 | dd bs=5 count=1 2>/dev/null)
n=$((n-100000))
done
IMAGE_NUMBER=$n
let "IMAGE_NUMBER %= $lines"
ThisMinuteImage=$( find /mnt/us/timelit/images/quote_${MinuteOTheDay}_${IMAGE_NUMBER}.png)

Now, there is no need for the python installation.

1 reply
0
None
Jethrokillfishter

Reply 7 weeks ago

How did you work around the fact that there is no Launchpad for K4 NT?

0
None
DFDFDFDF1

2 months ago

Thank your for the great tutorial. I finally made it work on a paperwhite. I started the startstopClock.sh via ssh and it worked. I rewrote the timelit.sh with a loop command, but as soon as i unplug the usb cable from my computer, the clock does not refresh. Any recommendations?
Thank you.

0
None
DFDFDFDF1

2 months ago

Thank you for your great tutorial. Can you maybe please add a description how i get it work on the paperwhite?
Thank you.

1
None
Andrew Hannay

3 months ago

This opens up loads of ideas for an image based clock of any subject. Wouldn't it be great to collect a load of images from movies that show the time. You could slowly build up the time by just collecting 10min interval images from 1 to 12 (72 images) or 5min intervals (144) and expand on that. As long as you name the images correctly then it doesn't matter if you miss out images as the clock will only update if it has an image of the time.

0
None
Nekkkkk

4 months ago

I did it and it works like a charm :

Made some minor changes: I did not want to have the quizz part (I'm not english native speaker and my knowledge in english litterature is ... poor).

So, I update the script to directy display the "metadata" version :)

As read in another comment the shortcut key is really "SHIFT during few seconds and then C" ! :)

To conclude and let my kids be able to read this clock too, I started a french version of the text. I just started to gather french book extracts.

If you are french, or read french books, and want to participate, feel free to contact me ! :)))

For sure, I'll share back the result to the french community ;-)

0
None
iancarbarns

Question 9 months ago

Great idea! But I have a couple of problems you might be able to help with!

1.
The time is exactly 2 hours out. It's showing GMT and I am in CEST. My Kindle's time is set correctly. I saw your instruction that I might need to change TZ=CEST in timelit.sh, but that should be correct. It also doesn't seem to make any difference if I do change it. What could be wrong?

2.
Pressing 'page forward' doesn't show the image version with source details. All the metafile *.png's are present, it's as though it doesn't recognise that I have pressed 'page forward'. I do have Launchpad installed and working (it reacts properly to Shift-C). What could be wrong?

9 answers
0
None
Andrew Hannayiancarbarns

Answer 4 months ago

I wanted to see the credits all of the time so I just renamed all of the files in the metadata folder to the same names as the main images folder by just doing a search and replace removing _credits from the end of the file name. I then deleted all the files in the images folder (or moved them to another folder) and moved the all the image files from the metadata folder into the images folder.

0
None
tjaapiancarbarns

Answer 9 months ago

Regarding the shortcut: I too have noticed that sometimes the page forward button does not work as expected. I think this happens when the Kindle starts with the clockisticking file already in place. Consider it a bug in this young open source project :) I will try to come up with a fix, but for now you should be able to fix it by running

sh /mnt/us/timelit/showMetadata.sh

on the command line. If that does not work, remove the clockisticking file and restart, and then start the clock using the shortcut.

0
None
hammockjockeytjaap

Reply 9 months ago

Removing the TZ=CEST from timelit.sh "worked" in that it picks up the time set on the device, but that does not seem to be keeping up with other clocks reliably. If anyone figures out the correct TZ code for US east I would appreciate it.

https://en.wikipedia.org/wiki/List_of_tz_database_...
I have tried the following without effect:
TZ=America/New_York
"TZ=America/New_York"
'TZ=America/New_York'

0
None
iancarbarnshammockjockey

Reply 9 months ago

The time on your kindle should periodically synchronise with Internet Time if WiFi is turned on. It shouldn't drift out much even if WiFi is off (until the battery goes flat).

In the formats you are quoting, an equivalent of TZ=CEST would be 'Europe/Zurich' so you're maybe on the wrong track. Have you tried "TZ=EST" (ie US Eastern Standard Time)?

If you want to do it yourself in Linux, see

https://community.intersystems.com/post/setting-tz-environment-variable-linux

1
None
iancarbarnstjaap

Reply 9 months ago

For page advance not showing the quote source, the author's suggestion to me of

(a) deleting the 'clockisticking' file so the clock does not start 'ON' and

(b) running the script from the linux command line a single time:

sh /mnt/us/timelit/showMetadata.sh

I'm
just guessing, but I think the issue is that it doesn't like the empty
'clockisticking' file but is OK when it gets some valid content there to
start with

1
None
SubstitučníPiancarbarns

Answer 9 months ago

Hello, regarding ssh over wifi on Kindle 3:

I only changed "K3_WIFI="true" in usbnetwork config and after ;debugOn and ~usbNetwork commands I can connect to K3 on K3 DHCP wifi IP - so no need of changing static IP (usb cable must be unplugged) .

1.) and 2.) I had exactly same problems. Try to remove TZ=CEST from config so it looks like MinuteOTheDay="$(date-R +"%H%M")"; this - it works for me

0
None
iancarbarnsSubstitučníP

Reply 9 months ago

This fix for the time works, except you missed a space out.

With the line in timelit.sh changed to remove TZ=CEST so it looks like

MinuteOTheDay="$(date -R +"%H%M")";

the literary clock seems to simply pick up the Kindle's time (as set in [Menu] [Settings]). And that should be good for everyone!

0
None
tjaapiancarbarns

Answer 9 months ago

I think I saw the same thing when experimenting. I was fiddling around with these commands...

# set time to CEST
echo "Zone CEST +2:00 - CEST" > CEST.zone
zic CEST.zone -d /usr/share/zoneinfo
export TZDIR=/usr/share/zoneinfo TZ=CEST
# set hardware clock to system time:
hwclock -w

... but then I figured it's fine to leave the Kindle set to UTC/GMT, because I can change the time to the right timezone in timelit.sh, so that is what happens.

To see what your system time is now, try these commands:

date; date -u; hwclock -r

To manually synchronise the time by checking a time server, run:

/usr/sbin/updatetime

If it is synchronised and you did nothing else, the script should work fine.

0
None
steveistheman

Question 9 months ago

Has anyone figured out a fix for the metafile display?

So far the 'pg forward' button will work based on the author's suggestion to run

sh /mnt/us/timelit/showMetadata.sh

via command line SSH. However, this stops working as soon as I close the SSH session.

I have tried to delete the clockisticking file also with no effect.

1 answer
0
None
Andrew Hannaysteveistheman

Answer 4 months ago

I wanted to see the credits all of the time so I just renamed all of the files in the metadata folder to the same names as the main images folder by just doing a search and replace removing _credits from the end of the file name. I then deleted all the files in the images folder (or moved them to another folder) and moved the all the image files from the metadata folder into the images folder.