Meow Detector – Part 2: Audio Playback

Written by:

Overview

This project uses the Coral Dev Board Micro to detect my cat meowing and then plays a voice recording to calm my cat. In my first blog post (Meow Detector – Part 1: Detection), I just set the green User LED to light up whenever a meow was detected. This post details the steps to play back audio after detecting my cat meowing.

Demonstration Video

Materials

The links below are similar to the materials I used in the project. I picked up a speaker for $1 and voice playback module for $12 at Torrance Electronics Inc.

Wiring

  • The USB-C Breakout VBus pin provides 5V to power the Coral Dev Board and the Audio playback module. It connects to the VSYS pin of the Coral Dev Board micro and the +5V pin of the Audio Playback module (red wire in picture).
  • The USB-C Breakout GND pin connects to Coral Dev Board micro ground and Audio Playback module ground pins (black wire in picture).
  • The Speaker can connect in any orientation to the “Speaker” pins on the Audio playback module. It also has a 3.5mm headphone jack as another option.
  • The Coral Dev connects 4 GPIO pins to IO0 through IO3 pins on the Audio playback module. This is shown in the table below. The corresponding MP3 is played when the IO pin is grounded.
Coral Dev Board Micro PinAudio Playback Module PinMP3 Name
(On SD Card)
A1IO000001.mp3
A0IO100002.mp3
D2IO200003.mp3
D1IO300004.mp3
My setup. Ex: Set A1 pin LOW to play 00001.mp3

Code

The code can be found here and is compatible with the Arduino IDE.

The Coral Dev Board Micro gives the options to program using FreeRTOS or Arduino IDE. I used the Arduino IDE since I was more familiar.

I based the code on the ClassifyAudio example and my previous post here. Also see my previous post for notes on flashing the Coral Dev Board Micro.

4 responses to “Meow Detector – Part 2: Audio Playback”

  1. Dan Avatar
    Dan

    This is great.
    How long can the recording be?

    Like

    1. Aaron Avatar
      Aaron

      Thanks! I used a 32GB SD card so it can fit up to 32GB of mp3 files. Forgot to mention in the post that I programmed it to switch between four mp3 files by pressing the User button on the Coral dev board.

      But the Audio playback board can technically support up to 65535 files if using UART mode instead of I/O mode. The mode can be changed with the three red switches on the audio playback module (blue board).

      Like

      1. Dan Avatar
        Dan

        Does the cat respond to just a short sentence or does it need something longer?
        Does the device respond specifically to a cat’s meow or can any sound set it off?

        Like

      2. Aaron Avatar
        Aaron

        It only responds meowing. It’s running the YAMNet audio event classifier:
        https://www.kaggle.com/models/google/yamnet/frameworks/tfLite

        Which can identify any of these sounds:
        https://github.com/tensorflow/models/blob/master/research/audioset/yamnet/yamnet_class_map.csv

        And I have it trigger on Meow (ID of 78) or Cat (ID of 76).

        Like

Leave a reply to Dan Cancel reply