BookHolder: a Smart Reading Station for Focused Study

by Ribbens Niels in Circuits > Raspberry Pi

163 Views, 2 Favorites, 0 Comments

BookHolder: a Smart Reading Station for Focused Study

ChatGPT Image Jun 17, 2026, 07_03_30 PM.png

Introduction


We don't read like we used to. Most of what crosses our eyes now is built to interrupt us. Short, loud, optimised to pull attention away the second it lands. Sitting down with a physical book for an hour has quietly become a hard thing to do.

The BookHolder is my attempt to defend that hour. It's a smart reading station that holds your book open, recognises which book you're reading, and tunes the whole environment around a single, focused session: it watches the air, adapts the light, and tracks how long you actually read.

Here's what it does:

  1. Knows your book. A bookmark with an RFID tag tells the station which book is on the cradle, and loads that book's own colour profile.
  2. Sees the book is really there. An ultrasonic sensor confirms a book is physically present, so the reading timer only counts when you're genuinely reading.
  3. Watches the air. A CO₂ sensor measures air quality, stale air kills concentration. When CO₂ climbs past your threshold, the LED strip flashes red and the website warns you.
  4. Adapts the light. A light sensor measures the room; if it gets dark, the reading lamp brightens automatically. An RGB strip washes light downward (like the strips people mount under a bed) to light the page without glaring into your eyes.
  5. Tracks your sessions. Every session is logged to a database. You see live values and history like reading time per book, CO₂ over time etc, on a 5 inch touchscreen and on a responsive web dashboard.

It's built around a Raspberry Pi 5, a wooden book cradle, and a large 3D-printed box. Everything below is enough to rebuild it from scratch. [" hier komt of komen foto's van mijn eindproduct zodat de gebruiker al direct weet wat ik maak en hoe het eruit ziet"]

Supplies

Screenshot 2026-06-17 231437.png

Parts, Tools and Cost


Electronics & power

  1. Raspberry Pi 5 (4 GB) — central controller — Qty: 1 — €94.95 — https://www.raspberrystore.nl/PrestaShop/en/Raspberry_pi_5/507-raspberry-pi-5-4gb-5056561803319.html
  2. Waveshare 5" DSI touchscreen — on-device display + UI — Qty: 1 — €37.00 — https://www.waveshare.com/5inch-dsi-lcd.htm
  3. RC522 RFID reader (+ RFID bookmark tags) — detects which book is on the holder (SPI0) — Qty: 1 — €3.00 — https://opencircuit.be/product/rc522-rfid-reader-writer-module-kit-13.56mhz
  4. MH-Z19C CO₂ sensor — measures air quality, NDIR, 0–5000 ppm (UART) — Qty: 1 — €17.50 — https://www.tinytronics.nl/nl/sensoren/lucht/co2/winsen-mh-z19c-co2-sensor-met-kabel
  5. BH1750 light sensor — measures ambient light in lux (I²C) — Qty: 1 — €2.25 — https://www.hobbyelectronica.nl/product/bh1750-digitale-licht-sensor/
  6. HC-SR04 ultrasonic sensor — detects whether a book is on the holder — Qty: 1 — €2.99 — https://elektronicavoorjou.nl/product/hc-sr04-sensor/
  7. WS2812B RGB LED strip (2 m, addressable) — book lighting + colour profile + CO₂ alarm — Qty: 1 — €15.99 — https://www.amazon.com.be/-/nl/dp/B0D5B5CGVX/
  8. SN74AHCT125 level shifter — shifts the Pi's 3.3 V data to 5 V for the LED strip — Qty: 1 — €13.99 — https://www.amazon.com.be/-/nl/SN74AHCT125N-drie-state-uitgangschips-stopcontacten-schakelingen/dp/B0DXK7PWTN
  9. Dimmable USB reading lamp (PWM-dimmed via GPIO + transistor) — adaptive reading light — Qty: 1 — €16.99 — https://www.amazon.com.be/-/en/dp/B0FNMTDNP6
  10. Raspberry Pi 5 27 W USB-C power supply — stable power for the Pi 5 — Qty: 1 — €12.95 — https://www.123-3d.nl/RaspberryPi-Raspberry-Pi-5-USB-C-voeding-wit-27W-4263039-SC1152-i10276.html

