This is an old revision of the document!


PurrGlow Feeder

Name: Andra-Maria Belceanu
Group: 331CA

Introduction

PurrGlow Feeder is a smart, automatic cat feeder that dispenses food at four fixed times per day, but only when the cat is nearby. It uses a proximity sensor to detect the cat’s presence and activates a motor to rotate a food container, releasing food into the bowl. The main goal of the project is to automate and optimize the cat feeding process, reducing waste and ensuring the pet eats at regular intervals. The idea came from a personal need to reliably feed a cat even when not at home, while also making the experience more interactive. A colorful LED cube acts as a night light and plays dynamic light patterns whenever food is served. One of the lighting modes can be customized using a potentiometer, giving the owner some control over the ambience. A button is also used to change the light modes, implemented using an external interrupt. This project is useful for pet owners who want an efficient and engaging way to care for their animals, and for us, it’s a fun and educational way to apply embedded systems concepts to a real-world scenario.

General Description

The PurrGlow Feeder system includes both hardware and software modules that work together to automate cat feeding and provide interactive feedback through an LED cube. Below is an overview of the main modules and how they interact:

Hardware Modules

  • Arduino Microcontroller – the central unit that handles all logic and communication between components.
  • Proximity Sensor – detects when the cat is near the bowl and sends a digital input signal to the Arduino.
  • Servo Motor – controlled via PWM by the Arduino to rotate and release food from the container.
  • LED Cube (5 LED Matrices) – displays lighting animations when food is dispensed or when switched by the user.
  • Button – used to switch between predefined light modes; connected via an external interrupt.
  • Potentiometer – allows the owner to manually adjust the color or brightness of a customizable LED mode; read as analog input.

Software Modules

  • Timer Logic – manages the four fixed feeding times per day (e.g., 08:00, 12:00, 18:00, 22:00).
  • Feeding Control – decides whether to activate the servo motor based on time and proximity input.
  • Animation Controller – controls the LED cube effects based on the button and potentiometer values.
  • Interrupt Handler – triggered by the button to switch LED modes smoothly.

Interaction Flow

  • The timer checks whether the current time matches a scheduled meal time.
  • If the time matches and the cat is detected nearby, the servo motor is activated to dispense food.
  • Simultaneously, the LED cube plays an animation.
  • The user can:
    • Press the button to cycle through animation modes.
    • Adjust the potentiometer to customize the color of one mode.
  • All logic is managed by the Arduino in real time using digital, analog, and interrupt inputs.

Hardware Design

List of Components:

  • 1x Arduino Uno
  • 1x Proximity Sensor
  • 1x Servo Motor (for food dispenser)
  • 5x LED Matrices (4×4 WS2812B)
  • 1x Potentiometer
  • 1x Push Button
  • Resistors
  • Connecting wires
  • Breadboard
  • Wires

Connection Overview:

  • The servo motor is controlled via a PWM pin.
  • LED matrices are chained and connected to a single digital output.
  • The push button is connected via a digital input with external interrupt support.
  • The potentiometer is read via an analog input pin.
  • The proximity sensor sends a digital signal to the Arduino.

Overview on hardware:

The hardware design of the PurrGlow Feeder includes several modules integrated around an Arduino Uno board, enabling both scheduled and on-demand food dispensing with visual feedback.

Arduino Uno

Acts as the main controller. It keeps time, handles feeding logic, controls the servo, reads sensor and input data, and manages LED animations. All components are powered from the Arduino’s 5V supply line.

Servo Motor (SG90)

Controlled via PWM on digital pin D5, the servo rotates to release food. It activates automatically at four fixed times per day.

Proximity Sensor (HC-SR04)

Connected to pins D3 (TRIG) and D4 (ECHO), this sensor is used by the owner to manually trigger extra feeding. If it detects presence continuously for 2 seconds, a food portion is released. The module runs at 5V and uses about 15 mA.

