DIY AI Dictionary Eye | Raspberry Pi Object Recognition Robotics Project

DIY AI Dictionary Eye | Raspberry Pi Object Recognition Robotics Project for Kids
👁️ Kid-friendly robotics build

The AI Dictionary Eye

A glowing, blinking eye that watches your desk. Hold up an apple, a book, a bottle, or a pair of scissors, and it looks the object over, says its name out loud, and prints the label on a tiny glowing screen — all powered by a Raspberry Pi hidden inside its base.

Age12 and up
Build time5–6 hours
DifficultyAdvanced beginner
Cost$60–80
SCANNING...
🔊 —
Why build this

A desk gadget that actually looks at things

The AI Dictionary Eye hides a real Raspberry Pi Camera right where the pupil should be, tucked inside a craft eyeball prop like the ones used for dolls, costumes, or Halloween decorations — no real biological parts involved, just clever wiring. A small onboard AI model looks at whatever you hold up, works out what it is, and instantly speaks the object's name while showing the text label on a tiny screen. Everything runs locally on the Raspberry Pi itself, so it's a genuinely great hands-on introduction to cameras, on-device AI, speech output, and building an expressive robotic face with glowing LEDs and a blinking eyelid.

Shopping list

What you'll need

This project uses a Raspberry Pi as the brain, plus a handful of common electronics and craft parts.

Electronics

  • 1x Raspberry Pi 4 (2GB or more)
  • 1x Raspberry Pi Camera Module (v2 or v3)
  • 1x 0.96" I2C OLED display (SSD1306)
  • 1x MAX98357A I2S amplifier + small speaker
  • 1x WS2812B LED ring (8–12 pixels)
  • 1x SG90 micro servo (for the blinking eyelid)
  • 5V/3A USB-C power supply
  • MicroSD card (16GB or more)
  • Jumper wires and a small perfboard

Eye & enclosure

  • 1x large craft eyeball prop (acrylic or resin, 5–8cm)
  • Thin frosted or translucent blue plastic (iris diffuser)
  • Small felt or thin plastic eyelid flap
  • 3D-printed or foam-board eye socket mount and base
  • Hot glue and craft paint

Software

  • Raspberry Pi OS (64-bit)
  • Python 3 with picamera2 and OpenCV
  • tflite-runtime
  • A pretrained TFLite object detection model (COCO SSD MobileNet)
  • pyttsx3 for offline text-to-speech
The concept

How the eye "recognizes" an object

There's no cloud service involved — the whole recognition pipeline runs on the Raspberry Pi itself, using a small, pretrained AI model that already knows about 90 everyday object categories, including apples, books, bottles, and scissors.

Camera sees the object AI model on the Pi OLED shows the label Speaker says the name
1

Capture a frame

The Pi Camera continuously grabs images of whatever is in front of the eye.

2

Run the AI model

A small pretrained model checks the image against everyday object shapes it already knows and gives each guess a confidence score.

3

Pick the best guess

If the top score is confident enough, the code treats it as a real detection instead of a false alarm.

4

React

The eye blinks, the iris flashes brighter, the label appears on the OLED, and the speaker announces the object's name.

Kid-friendly tip: Press "Show it a new object" in the preview above — that mimics exactly what happens on the real device each time it recognizes something new.
Wiring

Circuit diagram

The Raspberry Pi's camera port, I2C pins, I2S pins, and a couple of PWM pins handle everything — no extra microcontroller needed.

Raspberry Pi 4 CSI · I2C · I2S · GPIO 12,13 Pi Camera (CSI port) OLED display SDA · SCL LED ring (iris glow) DIN → GPIO12 Servo (eyelid) Signal → GPIO13 I2S speaker amp BCLK 18 · LRC 19 · DIN 21
Camera connects via the dedicated CSI ribbon port OLED: SDA → GPIO2, SCL → GPIO3 LED ring DIN → GPIO12, Servo signal → GPIO13 Speaker amp: BCLK → GPIO18, LRCLK → GPIO19, DIN → GPIO21
Important: Power the LED ring and servo from the Pi's 5V rail only if you're using a small ring (under about 12 LEDs) and one small servo. For anything bigger, use a separate 5V supply with a shared ground to avoid overloading the Pi.
Assembly

Step-by-step build instructions

Build the eye's mechanics first, then wire everything up, then get the software working — test each part on its own before combining them.

1

Prepare the eye prop

Carefully cut or drill a pupil-sized hole in the craft eyeball, just big enough for the camera lens to peek through.

2

Mount the camera as the pupil

Fix the Raspberry Pi Camera directly behind the pupil hole, lens facing outward, and route its ribbon cable back toward the base.

3

Build the glowing iris

Place the small LED ring behind the iris area with a translucent blue diffuser layer in front, so the glow spreads evenly instead of showing individual dots.

4

Add the blinking eyelid

Attach a thin eyelid flap to the servo's arm, positioned above the eye so it can sweep down and cover the pupil briefly.

5

Mount the OLED label screen

Fix the OLED display on the base beside the eye, angled toward whoever is showing it an object.

6

Wire everything to the Raspberry Pi

Connect the camera, OLED, LED ring, servo, and speaker amplifier following the circuit diagram above.

7

Set up the Raspberry Pi

Flash Raspberry Pi OS onto the SD card, then enable the Camera, I2C, and I2S interfaces using raspi-config.

8

Install the software

Install picamera2, OpenCV, tflite-runtime, and pyttsx3, then download a pretrained TFLite object detection model and its label file.

9

