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.
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.
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
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.
Capture a frame
The Pi Camera continuously grabs images of whatever is in front of the eye.
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.
Pick the best guess
If the top score is confident enough, the code treats it as a real detection instead of a false alarm.
React
The eye blinks, the iris flashes brighter, the label appears on the OLED, and the speaker announces the object's name.
Circuit diagram
The Raspberry Pi's camera port, I2C pins, I2S pins, and a couple of PWM pins handle everything — no extra microcontroller needed.
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.
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.
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.
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.
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.
Mount the OLED label screen
Fix the OLED display on the base beside the eye, angled toward whoever is showing it an object.
Wire everything to the Raspberry Pi
Connect the camera, OLED, LED ring, servo, and speaker amplifier following the circuit diagram above.
Set up the Raspberry Pi
Flash Raspberry Pi OS onto the SD card, then enable the Camera, I2C, and I2S interfaces using raspi-config.
Install the software
Install picamera2, OpenCV, tflite-runtime, and pyttsx3, then download a pretrained TFLite object detection model and its label file.
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.
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.
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.
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)
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.
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.

Comments
Post a Comment