Wiznet makers

rahulkhanna

Published October 26, 2022 ©

0 Projects

0 Resellers

1 Contests

Opensource Pet Feeder using WizFi360-EVB-Pico

An automatic pet feeder using WizFi360-EVB-Pico controlled via WiFi. We can wirelessly control the pet feeder with an app.

COMPONENTS Hardware components

WIZnet - WizFi360-EVB-Pico

x 1


M5Stack - PIR Sensor Human Body Infrared PIR Motion Sensor (AS312)

x 1


sparkfun - SparkFun Breadboard Power Supply 5V/3.3V

x 1


sparkfun - LilyPad Buzzer

x 1


Arduino - Arduino MotorShield Rev3

x 1


seeed - Gear Stepper Motor Driver Pack

x 1

Software Apps and online services

Arduino - Arduino IDE

x 1


WIZnet - WIZnet WizFi Library

x 1


WIZnet - WIZnet WizFi360-EVB-Pico-C

x 1


PROJECT DESCRIPTION
An automatic pet feeder using WizFi360-EVB-Pico controlled via WiFi. We can wirelessly control the pet feeder with an app.
Idea & Workflow 💡
We will be building Automatic Pet Feeder using WizFi360-EVB-Pico that can automatically serve food to your pet timely. It has a DS3231 RTC (Real Time Clock) Module, which is used to set the time and date on which your pet should be given food. So, by setting up the time according to your pet’s eating schedule, the device drop or fills the food bowl automatically.
In this circuit, we are using the app to display the time using DS3231 RTC Module with WizFi360-EVB-Pico. Also, a servo motor is used to rotate the containers to provide the food, and a mobile app to manually set up the time for feeding the Pet. You can set the rotation angle and container opening duration according to the quantity of food you want to serve to your pet. The quantity of food may also depend upon your pet whether it’s a dog, cat, or bird.
WizFi360-EVB-Pico is based on Raspberry Pi RP2040 and adds Wi-Fi connectivity using WizFi360. It is pin compatible with the Raspberry Pi Pico board and can be used for IoT Solution development.
The RP2040 GPIO used inside WizFi360-EVB-Pico is as follows.
 
DS3231 is an RTC (Real Time Clock) module. It is used to maintain the date and time for most of the Electronics projects. This module has its own coin cell power supply using which maintains the date and time even when the main power is removed or the MCU has gone through a hard reset. So once we set the date and time in this module it will keep track of it always.
PIR sensors allow you to sense motion. They are often referred to as PIR, "Passive Infrared", "Pyroelectric", or "IR motion" sensors. They are used to detect whether a pet has moved in or out of the sensor’s range.
In our circuit, we are using DS3231 to feed the pet according to the time, set up by the Pet’s owner, like an alarm. As the clock reaches the set time, it operates the servo motor to open the container gate, and the food drops into the Pet’s food bowl.
Setting up IDE
Open File -> Preferences, and enter the following into the Additional Boards Manager URLs
https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
Now you can search for “wizfi” in the Boards Manager and install the latest package for Raspberry Pi Pico/RP2040. Add the WizFi360EVB library
Select the WIZnet WizFi360-EVB-Pico board and run the following blink code.
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}

Now we have uploaded the code and the board is ready for this project.

Hardware Connections
Solder the header pins to the WizFi360 as shown below
Connect the RTC module, Buzzer, LED, and Servo motor as shown in the circuit diagram. The Buzzer and LED are connected to GP8 & GP9. The servo motor is connected to GP28. PIR Sensor is connected to GP27. The RTC module is connected to the I2C1_SDA & I2C_SCL. 
 
Feeder Design
We used a 3D-printed enclosure that can hold the pet food. Mount the servo to the base of the can. Glue the proximity sensor to the sides of the can. The feeder system designed was based on a worm gear driven by a DC motor. During the initial tests, it showed to be too small for the food size that my dog eats. So, the design was revised as shown below. 

Sample - CAD modelSample

Software & Mobile App Design
  • Download & install the following libraries. 
  1. DS3231 library
  2. Servo library from Arduino
  3. WizFi360 library - Installed in the previous steps
  4. MQTT client

We can test the connections using the basic_peripheral.ino code. 

#include <Wire.h>
#include <DS3231.h>
#include <Servo.h>

#define SENSOR_PIN 27
#define BUZZER 8

RTClib myRTC;
Servo myservo;  // create servo object to control a servo

void setup () {
  Serial.begin(115200);
  myservo.attach(28);
  Wire.begin();
  pinMode(SENSOR_PIN, INPUT);
  pinMode(BUZZER, OUTPUT);
  digitalWrite(BUZZER, LOW);
  delay(500);
  Serial.println("WizFi360 Ready!");
}

void loop () {
  int pos, sensor_val = 0;

  for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
  for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
  sensor_val = digitalRead(SENSOR_PIN);
  if (sensor_val == 1)
  {
    digitalWrite(BUZZER, HIGH);
  }
  else
  {
    digitalWrite(BUZZER, LOW);
  }
  delay(1000);

  DateTime now = myRTC.now();

  Serial.print(now.year(), DEC);
  Serial.print('/');
  Serial.print(now.month(), DEC);
  Serial.print('/');
  Serial.print(now.day(), DEC);
  Serial.print(' ');
  Serial.print(now.hour(), DEC);
  Serial.print(':');
  Serial.print(now.minute(), DEC);
  Serial.print(':');
  Serial.print(now.second(), DEC);
  Serial.println();

  Serial.print(" since midnight 1/1/1970 = ");
  Serial.print(now.unixtime());
  Serial.print("s = ");
  Serial.print(now.unixtime() / 86400L);
  Serial.println("d");
}

A detailed explanation can be found on this website. You can find the complete code on my GitHub repo. 

 

We designed the Mobile App using the MIT App inventor that is connected to the WizFi360 via MQTT. This can feed the pet from any part of the world.  

App Design

----------------------------------------------------------------------------------------------------------------

Credits to Arduino, Hackster.io, Element14, App inventor &  Paulo Soares

If you faced any issues in building this project, feel free to ask me. Please do suggest new projects that you want me to do next.
Give a thumbs up if it really helped you and do follow my channel for interesting projects. :)
Thanks for reading!
Documents
  • Project Repo

  • 3D CAD

  • Hackster.io

Credits
rahulkhanna

0 Projects

0 Resellers

1 Contests

Comments Write