DIY AI Talking Globe: Encyclopedia + Story Globe

DIY AI Talking Globe: Encyclopedia + Story Globe | ESP32 Robotics Project for Kids
🌍 Robotics Project · ESP32 · Capacitive Touch

Touch a Country, Hear the World Come Alive

A talking globe that speaks geography facts, tells imaginative stories, quizzes you, and shows an on-screen description on a tiny OLED display — all triggered by simply touching a country with your finger.

🖥️ OLED Display (always on, any mode)
Touch a country to
see its description here...

👆 Touch a dot on the globe

Try any of the six colored countries to hear a fact, a story, or answer a quiz question.

💡 How Does It Actually Work?

Four technologies team up to make this feel like magic:

  1. Capacitive touch sensing — the same tech behind phone touchscreens — detects exactly which country pad your finger touched.
  2. The ESP32 looks up which country that pad represents, and which "mode" (Facts, Story, or Quiz) is currently selected.
  3. An MP3 playback module plays the matching pre-recorded audio clip through a small speaker.
  4. A tiny OLED display shows a short written description of the touched country at the same time — so you get to read along with what you hear.

🔍 Why not use one touch sensor per country wire?

A chip called the MPR121 can watch up to 12 touch pads at once over just two wires (called I2C), instead of needing a separate wire back to the microcontroller for every single country.

🖥️ The OLED runs independently of audio mode

Unlike the speaker, which only plays whatever mode you've selected, the OLED always shows the same thing: a short description of whichever country you last touched. Think of it as the globe's permanent "info bar."

🧰 What You'll Need

  • 1× ESP32 development board
  • 1× MPR121 capacitive touch breakout
  • 1× SSD1306 OLED display (128×64, I2C)
  • Copper adhesive tape (for touch pads)
  • 1× DFPlayer Mini MP3 module
  • 1× microSD card (for audio files)
  • 1× small 8Ω speaker (3–5W)
  • 1× push button (mode select)
  • 1× foam or inflatable world globe
  • 5V power bank or battery pack
  • Jumper wires, breadboard, hot glue

🎙️ Recording the audio clips

Record short fact, story, and quiz-question clips for each country (even on a phone!), then rename and copy them onto the microSD card in numbered folders — the exact structure is explained in the Build section.

🔌 The Circuit Diagram

ESP32 DEV BOARD MPR121 touch sensor SDA → GPIO21 SCL → GPIO22 up to 12 copper pads → OLED Display 128×64, I2C SDA (shared) SCL (shared) DFPlayer Mini MP3 module RX ← GPIO17 (TX2) TX → GPIO16 (RX2) SPK BUTTON → GPIO5 5V + GND shared across ESP32, MPR121, OLED, DFPlayer, and speaker

Each copper pad on the globe connects to one MPR121 touch input — label your wiring with the country name for each pad as you go! The OLED taps into the same SDA/SCL wires as the MPR121, since both speak I2C on different addresses.

🛠️ Build It Step by Step

1

Choose your countries

Pick up to 12 countries to feature (start with 6 for your first build) and mark their locations on the globe lightly in pencil.

2

Stick down copper tape pads

Cut small copper tape circles and press one onto each marked country, leaving a thin tape "tail" trailing down to the globe's base.

3

Wire pads to the MPR121

Connect each copper tail to its own numbered input pin on the MPR121 breakout, keeping a written list of which pin is which country.

4

Wire the MPR121 to the ESP32

Connect SDA, SCL, power, and ground as shown in the circuit diagram.

5

Wire the OLED display

Connect the SSD1306's SDA and SCL pins to the same I2C wires as the MPR121 (GPIO21/GPIO22) — no extra pins needed, since I2C devices can share a bus.

6

Wire the DFPlayer Mini and speaker

Connect DFPlayer's RX/TX to the ESP32's second serial port, and wire the speaker to DFPlayer's SPK+/SPK– terminals.

7

Organize your audio files

