IoT: In the Cloud

Enter Your Project for a chance to win an Arduino MKR WAN 1300 Kit with a Compatable Lora Gateway or an MKR 1400 GSM with a Shield Combo + a $100 shopping cart!

Back to The Project14 homepage

Project14 Home
Monthly Themes
Monthly Theme Poll

 

THING FINDER

SUMMARY

This project is aimed to build a tag for making "Finding Things Easier" and being able to locate misplaced things easily , so this device would enable to find our thing by triggering the buzzer over google assistant or local server and it even gives probability region of the thing making our task easier to find that thing. This would be very helpful for old aged people and people suffering from alzheimer to find their important things which are misplaced just by using the phone to ring the tag and find the thing just like we find our  misplaced phone by giving missed call.

HARDWARE REQUIRED

ESP32(ESP8266 can be used)

MKR WIFI 1010

BUZZER

SOFTWARE REQUIRED

Arduino IDE

Blynk

IFTTT

SCHEMATIC

There is only two connection that of the buzzer

Buzzer leg 1 - GPIO 26

Buzzer leg 2 - GND

WORKING

                                                       

This project is made to make finding things easier, it has the esp32 as the tag which has buzzer connected and whenever we have misplaced our thing and we have to find it we can easily find it out by triggering it via google assistant(any voice assistant) or local network , ringing the buzzer would help us to locate the thing by hearing the sound and to make it easier i added feature of probability region which would tell us about the  probability of finding the thing in that region(ie room) and even our phone would give the probability region so we can easily navigate to region near the lost thing . This has the esp32 which connects to the internet if available and can be triggered over google assistant via IFTTT on Blynk cloud and if the internet is not available esp32 creates an access point to which we need to connect and then we can easily trigger it from local ip address( which is 192.168.4.1), the probability region of the device is measured by measuring the signal strength of the nodes and thus giving a probability region for finding our things and this is displayed on Blynk when internet is available and on local server when internet is not available .

VIDEO DEMO

                                                                                      

Code for ESP32

