You are on page 1of 17

Chapter 6

Project Implementation and Coding


6.1 Overview of Project Modules
Here we propose a mining tracking as well as safety system for the mining industry using
microcontroller-based circuit on the worker helmet. We use Wi-Fi based circuitry to detect
workers moving through the entire mining site. The helmet is integrated with a Wi-Fi based
tracking system which in coordination with the tracker Wi-Fi systems help provide data over
IOT. The system makes use of ESP8266 microcontroller-based Wi-Fi tracker circuitry to receive
the data transmitted by worker helmet nodes. This button when pressed shows an emergency
sign over the IOT web interface about the worker emergency. This can be used for any
emergencies like – toxic gas inhalation, cave ins, physical injury etc. Thus, the system ensures
mining worker safety using IOT.
 Measuring environment using sensor: all Sensors measures the conditions like
temperature, humidity, gas, heartbeats of worker etc. and sent to controller.

Sensors ADC Controller

 Locally display data: In this part controller convert data into standard values and
display on LCD.

Controller I2C Module Display

 Sending Data on Application: In this module data is send to an application using cloud
(Internet) or BLE.

Hardware Cloud/BLE Dashboard


6.2 Tools and Technologies Used
 Micro- Python - MicroPython is a software implementation of a programming language
largely compatible with Python 3, written in C, that is optimized to run on a
microcontroller. MicroPython is a full Python compiler and runtime that runs on the
micro-controller hardware. The user is presented with an interactive prompt (the REPL)
to execute supported commands immediately. Included are a selection of core Python
libraries; MicroPython includes modules which give the programmer access to low-level
hardware. The source code for the project is available on GitHub under the MIT License.
MicroPython was originally created by the Australian programmer and physicist Damien
George, after a successful Kickstarter backed campaign in 2013. While the original
Kickstarter campaign released MicroPython with an STM32F4-powered development
board "pyboard", MicroPython supports a number of ARM based architectures. The ports
supported in the mainline are ARM Cortex-M (many STM32 boards, TI CC3200/WiPy,
Teensy boards, Nordic nRF series, SAMD21 and SAMD51), ESP8266, ESP32, 16bit
PIC, Unix, Windows, Zephyr, and JavaScript. Also, there are many forks for a variety of
systems and hardware platforms not supported in the mainline.

 MQTT:

MQTT (Message Queuing Telemetry Transport) is a publish/subscribe messaging protocol that


works on top of the TCP/IP protocol. The first version of the protocol was developed by Andy
Stanford-Clark of IBM and Arlen Nipper of Cirrus Link in 1999. What makes MQTT faster than
say sending HTTP requests with your IoT device is MQTT messages can be as small as 2 bytes,
whereas HTTP requires headers which contains a lot of information that other devices might not
care about. Also, if you have multiple devices waiting for a request with HTTP, you'll need to
send a POST action to each client. With MQTT, when a server receives information from one
client, it will automatically distribute that information to each of the interested clients.

Why MQTT?
MQTT has unique features you can hardly find in other protocols, like:
 It’s a lightweight protocol. So, it’s easy to implement in software and fast in data
transmission.
 It’s based on a messaging technique. Of course, you know how fast your
messenger/WhatsApp message delivery is. Likewise, the MQTT protocol.
 Minimized data packets. Hence, low network usage.
 Low power usage. As a result, it saves the connected device’s battery.
 It’s real time! That’s is specifically what makes it perfect for IoT applications.

Why not HTTP


 Slower: because it uses bigger data packets to communicate with the server.
 Overhead: HTTP request opens and closes the connection at each request, while MQTT
stays online to make the channel always open between the broker “server” and clients.
 Power consuming: since it takes a longer time and more data packets, therefore it uses
much power.
 Web Technologies:
Internet of things (IoT) was experienced by everyone who has mobile phones, laptops,
wearables, washing machine, smart speaker, and electronic gadgets connected with the
Internet. Many areas that IoT will make changes, which includes Web Design and
Development. It can help us to develop the future effectively. Internet of Things is a
technology that connects the digital world by transforming the UI interactions between
the man and machine. Now IoT entered into the realm of Web Development and make
users more interactive with the websites. And create a smart & significant role in the
development world. It’s immense power of connectivity and computerized sensibility
feature to help to understand the client features and build the right strategies. IoT edge in
web development will make change the front-end interface and user interactions etc. All
users will use this front-end interface to communicate with cameras, sensors, and other
devices on the Internet.

