PawTalk: Bridge the Communication Gap Between Dogs and Their Humans

by Juliane Farmer in Circuits > Raspberry Pi

45 Views, 0 Favorites, 0 Comments

PawTalk: Bridge the Communication Gap Between Dogs and Their Humans

IMG_20240613_193030.jpg
IMG_20240613_133655.jpg
IMG_20240613_133807.jpg
IMG_20240613_133830.jpg
IMG_20240613_134013.jpg
IMG_20240613_200443.jpg

Have you ever wished you could understand what your dog is feeling? This project aims to do just that by translating dog emotions into human language. Using a combination of a Raspberry Pi, a trained YOLOv8 model, a LCD display and a RGB LED, we'll create a device that detects and displays your dog's emotions. Join me on this exciting journey to enhance the bond with our canine companions through technology and creativity.

Supplies

bill_of_materials.png

Here's a list with all the things needed to recreate my project:

  • Raspberry Pi v5
  • Freenove Projects kit
  • LCD display
  • RGB LED
  • USB Camera
  • Yolov8 model
  • Dataset with dog emotions
  • GPIO Button
  • Micro SD Card
  • Ethernet cable
  • Power supply for Raspberry Pi

Gathering the Necessary Supplies

Go back to the ‘Supplies’ section above for the list with the mandatory things needed.

Setting Up the Raspberry Pi

IMG_20240613_200316.jpg

Install Raspberry Pi OS:

  • Download and install Raspberry Pi OS on a microSD card.
  • Connect the Raspberry Pi to your laptop.
  • Power it up and follow the setup instructions.


Collecting & Preparing the Dataset

1.      Find a Suitable Dataset:

  • Look for a dataset that has diverse dog breeds and emotions.


2.      Upload to Roboflow:

  • Go to your Roboflow account and upload your dataset.
  • Create classes for emotions (for my project I used happy, sad, angry and neutral).
  • Label all images accordingly.


3.      Split Dataset:

  • Split the dataset into 70% training, 20% validation and 10% testing sets.


Training the Model

code_model_training.png

1 . Begin the training on Roboflow:

  • Train your model on Roboflow to get an overview of how the accuracy estimates your model could achieve.


2 . Export and Train Locally:

  • Export the dataset and train your own model on your local machine using the YOLO framework with a Jupyter Notebook.

Setting Up the AI Part

1.      Load the Model and Camera Feed:

  • Create a script to load the trained model and capture images using the USB camera.
  • Process the images to detect emotions.


2.      Send Data to Raspberry Pi:

  • Use socket programming to send the detected emotion data over wirless connection to your Raspberry Pi.


Downloads

Setting Up the Raspberry Pi Part

1.      Set Up your Server:

  • Create a server on the Raspberry Pi to handle incoming connections and data.


2.      Handle Connections and Data:

  • Write code to process the received data (emotion, accuracy) and update the RGB LED and LCD display accordingly.


3.      Integrate Button Functionality (not mandatory but I included it in my code):

  • Add a button to toggle the RGB LED state.


Downloads

Testing and Fine-Tuning the Model

1.      Test the Complete System:

  • Run the setup (first run rpi part to start server and then ai part to connect to it) and check the data is being correctly received and processed.
  • Verify that the RGB LED and LCD display are working as intended.


2.      Adjust Model Parameters:

  • Fine-tune your model further if needed to improve accuracy and reduce overfitting.


3.      Evaluate and Refine:

  • Continuously check the performance and make necessary adjustments to your model when training or in the ai/rpi code to improve your system.


Making a Wooden Box for Raspberry Board

IMG_20240613_192330.jpg
IMG_20240613_200316.jpg
IMG_20240613_200443.jpg

1 . Design the Box:

  • Sketch a design for a wooden box that can house the Raspberry Pi, LCD display, and RGB LED. I used the website Makercase for mine, you'll find plenty of inspiration there for all kinds of boxes.


2 . Gather Materials:

  • Material such as wood, glue, screws, nails, tape. etc. I used a laser cutter for my box, so I only needed wood and glue.


3 . Build the Box:

  • Cut the wood according to your design and assemble the pieces to create the box. Alternatively you could also use a laser cutter for precise joints.
  • Ensure you include openings for the LCD display, RGB LED and all necessary cables.

4 . Mount the Components:

  • Secure the Raspberry Pi, LCD display, and RGB LED inside the box. You can use tape, screws or other fasteners as you need it.
  • Make sure that at the end everything is properly connected and functioning.

5 . Final Touches:

  • Use sandpaper to smooth out any rough edges or to make necessary adjustments.



Downloads

Get the Code From GitHub

I've also attached my GitHub so that you can see the structure I used for my code in order to recreate my project :)

GoToGitHub