A Not-So-Lighthearted Intro
By the numbers, our society has never had it better. Worldwide poverty is declining, more and more people can read and write, and violence and crime continue to drop. Yet, the daily news remains dominated by unsettling headlines: fear of excessive migration, fear of unemployment, fear of the next stock market crash, the war in Ukraine and the escalating conflict with Russia, increasingly strident voices from extremists on both the left and the right that grow louder in political debates and on the streets, and over everything looms the threat of climate change. The globalized world keeps spinning ever faster, and the desire to simplify is immense. The temptation is strong to follow those who promise quick fixes to complex problems. But unfortunately, simple solutions are rareâif they existed, we would have solved most of our global issues by now.
A Book Which Finds You
Thankfully, thereâs a vast amount of literature exploring the challenges of our time, offering fresh perspectives, deeper insights, and potential ways forward. Books have preserved the wisdom of experts, historians, and entire civilizations, allowing us to learn from their successes and failures. By turning the pages of a thoughtful work, we can find new angles on old problems and better understand the complexities of our modern world. Yet how do we pick the perfect book from such an overwhelming selection? And what if we didnât have to choose at allâwhat if the right book found us?
Enter âDas Buchâ (in English, âThe Bookâ), which plays with precisely that idea. Imagine a volume that automatically checks the dayâs news, hunts down a relevant title, summarizes it, and then displays this information on its own cover. Thatâs exactly what âDas Buchâ does.
Please note that âDas Buchâ is an art project, not meant to solve any of the pressing issues we face. Itâs my humble way of commenting on the swirl of daily news and the search for deeper insight by creating something tangible. Iâm not claiming to have the answers, but I hope it sparks reflection, curiosity, and conversation.
Sitting on the shelf, it looks like any other bookâexcept the spine is blank, and the cover is stark white, hinting that it could be about absolutely nothing or, perhaps, absolutely everything.
Pick it up, and you realize itâs actually quite different. Its pages mirror whateverâs in the headlines, presenting a real bookâs theme, title, and authorâjust when you need them most. In a world thatâs increasingly hard to navigate, âDas Buchâ extends a friendly hand: âHey, want to learn more? Hereâs a suggestion.â It offers guidance and a bit of stability amid the chaos of the daily news.
Laid open, âDas Buchâ becomes a window onto current global events. It invites you to investigate the news item it references and delivers literary context to go with it.
A Look Inside The Book
You can probably guess how it works from the description: hidden inside the cover is a microcontroller that checks current headlines via the API of a news outlet (in this prototype, Germanyâs âTagesschauâ). One news item is randomly selected, then forwarded to OpenAI. OpenAI replies with an author, a title, and a summary of a book that deals with the news topic. These details are displayed on an e-paper screen embedded in the cover. And there you have itâa book that keeps its finger on the pulse of the world, nudging you toward deeper understanding and fresh ideas, one headline at a time.
String prompt = "Research existing, real books related to the topic [" + message + "]. Return exactly one result in this format: { 'author': 'author of the book', 'title': 'title of the book', 'description': 'Summary of the book, not longer than 3 sentences.' }";
Basic Program Flow
- Wake up
- Connect to Wifi
- Fetch the latest news from the german âTagesschauâ API
- Select a random headline from the JSON data
- Query OpenAI with the headline to find a related book
- Display the bookâs author, title and a short summary on the e-paper
- Go back to deep sleep
Like many of my other projects, this one uses an ESP32 microcontroller. Itâs inexpensive, has built-in Wi-Fi, and can operate on battery power thanks to its low energy consumption. The battery is connected to the ESP32 via a battery shield that regulates power and prevents overcharging.
Getting the microcontroller to connect to Wi-Fi and exchange data with an API was fairly straightforward. Iâd already tackled this task in several previous projects (for instance, my Flower Power plant). If youâre curious about the details, take a look at the source code on GitHub.
Waveshare E-Paper
Getting the e-paper display up and running was much more challenging. There really wasnât an alternative, though, because e-paper only consumes power when it refreshesâand in my setup, that happens just once every 12 hours. Besides, the idea of using digital paper for a book seemed too fitting to pass up.
I used the GxEPD2 library from GitHub, which was a huge help. It lets you display images and text, and thankfully text was all I needed. However, aligning and wrapping that text properly was quite a headacheâthereâs no built-in line wrapping or centering functionality. In the end, I wrote my own text wrap and align functions (with substantial help from GPT).
The code for adding line breaks and centering text
/**
* @brief Inserts line breaks into a String at a defined interval or at the last space.
*
* This function searches for a space within the next 'number' characters
* and inserts a newline. If no space is found, it forces a newline at the 'number'
* character. This helps in nicely wrapping text for display.
*
* @param text The original String in which to insert line breaks
* @param number The maximum number of characters before wrapping
* @return String The modified String with inserted line breaks
*/
String addLineBreaks(String text, int number) {
int length = text.length();
int currentIndex = 0;
while (currentIndex < length) {
// Find the last space character within the next 'number' characters
int breakIndex = text.lastIndexOf(' ', currentIndex + number);
// If no space is found, or it's out of range, use the exact 'number' position
if (breakIndex == -1 || breakIndex <= currentIndex) {
breakIndex = currentIndex + number;
if (breakIndex >= length) break; // Avoid out-of-bounds
}
// Insert a newline at the break index
text = text.substring(0, breakIndex) + "\n" + text.substring(breakIndex + 1);
// Move currentIndex past the inserted newline
currentIndex = breakIndex + 1;
// Update the length of the text due to the insertion of the newline
length = text.length();
}
return text;
}
/**
* @brief Draws a single line of text centered horizontally on the display.
*
* @param text The text to display
* @param characterLengthOffset horizontal offset based on character length
* @param y The vertical position to place the text
*/
void displayCenteredLine(const char* text, int16_t characterLengthOffset, int16_t y)
{
int16_t tbx, tby;
uint16_t tbw, tbh;
// Calculate text bounds for centering
display.getTextBounds(text, 0, 0, &tbx, &tby, &tbw, &tbh);
// Center the line with offset
int16_t x = ((display.width() - tbw) / 2) + characterLengthOffset - tbx / 2;
u8g2_for_adafruit_gfx.setCursor(x, y);
u8g2_for_adafruit_gfx.print(text);
}
3D-Printed Book Case
3D printing is fantastic for prototyping. If you happen to be a whiz at 3D modeling (which I very much am not), you can transform a hand-drawn sketch into a physical objectâcomplete with the exact specs you needâin anywhere from a few minutes to a few hours. The catch is that 3D prints rarely end up looking or feeling one-of-a-kind. Thereâs always that slight plastic vibe that screams, âI was 3D printed!â Plus, the ease of 3D printing can tempt you into taking shortcuts too often, which might keep you from exploring more challenging (but possibly superior) design paths.
For this project, though, speed was key. I wanted to test the concept quickly, and white PLA filament blended nicely with the e-paper displayâso it felt like a decent compromise. But if Iâm being honest, the result is a bit less magical than it might have been if it werenât made of plastic.
The book is fully assembled now. I glued the e-paper display to the plastic front cover, measured the case carefully so it would mimic a real bound book, and left a tiny notch on the left side for the displayâs flat cable to pass through. With just two refreshes per day, the battery can last for weeks. And even once itâs drained, the e-paper display still shows the last recommended book on the coverâwhich is the kind of magic only digital ink can pull off.
Bill Of Materials
The Waveshare e-paper is by far the priciest component in this entire build. I really didnât have a choice, thoughâI absolutely and desperately had to play around with it. Actually, make that âthem,â since I ordered two. Everything else was just spare parts I already had lying around.
Pro Tip: Always order more than you need. Then, when youâre asked about the cost, you can say, âI only used spare parts I had lying around,â which greatly reduces the official project expenses (and keeps your significant other off your case).
Part | Info | Where to get | Cost |
---|---|---|---|
Waveshare e-paper | These are quite expensive | AliExpress | 66 EUR |
ESP32 Mini | These have Wifi & Bluetooth onboard | Amazon | 11 EUR |
ESP32 Mini Battery Shield | Youâll get three of them | Amazon | 9 EUR |
2000mA LiPo Battery | I used a spare one I already had | Amazon | 11 EUR |
PLA Filament | It took me several tries to get it right enough | Amazon | 4 EUR |
Some magnets | Stole them from the fridge | My fridge (still have plenty) | free |
Total cost | 101 EUR |
Final Thoughts
Das Buchâ is probably at about 80% of what I originally envisioned, but itâs close enough to convey the core idea. Polishing or expanding it further would be a battle against my limited free timeâand right now, a bunch of other fun ideas and shiny new hardware are piling up on my desk. So I think Iâll leave it as it is.
If I were to iterate on it, hereâs what I might do:
- Reuse a real old book as the case
- Extend the reset button to the outside so I can easily refresh it with a new recommendation
- Use a different API with clearer declarations of top news
- Add a button to send a reading sample from Amazon to a Kindle device
- Improve checks for hallucinations (they do happen, but only occasionally)
- Enhance error handling in general
Thatâs it! Thanks for readingâfeel free to share any comments or feedback. Iâd love to hear your thoughts.