o HTML
Hypertext Markup Language (HTML) is the standard markup language used to
create web pages. A markup language is your way of making notes in a digital
document that can be distinguished from regular text. It’s the most basic building
block you’ll need for developing websites.
o CSS
CSS (Cascading Style Sheets) is the language used to present the document you
create with HTML. Where HTML comes first and creates the foundation for your
page, CSS comes along next and is used to create the page’s layout, color, fonts,
and…well, the style!
o JavaScript
Another MAJOR tool in your front-end developer toolbox is going to be
JavaScript (JS). Where HTML is a markup language and CSS is a style sheet
language, JS is the first language I’ve mentioned that’s a Bonafede programming
language. What’s the difference? Where HTML and CSS determine the
presentation of a page, JS determines the function.
 Arduino Ide
Arduino IDE is an open source software that is mainly used for writing and compiling the
code into the Arduino Module. It is an official Arduino software, making code
compilation too easy that even a common person with no prior technical knowledge can
get their feet wet with the learning process. It is easily available for operating systems
like MAC, Windows, Linux and runs on the Java Platform that comes with inbuilt
functions and commands that play a vital role for debugging, editing and compiling the
code in the environment. A range of Arduino modules available including Arduino Uno,
Arduino Mega, Arduino Leonardo, Arduino Micro and many more.
6.3 Project Code
Controller Code

#define BLYNK_PRINT Serial


#include<LiquidCrystal_I2C.h>
#include<Wire.h>
LiquidCrystal_I2C lcd(0x27,16,2);
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include "HX711.h"

#define DOUT D4
#define CLK D5
HX711 scale(DOUT, CLK);
float calibration_factor = -106650;
char auth[] = "j8A2dA4r5HCXN8SEfJ8GYMJdyem7779i";
char ssid[] = "robot";
char pass[] = "12345678";

BlynkTimer timer;

void myTimerEvent()
{
scale.set_scale(calibration_factor);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Weight:");
lcd.setCursor(8,0);
lcd.print(scale.get_units(), 3);
float w = (scale.get_units());
Blynk.virtualWrite(V5, w);
}

