Time To Live

About the project

How long do you have? A magic book to tell you exactly that!

Items used in this project

Hardware components

Standard LCD 16x2 white on blue Standard LCD 16x2 white on blue x 1
Raspberry Pi 3 Model B Raspberry Pi 3 Model B x 1
Push Button Push Button x 1

Software apps and online services

Raspberry Pi Raspbian Raspberry Pi Raspbian

Hand tools and fabrication machines

Fire Fire x 1
Bookbinders Glue Bookbinders Glue x 1
Dremel 4300 Dremel 4300 x 1

Story

Overview

Below a quick overview of the content.

  • Introduction and showcase video
  • Book
  • Electronics
  • Code
  • Result

Introduction & Showcase Video

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.

Project Video

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.

Medical Book

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.

Gluing pages together

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

Pages sides glued

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.

Cutting out a compartment

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.

Good old ducttape to cover up some mistakes

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.

Magnet and metal plate

The magnet glued 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...

Styled page

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.

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 leftNo 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)

Result

And that's all!

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

Final look and feel

Code

code.py

Code for the book

Credits

Photo of 8BitsAndAByte

8BitsAndAByte

We’re Dane & Nicole, two makers that create tremendously terrible tech, which we happily share with you on our channel! https://www.youtube.com/c/8bitsandabyte

   

Leave your feedback...