DIY Auto Book Finder Robot for Kids | Raspberry Pi

DIY Auto Book Finder Robot for Kids | Raspberry Pi & Arduino Touchscreen Bookshelf Project
🎓 Ages 11+ ⏱️ Weekend Build 🔧 Intermediate

Build an Auto Book Finder Robot! 📚

Press a book number on a touchscreen. Watch the whole bookshelf glide sideways. Then — pop! — the correct book slides right out. This DIY robotics project uses a Raspberry Pi touchscreen, an Arduino, a stepper motor, and a servo to build your very own mini automatic library.

Cartoon auto book finder shelf with touchscreen TAP A BOOK POP!

Imagine tapping the number "5" on a screen — and instead of you searching the shelf, the whole shelf slides over to you, lines up book #5 with a little door, and pops it right out. That's exactly what we're building in this DIY robotics project. It combines a Raspberry Pi touchscreen for the "brain and face" of the robot with an Arduino for the "muscles" — a stepper motor that slides the shelf, and a servo that pops the book free.

📖 Our Build Plan

  1. 🧰 Full Parts List
  2. 🧠 The Two Brains: Pi + Arduino
  3. 1 Build the Sliding Shelf
  4. 2 Homing Switch (Position Zero)
  5. 3 Stepper Motor — The Shelf Mover
  6. 4 Servo Pusher — The "Pop-Out"
  7. 5 Touchscreen Book Selector
  8. 6 Connecting Pi ↔ Arduino
  9. 🧩 Full Combined Code
  10. Testing Checklist
  11. FAQ
🧰

Full Parts List (Shopping List)

PartQtyUsed For
Raspberry Pi (3B+ or 4)1Runs the touchscreen app — the "face" of the robot
HDMI touchscreen display (5"–7")1Lets you tap a book number
Arduino Uno1Controls the motors — the "muscles"
NEMA 17 stepper motor1Slides the whole shelf sideways
A4988 (or DRV8825) stepper driver1Powers and controls the stepper motor
GT2 belt + pulleys, or threaded rod1 setTurns motor spin into shelf sliding motion
Linear rail or drawer slides1 setLets the shelf glide smoothly
Micro limit switch1Tells the shelf where "position zero" is
SG90 or MG995 servo motor1Pushes the chosen book out through the window
12V power supply1Powers the stepper motor driver
USB cable (Pi to Arduino)1Sends commands and can power the Arduino too
Cardboard, wood, or 3D-printed shelf frame1The bookshelf body itself
🛒 Tip: Drawer slides from an old cabinet work great as a cheap, sturdy linear rail for the shelf carriage!
🧠

The Two Brains: Raspberry Pi + Arduino

This project actually uses two computers working as a team, and that's a really useful robotics idea to learn:

  • 🖥️ Raspberry Pi — draws the touchscreen buttons and handles what you tap. It's great at graphics and screens, but not great at precisely timing motors.
  • ⚙️ Arduino — is excellent at precisely timing motor steps and reading sensors, but has no screen. It waits for a simple message like GOTO:5 from the Pi, moves the shelf, pops the book, then replies DONE.
💡 Fun fact: Splitting a big robot's job between two computers like this — one for the user interface, one for real-time motor control — is exactly how many real factory robots and 3D printers are designed!
1

🪑 Build the Sliding Shelf

📢 What it does: Holds all your books in numbered slots, and can glide smoothly left and right along a rail.

How it works: The entire shelf (with every book slot) sits on a carriage attached to a drawer slide or linear rail. A belt connects the carriage to the stepper motor, so when the motor turns, the whole shelf slides — not just one book. A fixed "window" cut into the front housing stays in one place; whichever book slot lines up with the window is the one that can pop out.

  1. Attach your drawer slide (or linear rail) horizontally inside a sturdy frame.
  2. Build a shelf insert with evenly spaced slots (e.g. 4cm apart) — number them left to right starting at 0.
  3. Mount the shelf insert onto the sliding carriage.
  4. Cut a small rectangular "window" opening in the front panel, just big enough for one book to pop through.
  5. Attach one end of a GT2 belt loop to the carriage, running it around a pulley on the stepper motor shaft and an idler pulley at the far end.
