Arun Suthar
Published

Safety belt for sewage cleaners

The project is to provide a wearable monitoring system for sewage workers to monitor them while working in the sewage.

IntermediateWork in progressOver 1 day426
Safety belt for sewage cleaners

Things used in this project

Hardware components

Wemos D1 Mini
Espressif Wemos D1 Mini
×1
Gravity: Analog CO/Combustible Gas Sensor (MQ9) For Arduino
DFRobot Gravity: Analog CO/Combustible Gas Sensor (MQ9) For Arduino
×1
max30102-pulse-oximeter-heart-rate-upgraded-sensor-module
×1
LED (generic)
LED (generic)
×2
Buzzer
Buzzer
×1
universal PCB
×1
Male-Header 36 Position 1 Row- Long (0.1")
Male-Header 36 Position 1 Row- Long (0.1")
×1
Female Header 8 Position 1 Row (0.1")
Female Header 8 Position 1 Row (0.1")
×2
Battery, 3.7 V
Battery, 3.7 V
if you want to add an internal power supply
×1
PL01
XinaBox PL01
charging of lipo battery
×1

Software apps and online services

Arduino IDE
Arduino IDE
Autodesk EAGLE
Autodesk EAGLE
Blynk
Blynk
AWS IoT
Amazon Web Services AWS IoT

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free

Story

Read more

Custom parts and enclosures

PCB degine

Schematics

Schematics for "Safety belt for sewage cleaners" project

flow chat

Code

project code

Arduino
please find the library on GitHub
//Arun Suthar project
//Safety belt for sewage cleaners
#include <Wire.h>
#include "MAX30105.h"
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include "heartRate.h"

MAX30105 particleSensor;

const char* ssid = "edmi 4";
const char* password = "12345678";

ESP8266WebServer server(80);

String page = "";
double beatAvg;
double gas_analog;
const byte RATE_SIZE = 6; 
byte rates[RATE_SIZE]; //Array of heart rates
byte rateSpot = 0;
long lastBeat = 0; //Time at which the last beat occurred

float beatsPerMinute;
float sensor_volt;
float RS_gas;
float ratio;
float R0 = 0.24;

void setup()
{
  Serial.begin(115200);
  Serial.println("Initializing...");

  pinMode(A0, INPUT);
  pinMode(D0, OUTPUT);
  pinMode(D5, OUTPUT);

  delay(1000);
  WiFi.begin(ssid, password); //begin WiFi connection
  Serial.println("");

  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());


  // Initialize sensor
  if (!particleSensor.begin(Wire, I2C_SPEED_FAST)) //Use default I2C port, 400kHz speed
  {
    Serial.println("MAX30105 was not found. Please check wiring/power. ");
    while (1);
  }
  Serial.println("Place your index finger on the sensor with steady pressure.");

  particleSensor.setup(); //Configure sensor with default settings
  particleSensor.setPulseAmplitudeRed(0x0A); //Turn Red LED to low to indicate sensor is running
  particleSensor.setPulseAmplitudeGreen(0); //Turn off Green LED


  server.on("/", []() {
    page = "<B><h1>Sensor  Web Server</h1></B><h3>heart bits:</h3> <h4>" + String(beatAvg) + "</h4> <h6> ratio of RS/RO:</h6> <h8>" + String(ratio) + "</h8>";
    server.send(200, "text/html", page);
  });

  server.begin();
  Serial.println("Web server started!");
}

void loop()
{
  long irValue = particleSensor.getIR();
  int sensorValue = analogRead(A0);
  sensor_volt = ((float)sensorValue / 1024) * 5.0;
  RS_gas = (5.0 - sensor_volt) / sensor_volt; // Depend on RL on yor module
  ratio = RS_gas / R0; // ratio = RS/R0

  if (checkForBeat(irValue) == true)
  {
    //We sensed a beat!
    long delta = millis() - lastBeat;
    lastBeat = millis();

    beatsPerMinute = 60 / (delta / 1000.0);

    if (beatsPerMinute < 255 && beatsPerMinute > 20)
    {
      rates[rateSpot++] = (byte)beatsPerMinute; //Store this reading in the array
      rateSpot %= RATE_SIZE; //Wrap variable

      //Take average of readings
      beatAvg = 0;
      for (byte x = 0 ; x < RATE_SIZE ; x++)
        beatAvg += rates[x];
      beatAvg /= RATE_SIZE;
    }
  }
  Serial.print(", Avg BPM=");
  Serial.print(beatAvg);
  server.handleClient();
  if (beatAvg < 60 || beatAvg > 100) {
    digitalWrite(D0, 0);
    digitalWrite(D5, 1);
  }
  else if (ratio > 0.7 && ratio < 2) {
    digitalWrite(D0, 0);
    digitalWrite(D5, 1);
  }
  else {
    digitalWrite(D0, 1);
    digitalWrite(D5, 0);
  }
  if (irValue < 50000) {
    Serial.print(" No finger?");
  }
  Serial.println();
}

Credits

Arun Suthar

Arun Suthar

1 project • 2 followers
EC engineer Hardware lover
Thanks to Prof. U.R.Dave and Meet Solanki .

Comments

Add projectSign up / Login