ESP8266 based IoT Health Care Panic Alarm for Elderly Folks

ESP8266 based IoT Health Care Panic Alarm for Elderly Folks

IoT Projects

In this tutorial we gonna build ESP8266 based IoT Health Care Panic Alarm for Elderly Folks based on simple and unique architecture. We will also see the design idea and the motivation behind this project. Basically, the project is designed for elderly folks. Because we can see lots of elder people around us. Some of them are technology-friendly and some are not. Hence, they need a device when they need somebody’s attention with very minimal design and activity. Finally, we have designed this IoT Health care Panic Alarm device which works over WiFi. The design is simple, unique, and minimal, we just have one button with a LED. ESP8266 Microcontroller is used to make it simple and portable we can use the battery pack as well. 

ESP8266 based IoT Health Care Panic Alarm for Elderly Folks

You may also like: RFID Based Attendance System Using NodeMCU with PHP Web App

The functionality of IoT Panic Alarm

The functionality of this panic Alarm for Elder’s is very simple. You just push the button and acknowledgment is just given in the form of LED Glow for about 5 seconds. And parallelly, an email is sent to whoever parties you want to get attention from. Obviously, we can configure to send an SMS or a phone call as well. You can also set the setting to call the Hospital or Ambulance. So, it’s basically a digital hight. So that you can use that to do any triggering activities. 

For example, an email can be sent to their Son or Daughter. A text SMS can go out to relatives. They can call their grandson or son with one button. It is a portable project. Basically, you can add a battery pack and make a wearable device. Actually, using this project you can have lots of benefits.

Benefits of IoT Health care Panic Alarm

  • During an Emergency alert Family or Authority.

Obviously, during an emergency like let’s say that an elderly folk goes to the restroom and then by mistake he/she slip down by mistake. Now, they need immediate attention. Obviously, they can’t carry an iPad or a phone or things like that, if they have something in their hand is which they were wearing. They can just push the button and get immediate help. 

  • Get Instant Family Attention.

Let’s say that they need medical supplies or some food or whatever it may be. Imagine folk was about 80 to 90 years old and they need some attention. So that they can press a button and then can get whatever they want. Hence, they got family attention immediately. 

  • You simply miss them and need them to come by.

Thirdly, let’s imagine the elderly folks are living alone and they just miss somebody and they just let them know politely. ” Hey I’ am missing you Why don’t you meet me for some time”. 

Here, I have only one button, you can add two or 3 more buttons as well. But make sure you keep the device minimal and simple because we don’t want to create any confusion. 

ESP8266 based IoT Health Care Panic Alarm for Elderly Folks

Our Popular Project: IoT Based RFID Smart Door Lock System Using NodeMCU ESp8266

Requirements for this project

  • NodeMCU ESP8266 Development Board.
  • A battery pack to make it portable.
  • A Push Button.
  • LED
  • A case to make it a wearable device. 

Circuit Diagram/Schematics

Circuit Diagram ESP8266 based IoT Health Care Panic Alarm for Elderly Folks
Circuit Diagram of ESP8266 based IoT Health Care Panic Alarm for Elderly Folks

Connect Battery Pack Positive terminal to the NodeMCU Vin pin. Interface Negative terminal to the GND Pin. Now connect one terminal of the button to the GND and other to the D5 pin of NodeMCU. Similarly, Anode ( Positive terminal) pin of LED to the D2 pin and Cathode pin (Negative terminal)  to GND. Finally, we are done with the circuit diagram.

Setting Thinger.io IoT Platform

Sign Up to the thinger.io platform from this link. Activate your account from an email that you have received. Now Sign In with your credentials. 

  • First of all, we will add a device from devices.
  • You need to give your device ID, Description, and device credentials. ( Credentials are nothing but your password which you will need at coding part). 
  • Now, go to the endpoint and add your endpoint.
  • Again we need to use this endpoint identifier on our code.
  • Select the endPoint type as an email. Once you select, you have to give an email address to which you want to send this email.
  • Add your subject and Write your own Alert or Attention Message on the Email body.

Note: Obviously, you need to remember your username as well because we need it on the coding part. Below is the sample email alert template that I have created for you.

Email Template for IoT Based panic Alarm

Email Template:1

Subject: Attention !!! Required Urgent Assist.

Attention !!!

Required Urgent Assistance

Dear Son/Daughter,

This is your Dad “XYZ”, I am not feeling good. There has been a lot to my health since my last checkup.

At present, I do require Urgent Medical Assist at my place. Location [Address: “XYZ”]

Contact an AMBULANCE, ASAP

Email Template:2

Subject: Required Urgent Attention

Dear Son/Daughter,

How are you doing?

I am missing you and I need some help.

Could you please call me or come by today.

I hope, I have not disturbed you. 

Loving Dad/Mom

IoT Health Care Panic Alarm Source Code