Test each part separately

Run small test scripts for the camera preview, the OLED text, the LED glow, the servo blink, and the speaker before combining anything.

10

Run the full program

Start the complete script from the code section below and test it by holding up an apple, a book, a bottle, and a pair of scissors.

11

Tidy up and mount

Once it's working reliably, secure all the wiring inside the base and give the eye a final clean fit into its socket.

Raspberry Pi code

The code

This Python script captures frames from the camera, runs them through a pretrained object detection model, and reacts with the screen, LEDs, servo, and speaker.

# AI Dictionary Eye - Raspberry Pi
# Watches for everyday objects and announces what it sees

import time
import threading
import numpy as np
import cv2
from picamera2 import Picamera2
import tflite_runtime.interpreter as tflite
import pyttsx3
from board import SCL, SDA
import busio
from adafruit_ssd1306 import SSD1306_I2C
from PIL import Image, ImageDraw, ImageFont
from rpi_ws281x import PixelStrip, Color
from gpiozero import Servo

# ---------- OLED label screen ----------
i2c = busio.I2C(SCL, SDA)
oled = SSD1306_I2C(128, 32, i2c)

def show_label(text):
    image = Image.new("1", (oled.width, oled.height))
    draw = ImageDraw.Draw(image)
    font = ImageFont.load_default()
    draw.text((4, 8), text, font=font, fill=255)
    oled.image(image)
    oled.show()

# ---------- Glowing iris LED ring ----------
LED_PIN = 12
LED_COUNT = 12
strip = PixelStrip(LED_COUNT, LED_PIN)
strip.begin()

def glow_blue(brightness=60):
    for i in range(LED_COUNT):
        strip.setPixelColor(i, Color(0, 0, brightness))
    strip.show()

def flash_recognize():
    for b in list(range(60, 255, 15)) + list(range(255, 60, -15)):
        glow_blue(b)
        time.sleep(0.01)

# ---------- Blinking eyelid servo ----------
eyelid = Servo(13)

def blink():
    eyelid.max()
    time.sleep(0.15)
    eyelid.min()

# ---------- Offline text-to-speech ----------
tts = pyttsx3.init()

def speak(word):
    tts.say(word)
    tts.runAndWait()

# ---------- Load the pretrained object detection model ----------
interpreter = tflite.Interpreter(model_path="detect.tflite")
interpreter.allocate_tensors()
input_details = interpreter.get_input_details()
output_details = interpreter.get_output_details()
height, width = input_details[0]['shape'][1:3]

with open("labelmap.txt") as f:
    labels = [line.strip() for line in f.readlines()]

# ---------- Camera ----------
picam2 = Picamera2()
picam2.configure(picam2.create_preview_configuration(main={"size": (640, 480)}))
picam2.start()

last_spoken = ""
last_time = 0

print("Eye is watching... show it an object!")
glow_blue()

while True:
    frame = picam2.capture_array()
    img = cv2.resize(frame, (width, height))
    input_data = np.expand_dims(img, axis=0)

    interpreter.set_tensor(input_details[0]['index'], input_data)
    interpreter.invoke()

    boxes   = interpreter.get_tensor(output_details[0]['index'])[0]
    classes = interpreter.get_tensor(output_details[1]['index'])[0]
    scores  = interpreter.get_tensor(output_details[2]['index'])[0]

    best_score = 0
    best_label = None
    for i in range(len(scores)):
        if scores[i] > best_score:
            best_score = scores[i]
            best_label = labels[int(classes[i])]

    if best_score > 0.6 and best_label:
        now = time.time()
        if best_label != last_spoken or now - last_time > 4:
            show_label(best_label)
            flash_recognize()
            threading.Thread(target=speak, args=(best_label,)).start()
            blink()
            last_spoken = best_label
            last_time = now
    else:
        glow_blue()

    time.sleep(0.05)
Try this: Lower the 0.6 confidence number to make the eye react more easily, or raise it if it's calling out guesses too often. You can also add extra phrases in speak(), like saying "That's a <object>!" instead of just the bare name.

⚡ Safety first

  • The "eyeball" is a craft or costume prop — the same kind used for dolls and Halloween decorations, not a real biological part.
  • Ask an adult to help with cutting or drilling the eye prop, and with any soldering.
  • Always shut down the Raspberry Pi properly and unplug it before changing any wiring.
  • Keep fingers clear of the eyelid servo while testing — small mechanisms can pinch.
  • Everything runs locally on the Pi with no cloud connection needed, which is good for privacy — just remember any Wi-Fi setup should be done by an adult too.
Good to know

Frequently asked questions

Does the video get sent to the internet?

No. The object detection model runs entirely on the Raspberry Pi itself, so no images leave the device during recognition.

Can it recognize objects other than apple, book, bottle, and scissors?

Yes — the pretrained model used here already knows around 90 common everyday object categories, so you can test it on many household items right away.

Do I need a real eyeball for this project?

Definitely not — this uses a craft or costume prop eyeball, the same kind sold for dolls, taxidermy displays, or Halloween decorating.

Which Raspberry Pi model works best?

A Raspberry Pi 4 gives the smoothest detection speed. A Raspberry Pi Zero 2 W can also run it, just with a slower, choppier frame rate.

Why does it sometimes call out the wrong object?

Lighting, camera angle, and how much of the object fills the frame all affect accuracy — try holding items closer, in good light, and adjusting the confidence threshold in the code.

Built with a Raspberry Pi, a craft eyeball, and a lot of patient object-holding while testing. Happy making!

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