Introduction: Time to Live

About: Hi, we’re Dane & Nicole, two makers that create stuff, which we happily share with you!

Combining the magic of watching all the Harry Potter movies in a week and the networking term TTL (Time To Live), we're going to build our own black magic book, showing how long you have to live.


  • Raspberry Pi 3 Model B
  • Push Button (any)
  • Adafruit Standard LCD - 16x2 White on Blue
  • Dremel 4300
  • Bookbinders Glue
  • Fire

Step 1: Project Video

Step 2: Book

It starts with finding an old book to use. Make sure it's nice and thick so you have plenty of space for the electronics. A great place to look are thrift stores, they have loads of cheap old books. In this case I've found a medical book from the 80's. Perfect, as it has a lot of cool images to use for styling.

Now we have our book, we're going to glue most pages together to create a nice "block". I've used some bookbinder's glue because it dries nice and see through. I think you can also use different types, but I haven't tested it. Put some glue between the pages and press them firmly.

To speed things up you can also glue the sides together, a combo of this and full page gluing creates a solid block.

After drying, it's time to cut out our electronics compartment, a Dremel with the woodcutting wheel works perfectly. Make sure to wear some protection, it creates a lot of dust.

That's one nice compartment, just add some extra duct tape for strength. Full instructions for creating a secret book compartment, can be found here.

Next step is adding a "lid" to our compartment. Gluing some pages together gives us a basic lid. Adding a magnet means we can open and close our compartment.
Cut out a little indent and glue both the magnet (next to our compartment) and metal plate (bottom of lid) in place.

With our compartment and lid in place, our book is almost done. To give the visible page the right (creepy) look and feel you can do the following:

  • Cutting and gluing images on the page (skulls and plants in this case)
  • Burning the images/pages and submerging them in water
  • Carving a sentence into the page and going over it with charcoal
  • Anything else that comes to mind, you can go nuts...

Step 3: Electronics

Now we can move on to the electronics. We will need the following parts:

  • Raspberry Pi (Arduino,...)
  • A push button (any)
  • Small LCD screen
  • Powerbank or Powerplug

These are two great tutorials to wire up the button and screen. With everything wired up, measure the button/screen and cut holes into the lid for a snug fit.

Step 4: Code

Almost there!

The only thing left is the magic part. You can find the full code in the attachments. For good measure, a quick overview of the logic:

  • Listen if button is pushed
  • If so, generate a time(amount of seconds) and display it
  • Button is not pushed, check if the time is 0 If there's time left, lower it by one, and display what's left.
  • No time remaining, say Bye Bye

You can tweak the amount of time you give to the unfortunates in the following line of code:

number = random.randint(1,60) 

You can also change the messages displayed in these lines:

lcdShowMessage("Time to live", lcdLine1) 

lcdShowMessage("Bye Bye" , lcdLine2)

lcdShowMessage(str(number) , lcdLine2)

Step 5: Result

And that's all!

Now we have a magic spell book, perfect for a very early Halloween!