Lessons and the learning game

Build a pet feeder

Build a feeder that runs on its own: a servo hatch, an RTC schedule, portions weighed on a load cell, a rationed snack button and a meal log.

What the course teaches

Six gentle lessons in three chapters, at /learn/path/build-pet-feeder on /learn. Every lesson runs on an Arduino Uno, and the checks read the sketch's serial lines and the servo's angle.

  • Open and on time. A servo hatch opens when a button is pressed; the learner changes the opening angle and the time open. Then the gallery's automatic pet feeder serves meals on the minute from a DS3231 clock, with a FEED NOW button, and the learner writes their own schedule.
  • Weigh and keep track. A load cell on an HX711 under the bowl: the hatch closes when the bowl has gained 40 g, an empty or jammed hopper is caught after 8 s, and a 1 kg cell is calibrated. A snack button gives 10 g, at most three a day. Every meal, snack, skip and empty hopper goes in a log, and a bowl that still has 30 g in it skips the meal.
  • Project: a two-meal feeder. Dinner, the learner's own times and portion, and a build sheet.

The circuits

Lessons Circuit Sketch
A servo hatch A servo on pin 9 with its own 5 V supply, a button on pin 2 feedhatch
Schedules from an RTC The gallery's automatic pet feeder: DS3231, MG996R gate, I2C LCD, FEED NOW button, buzzer petfeeder
Portion by weight to the project DS3231 on A4 and A5, HX711 on pins 4 (DT) and 5 (SCK), the hatch servo on pin 9, a snack button on pin 2 feedscale

In Mokxi the clock starts at the time in its start property, and the load on the cell is the HX711's slider: drag it up while the hatch is open, as the food would fall. feedscale takes log and weigh in the Serial Monitor.

Troubleshooting

  • A meal is skipped at once. Something was on the scale. The sketch tares at start-up, so set the load after "feeder ready".
  • The hatch stays open 8 s and reports an empty hopper. Nothing reached the bowl: drag the load up while the hatch is open.
  • The scale reads five times too much. The cell's capacity changed. Set scale.set_scale() to its counts per gram.
  • A snack is refused. Today's MAX_SNACKS are used up; the count resets when the date changes.
  • Holding the button gives one snack. That is on purpose: one press, one snack.

Paths and lessons explains how a course, its checkpoints and its chapter quizzes work.