Jump to content
Electronics-Lab.com Community

Building a Voice Controlled SOS System with Telegram Alert


Recommended Posts

As our population ages, ensuring the safety and well-being of seniors becomes increasingly important. A voice-controlled SOS system can provide peace of mind for both elders and their caregivers. In this project, we’ll create a personalized emergency response system that allows seniors to call for help using voice commands. Additionally, we’ll integrate Telegram alerts to notify caregivers or family members instantly.

Project Components⚙️

  • Voice Recognition Module: We’ll use a voice recognition chip or module that responds to specific voice commands. When the user says a predefined phrase (e.g., “Help” or “Emergency”), the system will activate.
  • Microcontroller (M5StickC): The brain of our system, responsible for processing voice commands and triggering alerts.
  • Telegram Bot: We’ll set up a Telegram bot to send alerts to designated contacts. Telegram provides a secure and reliable platform for notifications.

Get PCBs for Your Projects Manufactured

2_sS1dUXE2bz.PNG?auto=compress%2Cformat&
 

You must check out PCBWAY for ordering PCBs online for cheap!

You get 10 good-quality PCBs manufactured and shipped to your doorstep for cheap. You will also get a discount on shipping on your first order. Upload your Gerber files onto PCBWAY to get them manufactured with good quality and quick turnaround time. PCBWay now could provide a complete product solution, from design to enclosure production. Check out their online Gerber viewer function. With reward points, you can get free stuff from their gift shop. Also, check out this useful blog on PCBWay Plugin for KiCad from here. Using this plugin, you can directly order PCBs in just one click after completing your design in KiCad.

Step 1️⃣:Voice Recognition Module Setup🔊:

Connect the voice recognition module to the M5StickC via the Grove interface. The Grove interface consists of a standardized 4-pin connector (GND, VCC, SDA, SCL).

image_jOViQRgAXq.png?auto=compress%2Cfor
 

Connect the voice recognition module’s pins (VCC, GND, SDA, SCL) to the corresponding Grove pins on the M5StickC.

image_35x8Nho6Qr.png?auto=compress%2Cfor
 

Train the module with the chosen SOS phrases. In my case, I'm going to use the default wake word as a SOS command.

Step 2️⃣:Microcontroller Configuration⌨️:

First, we need to install the Voice Learning sensor's library to the Arduino IDE.

Here is the library link - GitHub - DFRobot/DFRobot_DF2301Q
image_evxdSImKhP.png?auto=compress%2Cfor
 

Here is the simple Arduino sketch that can read the voice learning sensor's command and print the command ID.

#include "DFRobot_DF2301Q.h"
DFRobot_DF2301Q_I2C DF2301Q;
void setup()
{
    Serial.begin(115200);
    while( !( DF2301Q.begin() ) ) {
    Serial.println("Communication with device failed, please check connection");
    delay(3000);
    }
    Serial.println("Begin ok!");
    DF2301Q.setVolume(7);
    DF2301Q.setMuteMode(0);
    DF2301Q.setWakeTime(15);
    uint8_t wakeTime = 0;
    wakeTime = DF2301Q.getWakeTime();
    Serial.print("wakeTime = ");
    Serial.println(wakeTime);
    DF2301Q.playByCMDID(23);   // Common word ID
}

void loop()
{
    uint8_t CMDID = 0;
    CMDID = DF2301Q.getCMDID();
    if(0 != CMDID) {
    Serial.print("CMDID = ");
    Serial.println(CMDID);
    }
    delay(3000);
}

Here is the serial terminal response.

image_LFZKCYlMzo.png?auto=compress%2Cfor
 

Step 3️⃣:Setting up the Telegram Bot 🤖:

Go to Google Play or App Store, download, and install Telegram. In my case, I'm using telegram web. First, search for “botfather” and click the BotFather as shown below.

image_TaVEFkDdmH.png?auto=compress%2Cfor
 

Next, start the BotFather, and use /newbot to create a new bot.

image_hr6z9lNAAb.png?auto=compress%2Cfor
 

Next, name your bot.

image_ec1cs7iae2.png?auto=compress%2Cfor
 

Then, mention the username.

image_pVgWWxT0DW.png?auto=compress%2Cfor
 

Finally, it will show you the API key.

image_B8DZT12evC.png?auto=compress%2Cfor
 

Step 4️⃣: Creating a user for Telegram Bot 👤:

Anyone that knows your bot username can interact with it. To make sure that we ignore messages that are not from our Telegram account (or any authorized users), you can get your Telegram User ID.

In your Telegram account, search for “IDBot

image_syYSHszt6y.png?auto=compress%2Cfor
 