LED Cube (5× WS2812B matrices)

All matrices are daisy-chained and driven from pin D7 using FastLED. They display predefined lighting animations during feeding. Brightness is limited in software to reduce power usage (total draw ≈ 200 mA).

Push Button (mode switch)

Connected to pin D2 via an external interrupt, this button lets the user switch between different LED animation modes at any time.

Potentiometer

Wired to analog pin A0, the potentiometer allows the user to adjust either the LED animation speed or the color in specific modes.

The system is designed for simplicity and low power consumption, drawing under 500 mA total. Feeding can happen automatically or on request, and all interactions are confirmed visually via the LED cube.

Pin Usage

Each hardware component is mapped to specific pins on the Arduino Uno, chosen based on electrical compatibility, timing requirements, or interrupt support.

D2 – Push Button (INT0)

This pin is used because it supports external interrupts (INT0 / PCINT18). It allows the system to detect button presses asynchronously and switch LED animation modes instantly.

D3 – HC-SR04 TRIG

Configured as a digital output to send ultrasonic pulses. It was chosen as a general-purpose pin close to D4, forming a logical pair for the proximity sensor.

D4 – HC-SR04 ECHO

Configured as a digital input to receive the echo signal. It is read using `pulseIn()` to measure distance accurately.

D5 – Servo Motor PWM

This pin supports hardware PWM and is connected to the SG90 servo. It allows precise pulse-width modulation for angle control during feeding.

D7 – LED Cube Data In

Used as the data pin for the WS2812B LED matrices. Chosen for its ability to handle tight 800 kHz timing required by FastLED, and because it's not shared with any serial or I²C functions.

A0 – Potentiometer

This analog input reads voltage from the potentiometer to control either LED speed or color. A0 is conventionally used for analog input and provides stable readings.

All components share a common GND, and are powered from the Arduino’s 5V rail. Pin assignments were selected to minimize conflict with internal timers and preserve clean signal timing for both the servo and WS2812 LEDs.

Software Design

Development Environment:

The firmware was developed using the Arduino IDE, chosen for its simplicity and built-in support for common microcontroller platforms such as Arduino Uno. The environment supports both code compilation and serial monitoring.

Libraries and 3rd-Party Sources Used:

Library Name Purpose
FastLED.h Controls WS2812 RGB LED matrices with high-performance animations
Adafruit_NeoPixel.h Alternative library for driving NeoPixel (WS2812) LEDs
Servo.h Controls the servo motor responsible for food dispensing
EEPROM.h Store configuration or last feeding timestamp
TimerOne.h Enables time-based control for feeding intervals

Algorithms and Planned Structures:

The firmware is structured into two main parts:

  • 1. LED Animation Control
    1. Handles 3 predefined animations using FastLED (`snake`, `vortex`, `int_ext`).
    2. A button is used to switch between animation modes (via external interrupt).
    3. A potentiometer adjusts the color of animations in real-time.
  • 2. Cat Feeder Logic (to be implemented in Stage 3)
    1. Uses a proximity sensor to detect the presence of the cat.
    2. When the cat is present and enough time has passed since the last feeding:
      1. A servo motor rotates to release food.
      2. A light animation or color feedback is shown to indicate successful feeding.

Sources and Implemented Functions

Function / Module Description
snake() Snake effect moving across the LED matrix
vortex() Circular animation effect across all matrices
fade_color() Smooth color transition based on potentiometer position
random_star() Randomly lights up LEDs like a starry sky
convert_speed() Converts potentiometer analog value to animation speed
poweroff() Turns off all LEDs
detectPresence() Measures distance with ultrasonic sensor to detect the cat
rotateServo() Controls the servo motor to dispense food
shouldFeedNow() Checks if it is the correct time to feed

Conclusion

pm/prj2025/eradu/andra.belceanu.1747641301.txt.gz · Last modified: 2025/05/19 10:55 by andra.belceanu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0