On the microSD card, create folders 01 (Facts), 02 (Stories), 03 (Quiz Questions), and 04 (Quiz Jingles). Inside each, name files 001.mp3, 002.mp3, and so on — matching each country's position in your code list.

8

Wire the mode button

Connect one leg to GPIO5 and the other to GND.

9

Upload the code and test every pad

Touch each country and confirm the right fact plays and its description appears on the OLED, then press the button to check Story and Quiz modes.

10

Mount everything in a base

House the electronics in a small box under the globe stand, positioning the OLED so its screen is visible, and running the copper tape tails neatly down through the globe's pole.

💻 The Code

This sketch watches all the touch pads at once, tracks which mode is active, plays the right audio file, and updates the OLED with that country's description the instant it's touched.

talking_globe.ino
// DIY AI Talking Globe — ESP32 + MPR121 + DFPlayer Mini
// Touch a country: hear a fact, a story, or answer a quiz

#include <Wire.h>
#include <Adafruit_MPR121.h>
#include <DFRobotDFPlayerMini.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

Adafruit_MPR121 cap = Adafruit_MPR121();
HardwareSerial mp3Serial(2);  // ESP32 UART2
DFRobotDFPlayerMini myDFPlayer;
Adafruit_SSD1306 oled(128, 64, &Wire, -1);  // shares the I2C bus with MPR121

#define BUTTON_PIN     5
#define NUM_COUNTRIES  6

const char* countryNames[NUM_COUNTRIES] = {
  "USA", "Brazil", "Egypt", "India", "Japan", "Australia"
};

// Short descriptions shown on the OLED when each country is touched
const char* countryDescriptions[NUM_COUNTRIES] = {
  "Capital: Washington DC\nContinent: N. America",
  "Capital: Brasilia\nContinent: S. America",
  "Capital: Cairo\nContinent: Africa",
  "Capital: New Delhi\nContinent: Asia",
  "Capital: Tokyo\nContinent: Asia",
  "Capital: Canberra\nContinent: Oceania"
};

// Folders on the SD card: 01=Facts 02=Stories 03=QuizQ 04=QuizJingles
enum Mode { FACTS, STORY, QUIZ };
Mode currentMode = FACTS;

int quizAnswerIndex = -1;
bool waitingForAnswer = false;
uint16_t lastTouched = 0;