💡 Fun fact: This is the same basic idea as a CNC machine or 3D printer's X-axis — a motor, a belt, and a sliding carriage!
2

🎯 Homing Switch (Position Zero)

📢 What it does: Tells the robot exactly where "book slot 0" is, so every future move is measured from a known starting point.

How it works: A small limit switch is placed at one end of the rail. Every time the robot starts up, it slowly slides the shelf toward the switch until it gets pressed — that's "home," or slot 0. From there, the Arduino always knows how many steps to move to reach any other slot.

Arduino Uno Limit Switch → Pin 6
  1. Mount the limit switch at the far-left end of the rail, so the carriage presses it when fully retracted.
  2. Wire one leg to GND, the other to Arduino digital pin 6.
  3. We'll use INPUT_PULLUP in code, so no extra resistor is needed.
3

⚙️ Stepper Motor — The Shelf Mover

📢 What it does: Precisely slides the shelf left or right by an exact number of steps, so it always stops at the correct book slot.

How it works: The Arduino sends fast electrical pulses to the stepper driver, and each pulse turns the motor shaft by one tiny "step." By counting pulses, the Arduino always knows exactly how far the shelf has moved — no guessing needed!

Arduino Uno A4988 Driver STEP→3, DIR→4 EN→5 NEMA 17 Stepper Motor 12V Supply → VMOT
  1. Connect the stepper motor's 4 coil wires to the A4988 driver's motor output pins (1A, 1B, 2A, 2B).
  2. Wire driver STEP to Arduino pin 3, DIR to pin 4, and ENABLE to pin 5.
  3. Connect the 12V power supply to the driver's VMOT and GND — never power the motor directly from the Arduino!
  4. Add a small capacitor (100µF) across VMOT and GND close to the driver, to protect it from voltage spikes.
⚠️ Safety note: Always double-check driver wiring with an adult before connecting power — a reversed connection can damage the driver.
4

👉 Servo Pusher — The "Pop-Out"

📢 What it does: Gives the aligned book a gentle nudge so it pops out through the window — the most satisfying part!

How it works: The pusher servo sits fixed right behind the window (it does not move with the shelf). Once the shelf stops with the correct book lined up, the servo arm swings forward, taps the spine of the book, and springs back to rest.

Arduino Uno SG90/MG995 Signal → Pin 9
  1. Mount the servo just behind the window opening, with its arm resting flat (not blocking the slot).
  2. Connect the signal wire to Arduino pin 9, power to 5V, ground to GND.
  3. If using a heavier MG995 servo, power it from a separate 5V source sharing a common ground with the Arduino.
5

🖐️ Touchscreen Book Selector

📢 What it does: Shows a friendly grid of book numbers on the touchscreen — tap one, and the search begins!

How it works: A simple Python app runs full-screen on the Raspberry Pi, showing one big button per book. When tapped, it sends a short text message to the Arduino over USB and shows a "Finding book..." status until the Arduino replies that it's done.

Tap a book number! 1 2 3 4 5 Here is book 3! 📖
  1. Install Python and the pyserial library on the Raspberry Pi.
  2. Write a small Tkinter app with one button for each book number.
  3. When a button is tapped, send GOTO:<number>\n to the Arduino over serial.
  4. Show "Finding book..." until the Arduino replies DONE, then celebrate!
# touchscreen_app.py — runs on the Raspberry Pi
import tkinter as tk
import serial
import time

ser = serial.Serial('/dev/ttyACM0', 9600, timeout=5)
time.sleep(2)  # give Arduino time to reboot after connecting

def find_book(book_number):
    status_label.config(text=f"Finding book {book_number}...")
    root.update()
    ser.write(f"GOTO:{book_number}\n".encode())
    while True:
        line = ser.readline().decode().strip()
        if line == "DONE":
            status_label.config(text=f"Here is book {book_number}! 📖")
            break