void setup()
{
lcd.init();
lcd.backlight();
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
timer.setInterval(1000L, myTimerEvent);
scale.set_scale();
scale.tare();

void loop()
{
Blynk.run();
timer.run();
}
Website Code

<!DOCTYPE HTML>
<html>
<head>
<title>Kitchen Inventory</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1,
user-scalable=no" />
</head>
<body onload="init();">

<!-- Wrapper -->


<div id="wrapper">

<!-- Main -->


<div id="main">
<div class="inner">

<!-- Header -->


<header id="header">
<a href="index.html"
class="logo"><strong>IOT BASED </strong> Safety helmet for worker <strong> BY
Sapkal College of Engineering,NASHIK</strong> </a>
<ul class="icons">
<li><a href="#" class="icon fa-
twitter"><span class="label">Twitter</span></a></li>
<li><a href="#" class="icon fa-
facebook"><span class="label">Facebook</span></a></li>
<li><a href="#" class="icon fa-
snapchat-ghost"><span class="label">Snapchat</span></a></li>
<li><a href="#" class="icon fa-
instagram"><span class="label">Instagram</span></a></li>
<li><a href="#" class="icon fa-
medium"><span class="label">Medium</span></a></li>
</ul>
</header>

<!-- Banner -->


<section id="banner">
<div class="content">
<header>
<h1>Realtime worker safety Data </h1>
<table><tr><td>Heartbeat</td><td>temperature</td><td>O2 Level </td><td>light
Intensity</td></tr>
<tr><td><p id="msg">-
%</p></td><td><p id="msg2">- %</p></td><td><p id="msg3"> - % </p></td><td><p
id="msg4">- %</p></td></tr>

</table><p>A System Developed by Computer


Branch.</p> </header>

</div>
<span class="image object">
<img src="ft.jpg" alt="" />
</span>
</section>

<!-- Section -->


<section>
<header class="major">

</header>
<div class="features">

</div>
</section>

</div>
</div>

<!-- Sidebar -->


<div id="sidebar">
<div class="inner">

<!-- Search -->


<section id="search" class="alt">
<form method="post" action="#">
<input type="text" name="query"
id="query" placeholder="Search" />
</form>
</section>

<!-- Menu -->


<nav id="menu">

<section>

<!-- Section -->


<section>
<header class="major"> </br>
<h2>Get in touch</h2>
</header>

<ul class="contact">
<li class="fa-envelope-o"><a
href="vishalmate10@gmail.com">ashwinishelke1998@gmail.com
</br>pingalepooja09@gmail.com </br>pratu.krushnali@gmail.com
</br>ghumre.priya@gmail.com </br>dpranjal03@gmail.com </br></a></li>

<li class="fa-phone">+91
9209265769</li>
<li class="fa-home">SAPKAL COLLEGE OF
ENGINEERING, NASHIK<br />
, MH </li>
</ul>
</section>

<!-- Footer -->


<footer id="footer">
<p class="copyright">&copy; All rights
reserved.</p>
</footer>

</div>
</div>

</div>

<!-- Scripts -->


<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/skel.min.js"></script>
<script src="assets/js/util.js"></script>
<!--[if lte IE 8]><script
src="assets/js/ie/respond.min.js"></script><![endif]-->
<script src="assets/js/main.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/paho-
mqtt/1.0.1/mqttws31.js" type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/paho-
mqtt/1.0.1/mqttws31.min.js" type="text/javascript"></script>

<script type="text/javascript">
//sample HTML/JS script that will publish/subscribe to topics in the
Google Chrome Console
//by Matthew Bordignon @bordignon on twitter.
var msg;
var wsbroker = "test.mosquitto.org"; //mqtt websocket enabled broker
var wsport = 8080// port for above
var client = new Paho.MQTT.Client(wsbroker, wsport,
"myclientid_" + parseInt(Math.random() * 100, 10));

client.onConnectionLost = function (responseObject) {


console.log("connection lost: " + responseObject.errorMessage);
};
client.onMessageArrived = function (message) {
console.log(message.destinationName, ' -- ', message.payloadString);
var msg=message.payloadString;
if(message.destinationName=='/health/s1'){
var tmp = message.payloadString;
document.getElementById("msg").innerHTML = tmp;
}

if(message.destinationName=='/health/s2'){
var tmp = message.payloadString;
document.getElementById("msg2").innerHTML = tmp;
}

if(message.destinationName=='/health/s3'){
var tmp = message.payloadString;
document.getElementById("msg3").innerHTML = tmp;
}

};

var options = {
timeout: 3,
onSuccess: function () {
console.log("mqtt connected");
// Connection succeeded; subscribe to our topic, you can add multile
lines of these
client.subscribe('/health/#', {qos: 1});

//use the below if you want to publish to a topic on connect


message = new Paho.MQTT.Message("851307639");
message.destinationName = "/health";
client.send(message);
},
onFailure: function (message) {
console.log("Connection failed: " + message.errorMessage);
}
};
function init() {
client.connect(options);
}

</Script>

</body>
</html>
Chapter 7
Software Testing
6.1 Types of Testing
Testing is the process of evaluating a system or its component(s) with the intent to find whether
it satisfies the specified requirements or not. Testing is executing a system in order to identify
any gaps, errors, or missing requirements in contrary to the actual requirements.

6.1.1 Manual Testing


Manual testing includes testing a software manually, i.e., without using any automated tool or
any script. In this type, the tester takes over the role of an end-user and tests the software to
identify any unexpected behavior or bug. There are different stages for manual testing such as
unit testing, integration testing, system testing, and user acceptance testing. Testers use test
plans, test cases, or test scenarios to test a software to ensure the completeness of testing. Manual
testing also includes exploratory testing, as testers explore the software to identify errors in it.

6.1.2 Automation Testing


Automation testing, which is also known as Test Automation, is when the tester writes scripts
and uses another software to test the product. This process involves automation of a manual
process. Automation Testing is used to re-run the test scenarios that were performed manually,
quickly, and repeatedly.
6.2 Methods of Software Testing
There are different methods that can be used for software testing. This chapter briefly describes
the methods available.
6.2.1 Black-Box Testing
The technique of testing without having any knowledge of the interior workings of the
application is called black-box testing. The tester is oblivious to the system architecture and does
not have access to the source code. Typically, while performing a black-box test, a tester will
interact with the system's user interface by providing inputs and examining outputs without
knowing how and where the inputs are worked upon.

6.2.2 White-Box Testing


White-box testing is the detailed investigation of internal logic and structure of the code. White-
box testing is also called glass testing or open-box testing. In order to perform white box testing
on an application, a tester needs to know the internal workings of the code. The tester needs to
have a look inside the source code and find out which unit/chunk of the code is behaving
inappropriately.

6.2.3 Grey-Box Testing


Grey-box testing is a technique to test the application with having a limited knowledge of the
internal workings of an application. In software testing, the phrase the more you know, the better
carries a lot of weight while testing an application.

Mastering the domain of a system always gives the tester an edge over someone with limited
domain knowledge. Unlike black-box testing, where the tester only tests the application's user
interface; in grey-box testing, the tester has access to design documents and the database. Having
this knowledge, a tester can prepare better test data and test scenarios while making a test plan.
6.3 Test Cases
6.3.1 Test Cases for Hardware
Sr. Component / module Expected Result Actual Result Status
No.
1. Sensors Sensor should read the Sensor display value Pass
parameters accurately with 5% accuracy
2. Siren When any incident Siren works as per Pass
occurs Siren should requirements
start
3. Notification LEDs When any incident LED works as per Pass
occurs LED should requirements
blink
5. Notifications Notification should Sending Notification Pass
send on application accurately
Sr. Component / module Expected Result Actual Result Status
No.

6.3.2 Test Cases for Software


No. Module Expected Result Actual Result Status
1. Signup After entering correct User can create an Success
details user can create account.
an account
2. Login User should login an User can login an Success
account after entering account using
username and username and
password. password.
3. Dashboard All sensor data should User can view data Success
be shown on dashboard after login.
4. Alert After any fault activity Alert section can show Success
alert section should alerts
show an alert.
5. Graph All available quantity All sensor data can be Success
data should be shown shown on dashboard in
on dashboard in the the form of graph and
form of graph and chart.
chart.
6. Logs All logs should be Log Section is Success
shown in logs section. showing all logs.
Chapter 8
Result
8.1 Outcomes and Results
Chapter 9
Conclusion
9.1 Conclusion
We have developed a smart helmet to help workers to get rid of hazardous events in mining such
as humidity and temperature condition and existence of combustible gases. Significance of each
block has been resonated out and placed carefully, thus contributing to the best working of the
unit. Heart of the system is NodeMCU which controls and monitors these events using IOT. This
system is displaying the parameters on the base station PC and alerting miner, from base station
higher authority can monitor everything and provides rescue operation for the miner. Alarm
triggers when sensor values cross the threshold level. As we are storing the values of the
parameters like temperature, humidity in the PC, the stored values can be used to detect the
hazards before the lost happens. As we are giving the information to the personnel regarding the
measures to be taken in case of a hazard, it will be useful for them to save their life before
anyone comes and help them to come out of the mine. It also provides a technique for tracking
the position of the
worker which enables the rescue team to provide immediate help in adverse conditions. Hence
the system is reliable with simple and easily available components, making it light weight.

9.2 Future enhancement


In order to confirm that the system works according to the requirements specified, it was broadly
tested. A couple of attributes of the system can be enhanced. To increase more human
interference and to enhance the signal range and signal strength an additional antenna can be
added. To allow faster sensor data processing speed can be enhanced. The infrared sensor can be
tweaked to work just inside the safety helmet by not provoking due to internal reflections.

9.3 Applications and advantages


 Improve Worker safety in landmine.
 Improve Worker safety in construction field.
 Saves time and money.
 Automatically detect danger conditions.
 No need to charge – Solar powered.

You might also like