Build materials

  1. Adjustable wooden book stand — holds the book open, both hands free — Qty: 1 — €20.99 — https://www.amazon.com.be/-/nl/Boekenhouder-verstelbare-boekenstandaard-draaibaar-opvouwbaar/dp/B0DZXMB8HJ/
  2. Misc (resistors, jumper wires, PCB, NPN transistor) — wiring + PWM driving — Qty: 1 set — €10.00 — Kiwi Electronics
  3. PLA filament (1 kg, 1.75 mm) — for the printed box and the sensor clamp — Qty: 1 spool — €21.00 — https://www.atome3d.com/products/bambu-lab-pla-basic-noir-black-1-75-mm-1-kg



Build materials & tools

  1. 3D printer (I used a Bambu Lab H2C)
  2. Soldering iron, wire strippers and screwdrivers
  3. A multimeter (saves you a lot of pain)

Rough total: ±€230–320, depending on what you already own. ["Hier een foto waar alle componenten mooi naast elkaar liggen om het publiek een duidelijk beeld te geven van wat ik heb gebruikt"]

Wiring and Fritzing Schema

Screenshot 2026-06-17 231709.png
Screenshot 2026-06-17 231753.png
IMG_9287 (1).jpg

[FRITZING: "Hier een afbeelding van mijn Fritzing schema"]

[FOTO: "Hier een echte foto van mijn bedrading".]


Key wiring notes (the things that actually bit me):

  1. Two SPI buses, on purpose. The RC522 RFID reader runs on SPI0. The WS2812B LED strip is timing-sensitive and needs its own bus, so it runs on SPI1 (board.SCK_1, board.MOSI_1). Putting both on SPI0 corrupts the LED timing, keep them separate.
  2. Level shifter for the LED data line. The Pi's GPIO is 3.3 V; the WS2812B expects ~5 V data. The SN74AHCT125 sits between them and shifts the data line up to 5 V. Skip it and the colours get flaky.
  3. HC-SR04 echo needs a voltage divider. The sensor's ECHO pin outputs 5 V, but the Pi's GPIO is 3.3 V only. Drop it with a simple two-resistor divider (e.g. 1 kΩ + 2 kΩ) or you risk the pin.
  4. CO₂ sensor over UART, BH1750 over I²C , enable both interfaces in raspi-config.
  5. Power budget. A 2 m WS2812B strip can pull real current. I only drive 30 of the 60 LEDs at low brightness, which keeps power and heat sane and is plenty for lighting. Power the strip from a proper 5 V supply, not the Pi's rail.



3D-Printing the Electronics Box

The electronics live in their own compact box, designed in Fusion 360 and printed on a Bambu Lab H2C. The front panel holds the 5" touchscreen on the left and the RFID reader on the right; the Raspberry Pi and the wiring sit inside, with ventilation slots along the side. Keeping the box separate from the book holder means it stays small and tidy on the desk, and the book gets its own dedicated surface (Step 4).

[FOTO: "Foto van het preprocess ".]

[FOTO: "Foto van de case".]

Tip that saved hours of failed prints: before committing to the big overnight print, print small tolerance-test coupons, just the screen-cutout corner, the sensor holes, a screw boss, and a seam joint. Check the fit on those first, fix tolerances, then run the full part overnight. A 12-hour print that's 0.3 mm off is a 12-hour mistake.


👉 3D files attached in Step 9.

The Wooden Book Holder and Ultrasonic Detection

The book rests on a separate, wooden book holder, sturdier and warmer-looking than plastic, and angled so the pages stay open and both your hands stay free for note-taking.

A 3D-printed clamp grips the back edge of the board and holds the HC-SR04 ultrasonic sensor so it hovers above the shelf, pointing straight down at the reading surface. With no book on the holder it constantly reads about 7 cm to the empty board. The moment you place a book, that distance drops sharply and that's how the station knows a book is actually there, not just a bookmark tag lying nearby.

[FOTO: "Foto van mijn plankje met een boek op".] [FOTO: "Foto van de clamp die het de sensor vast houdt".]