#include <SPI.h>
#include <ESP8266WiFi.h>
#include <ThingerWifi.h>


ThingerWifi thing("theiotprojects", "PanicAlarm", "12345678");               // thinger.io( username,device name,device credentials )
int pushPin = 14; //the digital pin to the PIR sensor's output
int ledPin = 4;
int val = 0; //variable for reading pin status


void setup() {

  pinMode(ledPin, OUTPUT);  // declare LED  as output
  pinMode(pushPin, INPUT_PULLUP);  //declare push button as input
  Serial.begin(115200);
  //connecting to WiFi
  thing.add_wifi("Alsan Air WiFi 4", "[email protected]");                                     //SSID & password for mobile hotspot
  Serial.println("entering the gates");
}

void loop() {
  val = digitalRead(pushPin);
  Serial.println(val); //read input value
  if (val == LOW) {  //checks if the input is High (button released)
    digitalWrite(ledPin, HIGH); //turn LED OFF
    delay(1000);
    digitalWrite(ledPin, LOW);

    thing.handle();
    thing.call_endpoint("email");
    delay(5000);
    //digitalWrite(inPin, HIGH);
  } else {
    digitalWrite(ledPin, LOW);  //turn LED ON
  }

}

Read More: Dual Axis Solar Tracker Arduino Project Using LDR & Servo Motors

Source Code Explanation

This code has three specific parts, the first one is connecting to a WiFi using Thinger service. The second part is using Logic and reading from the pin. If the value is low then we are triggering a set of activities. Finally, the third part is calling another service from a thinger called email.

So these are the library file which we need.

#include <SPI.h>
#include <ESP8266WiFi.h>
#include <ThingerWifi.h>

Here, you need to pass the thinger credentials. You can shortly look at the thinger platform. This is the username, endpoint name, and password. 

ThingerWifi thing("theiotprojects", "PanicAlarm", "12345678");    // thinger.io( username,device name,device credentials )

Here are the set of pins defined for the button and LED.

int pushPin = 14; //the digital pin to the PIR sensor's output
int ledPin = 4;

Another variable (Val) is declared to read the status of the pins. 

int val = 0; //variable for reading pin status

Also Read: IoT Web Controlled Smart Notice Board using NodeMCU ESP8266

On void setup ( ). We are setting the PinMode LED to Output and Pinmode Pushpin for Input pullup. Now, what this input pullup gonna do is it is always High and when the button is pressed it goes to low. 

void setup() {

  pinMode(ledPin, OUTPUT);  // declare LED  as output
  pinMode(pushPin, INPUT_PULLUP);  //declare push button as input

We are calling thing.add_wifi service. Here, pass your wifi credentials (SSID and Password).

 thing.add_wifi("Alsan Air WiFi 4", "[email protected]"); //SSID & password for mobile hotspot
  Serial.println("entering the gates");

On the loop what we are doing is reading the value of push pin to the variable val. And if the value is low, we write the LED Pin, High. Delay by a second and Led pin to the low.

val = digitalRead(pushPin);
  Serial.println(val); //read input value
  if (val == LOW) {  //checks if the input is High (button released)
    digitalWrite(ledPin, HIGH); //turn LED OFF
    delay(1000);
    digitalWrite(ledPin, LOW);

Then you call the thing.handle function to trigger the thing.endpoint as (email). We are just delaying by 5 seconds. Finally, if nothing happens the led remains low.

thing.handle();
    

Thinger.call_endpoint(“email”) triggering email from thinger.io with thinger. Handle function.

thing.call_endpoint("email");
    delay(5000);
    //digitalWrite(inPin, HIGH);
  } else {
    digitalWrite(ledPin, LOW);  //turn LED ON

Also Read: How can IoT help within the COVID-19 crisis

ESP8266 based IoT Health Care Panic Alarm for Elderly Folks Video Tutorial

This is the video that demonstrate how we made an ESP8266 based IoT Health Care Panic Alarm for Elderly Folks.

Conclusion

Finally, we have successfully made an ESP8266 based IoT Health Care Panic Alarm for Elderly Folks. Using Thinger.io IoT Platform, NodeMCU ESP8266, a push button, and a LED. I hope you enjoyed reading this article. For more amazing content keep supporting us by share the post to social media.

Alsan Parajuli

I am a WordPress enthusiast, a hardworking and highly positive person. I always believes in practicality rather than theoretical knowledge. With my curiosity and fast learning skills, I managed to learn everything on my own. I love coding, editing, writing and rummaging around Internet. I am passionate about IoT Projects, Digital marketing, website designing, and reviewing. Moreover, I had been contributing to WordPress Biratnagar as an active member since 2018.

https://theiotprojects.com/

1 thought on “ESP8266 based IoT Health Care Panic Alarm for Elderly Folks

Leave a Reply