/*
CODE Made by Aabhas Senapati
THE only connection is buzzer connected with pin 26 of esp32 and other to ground pin
*/
#include <WiFi.h>
#define BLYNK_PRINT Serial
char auth[] = "YOUR AUTH TOKEN";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid1[] = "Wifi";
char pass1[] = "password";
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
// Replace with your network credentials
const char* ssid     = "THING_FINDER";
const char* password = "123456789";
// Set web server port number to 80
WiFiServer server(80);
// Variable to store the HTTP request
String header;
// Auxiliar variables to store the current output state
String output26State = "off";//buzzer pin 
String output27State = "off";
int count = 0;
String room1;
int Room1 = 256;
String room2;
int Room2 = 256;
String room3;
int Room3 = 256;
int count2 = 0;
int count3 = 0;
// Assign output variables to GPIO pins
const int output26 = 26;
const int output27 = 2;
void setup() {
  Serial.println("Setup done");
  Serial.begin(115200);
  // Initialize the output variables as outputs
  pinMode(output26, OUTPUT);
  pinMode(output27, OUTPUT);
  // Set outputs to LOW
  digitalWrite(output26, LOW);
  digitalWrite(output27, LOW);
  // Connect to Wi-Fi network with SSID and password
  Serial.print("Setting AP (Access Point)…");
  // Remove the password parameter, if you want the AP (Access Point) to be open
  WiFi.softAP(ssid, password);
  IPAddress IP = WiFi.softAPIP();
  Serial.print("AP IP address: ");
  Serial.println(IP);
  server.begin();
  int n = WiFi.scanNetworks();
  for (int i = 0; i < n; ++i) {
    // Print SSID and RSSI for each network found
    Serial.print(i + 1);
    Serial.print(": ");
    Serial.print(WiFi.SSID(i));
    Serial.print(" (");
    Serial.print(WiFi.RSSI(i));
    Serial.print(")");
    Serial.println((WiFi.encryptionType(i) == WIFI_AUTH_OPEN) ? " " : "*");
    if ((WiFi.SSID(i)) == "Wifi") {
      count = 1;
    }
  }
  if (count == 1) {
    Blynk.begin(auth, ssid1, pass1);
  }
}
void loop() {
  WiFiClient client = server.available();   // Listen for incoming clients
  Serial.println("scan start");
  // WiFi.scanNetworks will return the number of networks found
  int n = WiFi.scanNetworks();
  Serial.println("scan done");
  if (n == 0) {
    Serial.println("no networks found");
  } else {
    Serial.print(n);
    Serial.println(" networks found");
    for (int i = 0; i < n; ++i) {
      // Print SSID and RSSI for each network found
      Serial.print(i + 1);
      Serial.print(": ");
      Serial.print(WiFi.SSID(i));
      Serial.print(" (");
      Serial.print(WiFi.RSSI(i));
      Serial.print(")");
      Serial.println((WiFi.encryptionType(i) == WIFI_AUTH_OPEN) ? " " : "*");
      if ((WiFi.SSID(i)) == "PHONE") {
        room1 = WiFi.RSSI(i);
        Room1 = -(room1.toInt());
      }
      if ((WiFi.SSID(i)) == "ROOM1") {
        room2 = WiFi.RSSI(i);
        Room2 = -(room2.toInt());
      }
      if ((WiFi.SSID(i)) == "ROOM2") {
        room3 = WiFi.RSSI(i);
        Room3 = -(room3.toInt());
      }
      if ((WiFi.SSID(i)) == "Wifi") {
        count2 = 1;
      }
    }
  }
  if ((count2 == 1))
  {
    Blynk.run();
    Blynk.virtualWrite(V1, ((256 - Room1) * 100) / 256);
    Blynk.virtualWrite(V2, ((256 - Room2) * 100) / 256);
    Blynk.virtualWrite(V3, ((256 - Room3) * 100) / 256);
    count2 = 0;
    count3 = 1;
  }
  if ((count3 == 1) && (count == 1))
  {
    Blynk.run();
    Blynk.virtualWrite(V1, ((256 - Room1) * 100) / 256);
    Blynk.virtualWrite(V2, ((256 - Room2) * 100) / 256);
    Blynk.virtualWrite(V3, ((256 - Room3) * 100) / 256);
  }
  if (count3 == 0) {
    if (client) {                             // If a new client connects,
      Serial.println("New Client.");          // print a message out in the serial port
      String currentLine = "";                // make a String to hold incoming data from the client
      while (client.connected()) {            // loop while the client's connected
        if (client.available()) {             // if there's bytes to read from the client,
          char c = client.read();             // read a byte, then
          Serial.write(c);                    // print it out the serial monitor
          header += c;
          if (c == '\n') {
            if (currentLine.length() == 0) {
              client.println("HTTP/1.1 200 OK");
              client.println("Content-type:text/html");
              client.println("Connection: close");
              client.println();
              if (header.indexOf("GET /26/on") >= 0) {
                Serial.println("GPIO 26 on");
                output26State = "on";
                digitalWrite(output26, HIGH);
              } else if (header.indexOf("GET /26/off") >= 0) {
                Serial.println("GPIO 26 off");
                output26State = "off";
                digitalWrite(output26, LOW);
              } else if (header.indexOf("GET /27/on") >= 0) {
                Serial.println("GPIO 27 on");
                output27State = "on";
                digitalWrite(output27, HIGH);
              } else if (header.indexOf("GET /27/off") >= 0) {
                Serial.println("GPIO 27 off");
                output27State = "off";
                digitalWrite(output27, LOW);
              }             // Display the HTML web page
              client.println("<!DOCTYPE html><html>");
              client.println("<head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">");
              client.println("<link rel=\"icon\" href=\"data:,\">"); // Feel free to change the background-color and font-size attributes to fit your preferences
              client.println("<style>html { font-family: Helvetica; display: inline-block; margin: 0px auto; text-align: center;}");
              client.println(".button { background-color: #4CAF50; border: none; color: white; padding: 16px 40px;");
              client.println("text-decoration: none; font-size: 30px; margin: 2px; cursor: pointer;}");
              client.println(".button2 {background-color: #555555;}</style></head>");      // Web Page Heading
              client.println("<body><h1>ESP32 Web Server</h1>");              // Display current state, and ON/OFF buttons for GPIO 26
              client.println("<p>THING FINDER- State " + output26State + "</p>"); // If the output26State is off, it displays the ON button
              if (output26State == "off") {
                client.println("<p><a href=\"/26/on\"><button class=\"button\">FIND YOUR THING</button></a></p>");
              } else {
                client.println("<p><a href=\"/26/off\"><button class=\"button button2\">GOT YOUR THING</button></a></p>");
              } // Display current state, and ON/OFF buttons for GPIO 27
              client.println("<p>PHONE DISTANCE " + room1 + "</p>");
              client.println("<p>ROOM1 DISTANCE " + room2 + "</p>");
              client.println("<p>ROOM2 DISTANCE " + room3 + "</p>");// The HTTP response ends with another blank line
              client.println();// Break out of the while loop
              break;
            }
            else { // if you got a newline, then clear currentLine
              currentLine = "";
            }
          }
          else if (c != '\r') {  // if you got anything else but a carriage return character,
            currentLine += c;      // add it to the end of the currentLine
          }
        }
      } // Clear the header variable
      header = "";// Close the connection
      client.stop();
      Serial.println("Client disconnected.");
      Serial.println("");
    }
  }
  if ((count == 0) && (count3 == 1))
  {
    ESP.restart();
  }
  if ((count == 1) && (count3 == 0))
  {
    ESP.restart();
  }
  if ((count == 1) && (count3 == 1))
  {
    count3 = 0;
  }
}

Code for MKR WIFI 1010

#include <SPI.h>
#include <WiFiNINA.h>
#include "arduino_secrets.h" 
///////please enter your sensitive data in the Secret tab/arduino_secrets.h
char ssid[] = SECRET_SSID;        // your network SSID (name)
char pass[] = SECRET_PASS;    // your network password (use for WPA, or use as key for WEP)
int keyIndex = 0;                // your network key Index number (needed only for WEP)


int led =  LED_BUILTIN;
int status = WL_IDLE_STATUS;
WiFiServer server(80);


void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(9600);
  
  Serial.println("Access Point Web Server");


  pinMode(led, OUTPUT);      // set the LED pin mode


  // check for the WiFi module:
  if (WiFi.status() == WL_NO_MODULE) {
    Serial.println("Communication with WiFi module failed!");
    // don't continue
    while (true);
  }


  String fv = WiFi.firmwareVersion();
  if (fv < "1.0.0") {
    Serial.println("Please upgrade the firmware");
  }


  // by default the local IP address of will be 192.168.4.1
  // you can override it with the following:
  // WiFi.config(IPAddress(10, 0, 0, 1));


  // print the network name (SSID);
  Serial.print("Creating access point named: ");
  Serial.println(ssid);


  // Create open network. Change this line if you want to create an WEP network:
  status = WiFi.beginAP(ssid, pass);
  if (status != WL_AP_LISTENING) {
    Serial.println("Creating access point failed");
    // don't continue
    while (true);
  }


  // wait 10 seconds for connection:
  delay(10000);


  // start the web server on port 80
  server.begin();


  // you're connected now, so print out the status
  }




void loop() {
}


























 

CONCLUSION AND FINAL PRODUCT

I actually learnt a lot while making this project and I have made this using esp32 but would like to use an esp8266 to make this into a tag as the size now is a bit more and the buzzer is already very small as I got it from a mobile. This project is also made very cost-effective so that it can be applied to many things and the nodes would still remain the same so it would be very cost effective. This project uses wifi for giving probability region which a very good way earlier i thought of using rf but i damaged it then I had to think of this alternative and it turned out to be better as rf was expensive and it did not give signal strength. Excluding the form factor, the project is completely ready to be used in day to day lives and be useful for old aged people and people suffering from Alzheimer's to find their things at their fingertips.

 

ANY SUGGESTIONS AND IMPROVEMENTS ARE WELCOMED BELOW IN COMMENTS

 

IMAGES