void setup() {
  Serial.begin(115200);
  Wire.begin();
  if (!cap.begin(0x5A)) {
    Serial.println("MPR121 not found!");
    while (1);
  }

  mp3Serial.begin(9600, SERIAL_8N1, 16, 17);
  if (!myDFPlayer.begin(mp3Serial)) {
    Serial.println("DFPlayer not found!");
    while (1);
  }
  myDFPlayer.volume(22);
  pinMode(BUTTON_PIN, INPUT_PULLUP);

  if (!oled.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {  // default OLED address, no clash with MPR121 (0x5A)
    Serial.println("OLED not found!");
    while (1);
  }
  oled.clearDisplay();
  oled.setTextColor(SSD1306_WHITE);
  oled.setTextSize(1);
  oled.setCursor(0, 0);
  oled.println("Touch a country...");
  oled.display();
}

void showDescription(int pad) {
  oled.clearDisplay();
  oled.setTextSize(2);
  oled.setCursor(0, 0);
  oled.println(countryNames[pad]);
  oled.setTextSize(1);
  oled.setCursor(0, 20);
  oled.println(countryDescriptions[pad]);
  oled.display();
}

void startNewQuizQuestion() {
  quizAnswerIndex = random(0, NUM_COUNTRIES);
  waitingForAnswer = true;
  myDFPlayer.playFolder(3, quizAnswerIndex + 1);  // play the question
}

void cycleMode() {
  currentMode = (Mode)((currentMode + 1) % 3);
  if (currentMode == QUIZ) startNewQuizQuestion();
}

void handleTouch(int pad) {
  Serial.print("Touched: ");
  Serial.println(countryNames[pad]);

  showDescription(pad);  // OLED updates no matter which mode is active

  switch (currentMode) {
    case FACTS:
      myDFPlayer.playFolder(1, pad + 1);
      break;
    case STORY:
      myDFPlayer.playFolder(2, pad + 1);
      break;
    case QUIZ:
      if (waitingForAnswer) {
        bool correct = (pad == quizAnswerIndex);
        myDFPlayer.playFolder(4, correct ? 1 : 2);  // jingle
        waitingForAnswer = false;
        delay(3000);
        startNewQuizQuestion();
      }
      break;
  }
}

void loop() {
  static bool lastBtn = HIGH;
  bool btn = digitalRead(BUTTON_PIN);
  if (lastBtn == HIGH && btn == LOW) {
    cycleMode();
    delay(200);  // debounce
  }
  lastBtn = btn;

  uint16_t touched = cap.touched();
  for (int i = 0; i < NUM_COUNTRIES; i++) {
    bool isTouchedNow = touched & (1 << i);
    bool wasTouched = lastTouched & (1 << i);
    if (isTouchedNow && !wasTouched) handleTouch(i);
  }
  lastTouched = touched;
}

🖥️ Notice where showDescription() is called

It sits right at the top of handleTouch(), before the mode switch — so the OLED updates on every single touch, no matter which mode (Facts, Story, or Quiz) is currently active.

🤖 The AI Upgrade: "Ask Me Anything"

📌 Honest scope of the core build

The globe above uses pre-recorded audio, not live AI — that's what makes it reliable without Wi-Fi. For genuinely open-ended questions, add a Wi-Fi connection, a microphone module, and a cloud AI API to a second "Ask" mode.

The upgrade path looks like this: press a dedicated "Ask" button, speak your question into a small microphone module, send the recorded audio to a speech-to-text service, pass the resulting text to an AI language model API along with the currently touched country as context, then play the AI's text response back through the DFPlayer's speaker using a text-to-speech service.

This requires an ESP32 with enough memory for Wi-Fi + HTTPS requests, an API key from an AI provider, and careful attention to a child's internet safety — a great project for an older maker working alongside an adult.

❓ Frequently Asked Questions

Does the globe use real AI to answer any question?

The core build plays pre-recorded facts, stories, and quizzes rather than live AI, since that works reliably offline. See the AI Upgrade section above for adding genuine open-ended AI answers.

How does touching a country actually get detected?

Copper tape pads work like the touchscreen on a phone — the MPR121 chip senses the tiny change in capacitance when your finger touches a pad and reports exactly which one to the ESP32.

Can I add more than 12 countries?

Yes — chain a second MPR121 on a different I2C address to add 12 more touch inputs, or use an analog multiplexer chip for even more.

My touch pads aren't registering — what should I check?

Make sure each copper tape tail has a solid, unbroken connection to its MPR121 pin, and confirm the MPR121's address (usually 0x5A) matches what's in the code.

Can I use an SD card module instead of DFPlayer Mini?

Yes, with an I2S amplifier like the MAX98357A — it gives more control over audio but needs more wiring and code than the simpler DFPlayer Mini approach used here.

Can the OLED display and touch sensor really share the same wires?

Yes — both the SSD1306 OLED and the MPR121 touch sensor speak I2C, a protocol built to let many devices share just two wires (SDA and SCL). Each device just needs its own address, and the OLED (0x3C) and MPR121 (0x5A) don't clash.

🚀 Take It Further

Add an LED per country

Light up a small LED next to each touched country pad for extra visual feedback.

Score-tracking quiz mode

Keep a running score in code and announce it with a special audio clip after every five questions.

Multilingual mode

Add a second button to switch every audio folder set to a different language.

Companion app

Add a small web page hosted on the ESP32 to log which countries get explored most, viewable from a phone.

Richer OLED screens

Draw a tiny pixel-art flag alongside the text, or scroll longer descriptions across the screen instead of trimming them to fit.

🌍 Built for curious young makers exploring geography and electronics together. Build with an adult nearby, especially for wiring and any AI/internet upgrades.

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