root = tk.Tk()
root.title("Auto Book Finder")
root.attributes('-fullscreen', True)
root.configure(bg="#FBF3E7")

status_label = tk.Label(root, text="Tap a book number!",
                         font=("Fredoka", 28), bg="#FBF3E7")
status_label.pack(pady=30)

frame = tk.Frame(root, bg="#FBF3E7")
frame.pack()

colors = ["#7B2D3B", "#C9A227", "#4C7A5D"]
for i in range(1, 11):
    btn = tk.Button(frame, text=str(i), font=("Fredoka", 22),
                     width=4, height=2, bg=colors[i % 3], fg="white",
                     command=lambda n=i: find_book(n))
    btn.grid(row=(i - 1) // 5, column=(i - 1) % 5, padx=10, pady=10)

root.mainloop()
6

🔌 Connecting Pi ↔ Arduino

📢 What it does: Lets the Raspberry Pi "talk" to the Arduino, sending book requests and receiving "done" replies.

How it works: A single USB cable does double duty — it powers the Arduino and carries the serial messages back and forth, just like a two-way text chat between the two boards.

Raspberry Pi Arduino Uno USB cable "GOTO:5" → / ← "DONE"
  1. Plug the Arduino into the Raspberry Pi with a standard USB cable.
  2. Find the Arduino's port name (usually /dev/ttyACM0) using the Arduino IDE or terminal.
  3. Make sure both the Arduino sketch and Python app use the same baud rate — 9600 in our code.
💡 Fun fact: This kind of message like GOTO:5 is called a "serial protocol" — a simple shared language two devices agree to speak so they always understand each other.
🧩 See the Full Combined Code (Arduino + Python)

Once each part works on its own, put it all together like this.

Arduino sketch (shelf_control.ino)

// ===== AUTO BOOK FINDER — Arduino side =====
#include <AccelStepper.h>
#include <Servo.h>

#define STEP_PIN 3
#define DIR_PIN 4
#define ENABLE_PIN 5
#define LIMIT_PIN 6
#define SERVO_PIN 9

AccelStepper shelf(AccelStepper::DRIVER, STEP_PIN, DIR_PIN);
Servo pusher;

const long stepsPerSlot = 800; // tune this to your belt/pulley setup
const int restAngle = 0;
const int pushAngle = 90;

void homeShelf() {
  shelf.setSpeed(-300);
  while (digitalRead(LIMIT_PIN) == HIGH) {
    shelf.runSpeed();
  }
  shelf.setCurrentPosition(0);
}

void popBook() {
  pusher.write(pushAngle);
  delay(500);
  pusher.write(restAngle);
  delay(300);
}

void setup() {
  Serial.begin(9600);
  pinMode(LIMIT_PIN, INPUT_PULLUP);
  pinMode(ENABLE_PIN, OUTPUT);
  digitalWrite(ENABLE_PIN, LOW); // enable the driver

  shelf.setMaxSpeed(1000);
  shelf.setAcceleration(500);

  pusher.attach(SERVO_PIN);
  pusher.write(restAngle);

  homeShelf();
}

void loop() {
  if (Serial.available()) {
    String cmd = Serial.readStringUntil('\n');
    if (cmd.startsWith("GOTO:")) {
      int bookNumber = cmd.substring(5).toInt();
      long target = bookNumber * stepsPerSlot;

      shelf.moveTo(target);
      while (shelf.distanceToGo() != 0) {
        shelf.run();
      }

      popBook();
      Serial.println("DONE");
    }
  }
}

Python touchscreen app (touchscreen_app.py)

# ===== AUTO BOOK FINDER — Raspberry Pi side =====
import tkinter as tk
import serial
import time

ser = serial.Serial('/dev/ttyACM0', 9600, timeout=5)
time.sleep(2)

def find_book(book_number):
    status_label.config(text=f"Finding book {book_number}...")
    root.update()
    ser.write(f"GOTO:{book_number}\n".encode())
    while True:
        line = ser.readline().decode().strip()
        if line == "DONE":
            status_label.config(text=f"Here is book {book_number}! 📖")
            break

root = tk.Tk()
root.title("Auto Book Finder")
root.attributes('-fullscreen', True)
root.configure(bg="#FBF3E7")

status_label = tk.Label(root, text="Tap a book number!",
                         font=("Fredoka", 28), bg="#FBF3E7")
status_label.pack(pady=30)

frame = tk.Frame(root, bg="#FBF3E7")
frame.pack()

colors = ["#7B2D3B", "#C9A227", "#4C7A5D"]
for i in range(1, 11):
    btn = tk.Button(frame, text=str(i), font=("Fredoka", 22),
                     width=4, height=2, bg=colors[i % 3], fg="white",
                     command=lambda n=i: find_book(n))
    btn.grid(row=(i - 1) // 5, column=(i - 1) % 5, padx=10, pady=10)

root.mainloop()

Testing Checklist

  1. ☐ On power-up, the shelf slides to the limit switch and stops (homing works)
  2. ☐ Tapping a number on the touchscreen shows "Finding book..." right away
  3. ☐ The shelf slides the correct distance and stops precisely at the right slot
  4. ☐ The servo pusher pops the book through the window and returns to rest
  5. ☐ The screen updates to "Here is book X!" once the Arduino replies DONE
  6. ☐ Pressing different numbers in a row each works correctly, one after another
⚠️ Always test moving parts slowly at first, keep fingers clear of the belt and rail, and build with an adult nearby — especially when wiring the 12V motor power supply.

Frequently Asked Questions

Do I really need both a Raspberry Pi and an Arduino?

Not strictly — you could run everything on a Raspberry Pi alone with GPIO libraries. But splitting the job (Pi for the screen, Arduino for exact motor timing) makes the project more reliable and is a great way to learn how real robots divide up their work.

Can I use a smaller display instead of a full touchscreen?

Yes — even a small OLED display with a few push buttons can work instead of a touchscreen. You'd swap the Tkinter app for simple button-reading code, but the Arduino side stays exactly the same.

How do I figure out the right "steps per slot" number?

Start by measuring your belt/pulley size to estimate steps per centimeter, then fine-tune by testing: send a small move command, measure how far the shelf actually moved, and adjust the number until it lines up exactly with one book slot.

What if the book doesn't fully pop out?

Try increasing the servo's push angle slightly, or check that the book slot is smooth enough for the book to slide without catching on the frame.

Is this project good for a school science fair?

Yes — it's a favorite for robotics fairs because it's visual, interactive, and demonstrates several real engineering ideas at once: motor control, sensors, and two devices communicating together.

📚 Built one step (and one belt loop) at a time. Happy building — and always work with an adult around power tools and electronics!

Comments

Product Cards
Buddy Bot eBook
⭐ New 2026 Release
Build Your
Own Robot!
3D design, wiring &
Arduino coding.
Young inventors love it!
🖨️
3D Print
All parts
Wire it
Circuit guide
💻
Code it
Arduino IDE
🤖
Watch it
Walk & react
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Website Offer
₹499 300
🌍 International: $5 USD
One-time · Instant digital delivery
🔒 Secured by Razorpay · Your data is safe
📄 Download Free Sample Copy
🔒 Secured by Razorpay · Your data is safe
🍓
Raspberry Pi Pico Mastery
21 Projects
⚡ Launch Price — 80% OFF
Learn Pico
Build 21 Projects!
MicroPython · Wokwi
IoT · Certificate
Perfect for beginners!
🖥️
Wokwi
No hardware
🐍
MicroPy
From zero
🔨
21 Projects
IoT + sensors
📄
Certificate
Verified cert
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Launch Offer
₹999 200 80% OFF
🌍 International: $5 USD
One-time · Lifetime access · No subscription
🔒 Secured by Razorpay · UPI · Cards · NetBanking
🎉

You're in!

Payment successful! Your Buddy Bot eBook is ready. Time to build!

📖 Access Your eBook Now
🎉

Enrolled!

Payment successful! Lifetime access to all 21 Pico Projects is yours!

🍓 Go to My Course