Audio Doorbell Using M5GO IoT Starter Kit

Did you know that you can add play an audio using M5GO?


Do you want to make a doorbell that plays your own voice or mp3 audio? In this video, I create a simple doorbell that plays “Hello, welcome” and displays a welcome note whenever it detects a motion using M5GO IoT Starter Kit.


This tutorial shows how to make an audio doorbell using the M5GO IoT Starter Kit.

Hardware Preparation

This is the list of items used in the video.

Sample Program

This is the Arduino sample code is to play an mp3 audio when the motion sensor is triggered. Please install the following library through Library Manager.

  • M5Stack V0.3.0
  • ESP8266 Audio
#pragma mark – Depend ESP8266Audio and ESP8266_Spiram libraries
#include <M5Stack.h>
#include <WiFi.h>
#include "AudioFileSourceSD.h"
#include "AudioFileSourceID3.h"
#include "AudioGeneratorMP3.h"
#include "AudioOutputI2S.h"
AudioGeneratorMP3 *mp3;
AudioFileSourceSD *file;
AudioOutputI2S *out;
AudioFileSourceID3 *id3;
bool playing = false;
bool curr = false;
bool prev = false;
void setup() {
pinMode(36, INPUT);
void loop() {
curr = digitalRead(36);
if (curr != prev) {
if (curr == true) {
M5.Lcd.setCursor(30, 70);
prev = curr;
if (playing) {
if (mp3->isRunning()) {
if (!mp3->loop()) {
playing = false;
} else {
bool play() {
if (file) {
delete file;
file = NULL;
if (mp3) {
delete mp3;
mp3 = NULL;
if (out) {
delete out;
out = NULL;
file = new AudioFileSourceSD("/Hello.mp3");
id3 = new AudioFileSourceID3(file);
out = new AudioOutputI2S(0, 1);
mp3 = new AudioGeneratorMP3();
mp3->begin(id3, out);
playing = true;
return true;

view raw
hosted with ❤ by GitHub

Thank You

Thanks for reading this tutorial. If you have any technical inquiries, please post at Cytron Technical Forum.

Please be reminded, this tutorial is prepared for you to try and learn.
You are encouraged to improve the code for better application.

Leave a Comment

Your email address will not be published.

Share this Tutorial

Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest
Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest

Latest Tutorial

Getting Started with Robotic Operating System (ROS) and JetRacer AI Kit
Barrier Gate with micro:bit and MakeCode
Play MP3 File on Maker Pi Pico Using CircuitPython
Remote Jetson Nano using SSH with Visual Studio Code
3.3V Serial LCD with Raspberry Pi Pico via SPI or I2C
Tutorials of Cytron Technologies Scroll to Top