Start a conversation with that bot and type /getid. You will get a reply with your user ID. Save that user ID, because you’ll need it later in this tutorial.

Step 5️⃣:System Deployment🛜:

Finally, upload the following sketch to the M5StickC and change the credentials as per your Bot setup.

#include <WiFi.h>
#include <WiFiClientSecure.h>
#include <UniversalTelegramBot.h>
#include <ArduinoJson.h>
#include "DFRobot_DF2301Q.h"
#include <M5StickC.h>

DFRobot_DF2301Q_I2C DF2301Q;
// Replace with your network credentials
const char* ssid = "ELDRADO";
const char* password = "amazon123";
// Initialize Telegram BOT
#define BOTtoken "6897873881"  // your Bot Token (Get from Botfather)
#define CHAT_ID ""
WiFiClientSecure client;
UniversalTelegramBot bot(BOTtoken, client);

void setup() {
    Serial.begin(115200);
    M5.begin();
    M5.Lcd.setRotation(3);
    M5.Lcd.fillScreen(BLACK);
    M5.Lcd.setSwapBytes(true);
    M5.Lcd.setTextSize(1);
    M5.Lcd.setCursor(7, 20, 2);
    M5.Lcd.setTextColor(TFT_GREEN, TFT_BLACK);

    // Attempt to connect to Wifi network:
    Serial.print("Connecting Wifi: ");
    Serial.println(ssid);
    WiFi.mode(WIFI_STA);
    WiFi.begin(ssid, password);

    client.setCACert(TELEGRAM_CERTIFICATE_ROOT);  // Add root certificate for api.telegram.org

    while (WiFi.status() != WL_CONNECTED) {
        Serial.print(".");
        delay(500);
    }
    Serial.println("");
    Serial.println("WiFi connected");
    Serial.print("IP address: ");
    Serial.println(WiFi.localIP());
    bot.sendMessage(CHAT_ID, "Bot started up", "");
    while (!(DF2301Q.begin())) {
        Serial.println("Communication with device failed, please check connection");
        delay(3000);
    }

    Serial.println("Begin ok!");
    DF2301Q.setVolume(7);
    DF2301Q.setMuteMode(0);
    DF2301Q.setWakeTime(15);
    uint8_t wakeTime = 0;
    wakeTime = DF2301Q.getWakeTime();
    Serial.print("wakeTime = ");
    Serial.println(wakeTime);
    DF2301Q.playByCMDID(23);  // Common word ID
}

void loop() {
    uint8_t CMDID = 0;
    CMDID = DF2301Q.getCMDID();
    if (0 != CMDID) {
        Serial.print("CMDID = ");
        Serial.println(CMDID);
        bot.sendMessage(CHAT_ID, "Alarm Triggered !!", "");
        M5.Lcd.fillScreen(BLACK);
        M5.Lcd.setCursor(3, 2);
        M5.Lcd.print("Alarm Triggered !!");
    }
    delay(5000);
    M5.Lcd.fillScreen(BLACK);
    M5.Lcd.setCursor(1, 3);
    M5.Lcd.print("System Online");
}

Once you have uploaded the sketch look for the serial terminal response.

image_J5j8XHS61y.png?auto=compress%2Cfor
 

Now let's test the system, just say the command word and look for the response.

image_mksAozgbrV.png?auto=compress%2Cfor
 

Here is the Telegram response.

image_QRTLzdMSjF.png?auto=compress%2Cfor
 

Conclusion

By combining voice control, Telegram alerts, and a user-friendly interface, our Voice-Controlled SOS System provides a simple yet effective solution for seniors. Whether they’re at home or outdoors, they can call for help with ease. Caregivers and family members can rest assured knowing that they’ll receive immediate notifications in case of an emergency. Let’s build a safer and more connected environment for our elders! 🗣️🆘📲

Link to comment
Share on other sites


Imuregen and Its Impact on Gut Health

Imuregen has received positive   imuregen reviews  from users who have experienced its benefits firsthand. Many individuals report significant improvements in their health conditions, attributing their recovery and well-being to the use of Imuregen supplements.

 

 

Mechanisms of Action:

  • Antioxidant Properties: High levels of flavonoids provide strong antioxidant protection.
  • Immune Modulation: Enhances cytokine production, boosting immune response.

Comparison:

  • Focus: Primarily provides antioxidant support and boosts immune signaling.
  • Scope: Does not include essential nutrients like nucleotides, peptides, or a wide range of vitamins/minerals.

Zinc Supplements

Key Ingredients:

  • Zinc: Essential mineral for immune function.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
  • Create New...