Assembly

Fit the Pi, touchscreen, RFID reader, CO₂ and light sensors, level shifter and shutdown button into the electronics box. On the wooden holder, run the LED strip along under the front edge (facing downward so it lights the page, not your eyes) and clamp the ultrasonic sensor above the shelf. Then connect the two parts with the sensor and LED wiring. [FOTO: "Tijdens het proces van het te installeren".]

Raspberry Pi and Software Setup

I used the Pi 5. Setup outline:

  1. Flash Raspberry Pi OS, then enable SPI, I²C and UART in raspi-config.
  2. Create a virtual environment and install the libraries (neopixel_spi, RFID, sensor libs, the web framework).
  3. Drive the LED strip with neopixel_spi on SPI1 (board.SCK_1, board.MOSI_1).


Gotchas worth knowing (Pi 5 specific):

  1. sudo does not inherit your virtualenv. If a script needs root, call the venv's Python by its full path; don't assume sudo python uses your environment.
  2. raspi-gpio doesn't exist on the Pi 5. Use pinctrl instead to inspect or toggle pins.
  3. The LED count must match exactly. If the number in the NeoPixel setup doesn't match the real strip, the timing breaks and the colours corrupt.



👉 Full code on GitHub (link in Step 9).

The Database (Normalised, 3NF)

The Database (Normalised, 3NF)


The data lives in a normalised MariaDB/MySQL database (at least 3NF). The design in short:

  1. Books — title, author, RFID tag, and an optional per-book RGB colour override.
  2. Genres — each genre carries a default RGB colour, so a book without its own colour falls back to its genre. The lamp colour is resolved with COALESCE(book_color, genre_color): book-level wins, genre is the fallback.
  3. Reading sessions — one row per session, linked to a book, with start/end time and duration.
  4. Event logs — one flexible table for everything time-stamped: a numeric_value column (CO₂ ppm, lux) and a boolean_value column (actuator on/off, alarms). This avoids the anti-pattern of a separate table or column per sensor — one clean log handles both sensor readings and actuator state changes.

👉 SQL schema attached in Step 9.

The Responsive Web Dashboard


The web dashboard mirrors and extends the touchscreen. It shows:

  1. Live values: current CO₂ (ppm), light level (lux), the active book, and the running session timer.
  2. History: total reading time per book over time, and CO₂ per session pulled from the database.
  3. Controls: a slider for lamp brightness (writes the PWM value to the Pi), an RGB colour picker per book profile, creating/resetting RFID bookmark profiles, and setting the CO₂ alarm threshold.

[FOTO: "foto van mijn schermpje en ook een screenshot van de website"]

How It All Behaves Together


Place a tagged book → the RFID reader identifies which book it is, and the HC-SR04 hovering over the holder sees the distance drop from its ~7 cm baseline, confirming a book is physically there → only then does the session timer start. (Both conditions stop false starts.)

Every ~30 s the Pi logs CO₂ and light.

CO₂ over threshold → LED strip flashes red.

Too dark → lamp brightens automatically (PWM, based on the BH1750).

Remove the book → session closes, duration is computed and stored, lamp fades off.

[FOTO: "foto van wanneer er een boek gescanned wordt"]

Code and Downloads


  1. Code (GitHub): https://github.com/howest-mct/2025-2026-projectone-mct-RibbensNiels
  2. 3D files: [3D file: "Hier zou normaal gezien de 3D bestanden komen te staan MAAR instructables laat mij niet toe om iets te uploaden..."]
  3. Database schema: https://github.com/howest-mct/2025-2026-projectone-mct-RibbensNiels/blob/main/data/BookHolder.sql
  4. Wiring: [FRITZING file: "Hier zou normaal gezien het Fritzing schema komen te staan MAAR instructables laat mij niet toe om iets te uploaden..."]
  5. Bill of Materials: [BOM file: "Hier zou normaal gezien de BOM komen te staan MAAR instructables laat mij niet toe om iets te uploaden..."]

Closing

Closing


The BookHolder isn't really about the sensors. It's about protecting the kind of attention a good book asks for and giving that hour the environment it deserves. If you build your own version, I'd love to see what you change.