Multipurpose Pet food and medicine dispencer

Hardware Components
X 2
Used one for controlling dispenser motors, sending notification to MQTT using Ethernet and second pico board is used for peron detection using tinyML application
Raspberry pi Model4b
X 1
Used as a MQTT server and for viewing all the outputs
Servo Motor
X 1
To control the medicine dispencer
DC motor
X 2
To run Fish and Dog food dispenser
LCD 16x2 display
X 1
To display current process
3d printer
X 1
To print dispenser components
Motor driver
X 1
To control 2 DC motors
X 3
To view outputs in essential places
X 1
Software Apps and online services
Arduino IDE
To program 1st Pico board
Raspberry Pi OS
To run raspberry pi as well as code the second pico board
To view the person detection output in a window
To view the MQTT messages by connecting to the broker
Mosquitto MQTT
To install the MQTT broker
Project Description
The description of the project is as follows:
  • Explain the 1st W5100s pico board code and working
  • Explain the second w5100s pico board code and working
  • Explain about the raspberry pi board
  • Explain all the output.
  1. 1st W5100s pico board code:
The first  W5100s pico board is coded with the Arduino IDE.  Some of the Hardware's connected to this board is a LCD display, Motor driver, 3 LED's and a servo motor. The first 6 gpio pins i.e GPIO pin 0 to GPIO pin 5 is connected to the LCD display and the connection is defined below. And it is connected from GPIO6 to GPIO9 to Motor driver to control two motors. GPIO 10 is connected to the servo motor to control the medicine dispenser. Two LED pins are connected to GPIO 6 and GPIO 8 along with motor pins.
The working of the first pico board is as follows: The 1st W5100s pico baord is program in such a way that it displays the digital clock in the LCD screen for 12 hour format and functions as the clock progresses. When the code is loaded into the W5100s pico board, the time is set to 10:54:00 AM in Hour, Minute and second format. When the time is 11.00 AM in the board The fish food is dispensed using the 1st motor. When the first motor starts dispensing LCD displays "Fish Feeding " status and 1st LED is ON. When its completed in 5 secs LCD displays "Fish Completed", and 1st LED turns OFF and the notification is sent to the MQTT server in the "fish" topic. When the Time is 11:01 AM in the W5100s pico board display, 2nd Motor turns on with the second LED and the dog food is dispensed with LCD display "Dog Feeding". After 15 secs when the dig food is dispensed motor is stopped, 2nd LED is turned OFF, LCD displays "dog completed". AFter this MQTT messages is sent as DOG completed under the topic "dog" . At 11.15 AM servo motor is turned to dispense medicine. After the medicine is dispensed the 1st pico board waits for the 2nd W5100s pico board to send a notification using a gpio HIGH logic. GPIO26 anolog A0 is made to read anlog inputs, when the values is read high a MQTT message is sent to the server under the topic "person" with the message person detected. Once everything is completed MQTT message is sent to the  server notifying all tasks are completed in that time.
  • 2nd W5100s pico board:
This 2nd W5100s pico board is programmed  using the tiny ML application to detect the person and send the notification to the 1st W5100s pico board using digital write when the person is detected. in the same GPIO a led is connected to ON when the person detection is more the 75% result. used 1 OV2650 Arducam Mini 2MP Plus camera and connected to the pico board as shown in the image. LED is connected to GPIO 15 of the 2nd W5100s pico board as to turn ON and OFF when the person is detected. First W5100s pico board was setup in the raspberry pi and a person detection code was modified to turn the LED On and OFF based on the persons detection percentage.A script was runned do the following :The script will:
  • Create a directory called pico
  • Install required dependencies
  • Download the pico-sdk, pico-examples, pico-extras, and pico-playground repositories
  • Build the blink and hello_world examples in pico-examples/build/blink and pico-examples/build/hello_world
  • Download and build picotool (see Appendix B). Copy it to /usr/local/bin. • Download and build picoprobe (see Appendix A).
  • Download and compile OpenOCD (for debug support)
  • Download and install Visual Studio Code
  • Install the required Visual Studio Code extensions (see Chapter 6 for more details)
  • Configure the Raspberry Pi UART for use with Raspberry Pi Pico
downloaded a prebuilt tflite tinyMl application person detection code and modified it in such a way that when the person detection probability is more than 75% the LED should turn ON or else it should be OFF. The code was built using the cmake into pico compatible file and copied and synced. Once it was done. the output was vied using the TTL connected to the raspberry pi .


  •  raspberry pi setup and results:
Raspbian OS was installed in the raspberry pi. Pico board libraries were installed in the raspberry pi along with the com port. TinyML application was created and built using the cmake in the raspberry pi and copied into 2nd W5100s pico board. the output for the person detection probability along with the video stream was viewed in the processing software installed in the raspberry pi.

Once the person is detected LED will Turn ON and a analog signal is received in the 1st W5100s pico board. MQTT message from the 1st W5100s pico board is  sent to server notifying "person detected".
Raspberry pi server is also running a server to store the mqtt messages as a db file. db files store all the messages in a table with the following structure.
SLNo  , Topic,  Message , Time created

Overall Setup of the project:

Additional information's
3d models were printed in the 3d printer to dispense the foods for the pets. 3 different things were printed. Archimedes screw, top box and a holder for the Archimedes screw. 2 sets were created. All the components printed are here:

Archimedes screw:

Holder for Archimedes screw:

Top Box:

the designs of the completed product is shown below:

MQTT lens is used to view the message in the system with the subscribed topics. 5 topics are subscribed and connected to the Mqtt server (raspberry pi).

Viewed messages in the MQTT lens:

1st pico board
Is coded using arduino IDE for controlling Fish, Dog food dispenser motor and sending the notification after completing to the MQTT server built on raspberry pi
Paho MQTT server
File to store and save MQTT messages indb file using sqlite
base html
base html file to view the mQTT messages in the server its in he directory /pahomqtt/templates
index html
Index html to view the mQTT messages in the server its in he directory /pahomqtt/templates
Person detection PDE
This is runned in the processing software in the Raspberry pi for viewing the persons images and detection percentage
TinyML person detection edited code
This file is one of the file present for tiny ML person detection . modified it to turn LED ON and OFF id the person detection probability is more than 75%


Please Login to comment
2 Comment authors
ronpangharsha Recent comment authors
newest oldest most voted
Notify of

Hi harsha,
I’m Ron from WIZnet HK. Could I post your article to our WIZnet HK instagram account?

BTW, do you have a instagram account that I could tag you?

Best Regards,

Mbed Ethernet Library
Reusable S/W