Lesson plan

Build a pocket pet lesson plan

A Tamagotchi-style pet on an OLED: a screen, buttons, stats, a clock and a memory, ending with Pip.

3 chapters, 6 lessons, about 4 hours, on the Arduino Uno R3. Every lesson runs in the browser, with nothing to install.

The unit

Objectives and materials

By the end, students can

  • A screen to live on and buttons to talk to it with.
  • Stats that fall, a clock that counts pet minutes, and growing up.
  • Save the pet in EEPROM, then meet the whole thing.

Materials for the whole unit

  • Arduino Uno R3
  • Full-size breadboard
  • OLED display, 128x64
  • Piezo speaker
  • Pushbutton x 3

Every part is already on the simulator’s bench, so there is nothing to buy or hand out. The counts are the most any one lesson uses, if you build it on real breadboards too.

Chapter 1. About 1 h 20 min

A home for a pet

A screen to live on and buttons to talk to it with.

LessonTimeWhat students do
A face for your petWake a 128x64 OLED over two wires, write on it, and draw a pixel-art egg from flash. The first thing any pet needs is somewhere to live.40 min
  1. Two wires to a screen
  2. Words are drawings too
  3. Pixel art from flash
  4. Make it wobble
Three buttons and a menuSELECT, CONFIRM and CANCEL with no resistors to fit, a menu of six icons, and why a button needs debouncing.40 min
  1. Buttons with no resistors
  2. SELECT moves along
  3. CONFIRM picks it
  4. CANCEL backs out

Materials

  • Arduino Uno R3
  • Full-size breadboard
  • OLED display, 128x64
  • Piezo speaker
  • Pushbutton x 3

Check for understanding

Each student finishes "Three buttons and a menu" on their own, without opening the hints. The simulator checks 4 of its 4 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "CANCEL backs out".

Chapter 2. About 1 h 20 min

A life in numbers

Stats that fall, a clock that counts pet minutes, and growing up.

LessonTimeWhat students do
A pet made of numbersFood, joy and rest that fall a little every pet minute on a millis() clock, and buttons that put them back.40 min
  1. Three numbers
  2. Time makes it hungry
  3. Feed it
  4. Play costs rest
Growing up and going to bedA clock that counts pet minutes, an egg that hatches, a baby that grows into a kid, and a pet that gets sleepy.40 min
  1. One knob for time
  2. Stages of life
  3. Sleepy time
  4. Lights out

Materials

  • Arduino Uno R3
  • Full-size breadboard
  • OLED display, 128x64
  • Piezo speaker
  • Pushbutton x 3

Check for understanding

Each student finishes "Growing up and going to bed" on their own, without opening the hints. The simulator checks 4 of its 4 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Lights out".

Chapter 3. About 1 h 20 min

Remember, then play

Save the pet in EEPROM, then meet the whole thing.

LessonTimeWhat students do
A pet that remembers youKeep the pet in the Uno EEPROM as one struct with a magic number, save when something happens, and find it again after a reset.40 min
  1. Memory that stays
  2. Save when it matters
  3. Press reset
  4. A fresh start
Meet PipEverything together: hatching, feeding, two mini-games, cleaning up, medicine, sleep and a pet that remembers you.40 min
  1. Hatch
  2. Dinner time
  3. Play a game
  4. It remembers you

Materials

  • Arduino Uno R3
  • Full-size breadboard
  • OLED display, 128x64
  • Piezo speaker
  • Pushbutton x 3

Check for understanding

Each student finishes "Meet Pip" on their own, without opening the hints. The simulator checks 4 of its 4 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "It remembers you".

Your class

Teach this unit as a class

Start a class from this course and its 6 lessons are assigned in one go, in order. Students join with a six-character code or printed login cards, and each one’s work comes back to you.

The class tools are free for 30 days for one class of up to 20 students, with no card. The lessons themselves are free either way.