You are on page 1of 80

A

PROJECT REPORT

ON

WIFI TALKING ROBOT

SUBMITED TO

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION

IN PARTIAL FULFILLMENT OF THE REQUIREMENTS

FOR THE AWARD OF

DIPLOMA IN COMPUTER ENGINEERING

BY

AKSHATA GONE

UNDER THE GUIDANCE OF

PROF.K.A. LOKANDE

KESP RITP Lohegaon Pune-47 Page 1


A

PROJECT REPORT

ON

WIFI TALKING ROBOT

BY

MISS. GONE AKSHATA (CO23)

MISS. JADHAV SAYALI (CO24)

MR. KHANDARE MAYUR (CO22)

MR. BARKADE SUMIT (CO27)

IN PARTIAL FULFILLMENT OF:-

DIPLOMA IN COMPUTER ENGINEERING

MSBTE

Year 2023-2024

DEPARTMENT OF COMPUTER ENGINEERING

K.E. SOCIETY’S RAJARAMBAPU INTITUTE OF TECHNOLOGY’S (POLYTECHNIC)

LOHEGAON, PUNE-411047

(2023-2024)

KESP RITP Lohegaon Pune-47 Page 2


CERTIFICATE
This is to certify that the report entitled
WIFI TALKING ROBOT

Submitted by

1. GONE AKSHATA DEEPAK

To MSBTE towards partial fulfillment of the diploma of

COMPUTER ENGINEERING

MSBTE

Has been satisfactorily completed under the guidance of

Prof.K.A.LOKANDE

During the academic year 2023-2024

Mrs.K.A.Lokande Prof. Mr.V.B. Jadhav Dr.K.H.Munde

(Project Guide) (Head of Department) (Principal)

KESP RITP Lohegaon Pune-47 Page 3


ACKNOWLEDGEMENT

It gives us great pleasure to present this report on Wifi talking robot towards partial fulfillment of
Diploma in Computer Engineering course of Maharashtra State Board of Technical Education (MSBTE).

I take this opportunity to convey my deepest gratitude to my guide Mrs.K.A.Lokande who guided me at
every juncture of need.

My special thanks to Head OF Computer Engineering Department and Principal of K.E.S. Polytechnic for
their cooperation and support.

I am also thankful to all faculties of Computer Engineering Department for their help.

KESP RITP Lohegaon Pune-47 Page 4


ABSTRACT

The WiFi Talking Robot Capstone Project aims to develop an innovative robotic system capable of natural
language interaction and communication over a WiFi network. The project integrates advancements in robotics,
artificial intelligence, and wireless communication technologies to create a versatile and user-friendly robotic
platform.

The primary objectives of the project include:

1. Natural Language Processing (NLP) Integration: Implementing state-of-the-art NLP algorithms to


enable the robot to understand and respond to human speech in real-time. This involves text-to-speech
(TTS) and speech-to-text (STT) capabilities for seamless communication.
2. WiFi Communication: Leveraging WiFi connectivity for data exchange between the robot and external
devices such as smartphones, tablets, or computers. This enables remote control, data sharing, and
access to online services.
3. User Interface Development: Creating an intuitive user interface (UI) for controlling the robot's
movements, accessing its functionalities, and engaging in meaningful conversations. The UI may
include a mobile app, web interface, or voice commands.
4. Application Scenarios: Exploring various practical applications for the WiFi Talking Robot, such as
educational purposes, assistance for elderly or disabled individuals, home automation, entertainment,
and interactive exhibits.

KESP RITP Lohegaon Pune-47 Page 5


INDEX

TOPIC DESCRIPTION PAGE NO.


NO.
Introduction: 8-9
1 1.1 Background of the industry

2 Literature survey:
2.1 Problem identification and specification 10-11

3 Proposed detail methodology of solving the identified problem: 12

Overall description: 13-15


4.1 language used in project
4 4.2 history of project
4.3 objective of project
4.4 system requirement

5 Modules 16
6 Advantages and Disadvantages 17

7 Application area 18

8 System design : 19
8.1 System architecture

9 Testing: 20-43
9.1 Types of testing
9.2 System Implementation
10 Result 43-46
11 Project scope 47
12 Future scope 48
13 References 49
13 Conclusion 50

Kasegaon Education Society’s


Rajarambapu Institute of Technology (Polytechnic)
Lohegaon, Pune

KESP RITP Lohegaon Pune-47 Page 6


(Approved by AICTE New Delhi, DTE Govt. of Maharashtra & Affiliated to MSBTE)
_______________________________________________________________________

LIST OF FIGURES

FIG DESCRIPTION PAGE NO.


NO.
FIG -1 Steganography methodology 8

FIG -2 Steganography modules 17

FIG -3 System architecture 20

FIG -4 Types of testing 22

FIG -5 Flowchart 24-25

FIG -6 Use-case diagram 26

FIG -7 Activity diagram 27

FIG -8 Class diagram 28

KESP RITP Lohegaon Pune-47 Page 7


INTRODUCTION

W
In an eraI defined by interconnected devices and smart technologies, robotics stands at the forefront of
innovation, promising transformative advancements in various domains. The WiFi Talking Robot Capstone
F
Project emerges as a testament to this technological evolution, merging the realms of robotics, artificial
intelligence (AI), and wireless communication to create a sophisticated yet accessible robotic platform.
I
The essence
T
of this project lies in the convergence of multiple disciplines, each contributing its unique
capabilities to shape the functionality and usability of the WiFi Talking Robot. At its core, this endeavor seeks
to bridgeAthe gap between humans and machines through natural language interaction, enabling seamless
communication and collaboration in diverse environments.
L
The concept
K
of a WiFi Talking Robot embodies the essence of modern robotics, characterized by mobility,
intelligence, and connectivity. By harnessing the power of WiFi networks, the robot transcends physical
I enabling remote control, data exchange, and access to online resources. This connectivity not only
limitations,
enhances the robot's capabilities but also opens doors to a myriad of applications across industries and domains.
N
At a timeGwhen human-machine interfaces are evolving rapidly, the WiFi Talking Robot project underscores the
importance of user-centric design and technological integration. Through intuitive user interfaces, advanced
R
natural language processing algorithms, and robotic mobility, the project aims to create a symbiotic relationship
between humans and robots, where interaction is seamless, engaging, and meaningful.
O
As we delve deeper into the intricacies of the WiFi Talking Robot Capstone Project, we embark on a journey
B
that epitomizes innovation, collaboration, and the relentless pursuit of pushing the boundaries of what robots
O in our interconnected world.
can achieve
T WiFi Talking Robot with Motors project is about creating a basic robot that can talk and move
The Simple
using WiFi and motors. We'll use simple technology to make the robot listen to people, talk back, and move
around. With sensors, it can avoid obstacles and stay safe. You'll control it easily with a phone app or voice
commands. This project is cool because it can teach you robotics, help with tasks at home, and just be fun to
play with. We'll work step by step, putting together the parts, programming it, and testing to make sure it works
smoothly.

BLUETOOTH KIT

KESP RITP Lohegaon Pune-47 Page 8


SPEAKER

NODE MCU
JUMPER WIRES

MOTOR DRIVER

BATTERY

DC MOTOR

FIG I. MODULES IN THE SYSTEM

KESP RITP Lohegaon Pune-47 Page 9


1. BLUETOOTH KIT

KESP RITP Lohegaon Pune-47 Page 10


Kasegaon Education Society’s
Rajarambapu Institute of Technology (Polytechnic)
Lohegaon, Pune
(Approved by AICTE New Delhi, DTE Govt. of Maharashtra & Affiliated to MSBTE)
_______________________________________________________________________

I. CAMERA(ESP32-CAM module)

The ESP32-CAM is an intriguing and versatile development board that combines several powerful
features into a compact package. Let’s delve into its components:

 ESP32-S Processor:

o The heart of the ESP32-CAM is the ESP32-S System-on-Chip (SoC) from Ai-Thinker.
o This chip boasts an impressive Tensilica Xtensa® LX6 microprocessor with two 32-bit
cores running at a staggering 240 MHz.
o Its capabilities make it suitable for intensive tasks such as video processing, facial recognition,
and even artificial intelligence.

 Memory:

o The ESP32-S has 520 kilobytes of internal RAM on the same die as other components.
o Additionally, the ESP32-CAM includes 4 MB of external PSRAM (Pseudo-Static RAM) to
expand memory capacity.
o This ample RAM is especially useful for tasks like audio or graphics processing.

 Storage:

o The ESP32-S chip contains 4 MB of on-chip flash memory, providing ample space for
programs and data.

 Camera:

KESP RITP Lohegaon Pune-47 Page 11


o The standout feature of the ESP32-CAM is its OV2640 camera sensor.
o With a resolution of 2 megapixels, it can capture images up to 1600×1200 pixels.
o This makes it ideal for video projects like video doorbells, nanny cams, and other surveillance
applications.
o The ESP32-CAM is also compatible with various other camera sensors.

 MicroSD Card Slot:

o The board includes a microSD card slot, allowing for limitless expansion.
o It’s perfect for use as a data logger or for capturing and storing images.

 Antenna Options:

o The ESP32-CAM comes with an on-board PCB trace antenna and a u.FL connector for an
external antenna.
o An Antenna Selection jumper allows you to choose between the two options.
 LEDs:

o The ESP32-CAM features a white square LED for visual feedback

KESP RITP Lohegaon Pune-47 Page 12


Kasegaon Education Society’s
Rajarambapu Institute of Technology (Polytechnic)
Lohegaon, Pune
(Approved by AICTE New Delhi, DTE Govt. of Maharashtra & Affiliated to MSBTE)

II. GSM (Sim800l)

The SIM800L GSM/GPRS module is a compact GSM modem that finds applications in various Internet
of Things (IoT) projects. Let’s delve into its features and functionality:

Purpose and Capabilities

o The SIM800L module can perform tasks similar to a regular cell phone:
 Sending SMS messages: You can use it to send and receive text messages.
 Making phone calls: It supports voice calls using an external 8Ω speaker and an electret
microphone.
 Internet connectivity via GPRS: It can connect to the Internet using GPRS (General
Packet Radio Service).
 FM radio reception: Yes, it can even tune in to FM radio broadcasts!
o The module operates on quad-band GSM/GPRS networks, which means it works globally with
any 2G SIM card.

KESP RITP Lohegaon Pune-47 Page 13


o It supports GPRS Class 10 data transfer, allowing upload and download speeds of up to 85.6
kbps.

Kasegaon Education Society’s


Rajarambapu Institute of Technology (Polytechnic)
Lohegaon, Pune
(Approved by AICTE New Delhi, DTE Govt. of Maharashtra & Affiliated to MSBTE)

Hardware Overview:

o The heart of the module is the SIM800L GSM cellular chip from Simcom.

o Data pins (including UART communication) are accessible via 0.1″ pitch headers.
o Operating voltage: 3.4V to 4.4V, making it suitable for direct LiPo battery supply
o External antenna required: The module comes with a helical antenna that can be soldered
directly to the PCB.
o SIM socket on the back accepts any 2G Micro SIM card.
o LED status indicators provide information about network connectivity:

 Blink every 1s: Chip running but not connected to the cellular network yet.
 Blink every 2s: Active GPRS data connection.
 Blink every 3s: Module connected to the cellular network for voice and SMS
communication.

Integration with Microcontrollers:

o The SIM800L can be connected to a microcontroller (such as an Arduino) using the serial
UART interface.
o Baud rates range from 1200 bps to 115200 bps, with automatic baud rate detection.
o The module communicates with the Internet via an integrated TCP/IP stack.

Choosing an Antenna:

o The SIM800L requires an external antenna for network connectivity.


o Two options:
 Helical antenna: Comes with the module and can be soldered directly to the PCB.
 U.FL connector: Allows you to keep the antenna at a distance from the board.

KESP RITP Lohegaon Pune-47 Page 14


Kasegaon Education Society’s
Rajarambapu Institute of Technology (Polytechnic)
Lohegaon, Pune
(Approved by AICTE New Delhi, DTE Govt. of Maharashtra & Affiliated to MSBTE)

IV .ARDUINO NANO

The Arduino Nano is a compact and versatile microcontroller board based on the ATmega328P
microcontroller chip. It is part of the Arduino family of boards known for their ease of use and wide range
of applications in electronics and programming projects. The Nano is designed for small-scale projects that
require a low-cost, space-efficient solution with a good balance of performance and features.

Key features of the Arduino Nano include:

1. ATmega328P Microcontroller:

 The ATmega328P is an 8-bit microcontroller with a clock speed of 16 MHz, providing enough
processing power for a wide range of projects.

 It has 32KB of flash memory, which is where your Arduino sketches (programs) are stored.

KESP RITP Lohegaon Pune-47 Page 15


 The 2KB of SRAM (Static Random Access Memory) is used for variables and runtime data
storage during program execution.

2. USB Connectivity:

 The Nano has a mini USB port for connecting to a computer. This port is used for programming
the board and powering it.

 It uses the CH340G USB-to-serial chip for communication with the computer, enabling easy
uploading of sketches.

3. Compact Size and Pinout:

 The Nano's small size makes it suitable for embedding into projects where space is limited

Kasegaon Education Society’s


Rajarambapu Institute of Technology (Polytechnic)
Lohegaon, Pune
(Approved by AICTE New Delhi, DTE Govt. of Maharashtra & Affiliated to MSBTE)
.

 It has a total of 30 pins, including 14 digital I/O pins, 8 analog input pins, and additional pins for
power and communication.

 The pinout is compatible with standard breadboards and shields, making it easy to prototype and
expand functionality.

4. Voltage Regulator and Power Options:

 The Nano can be powered via the USB connection or an external power supply (7-12V DC).

 It includes a 5V voltage regulator, ensuring stable power supply to the board and connected
components.

5. Integrated Components:

 The board features a built-in LED connected to digital pin 13, often used for basic testing and
debugging.

 A reset button allows you to restart the program execution or re-upload sketches.

6. Programming and IDE:

 Arduino Nano is programmed using the Arduino IDE (Integrated Development Environment),
which provides a user-friendly interface for writing, compiling, and uploading sketches.

 The IDE supports a simplified version of C/C++ programming language, making it accessible to
beginners while offering advanced features for experienced developers.

7. Applications:
KESP RITP Lohegaon Pune-47 Page 16
 The Nano is widely used in robotics projects, home automation, IoT (Internet of Things) devices,
sensor interfacing, data logging, and educational purposes.

 Its versatility, affordability, and ease of use make it a popular choice for hobbyists, students, and
professionals alike.

Overall, the Arduino Nano is a powerful yet compact microcontroller board that enables users to bring their
electronic projects to life with ease. Its rich feature set and broad community support make it an excellent
platform for learning and innovation in the field of embedded systems and electronics.

Kasegaon Education Society’s


Rajarambapu Institute of Technology (Polytechnic)
Lohegaon, Pune
(Approved by AICTE New Delhi, DTE Govt. of Maharashtra & Affiliated to MSBTE)

KESP RITP Lohegaon Pune-47 Page 17


Kasegaon Education Society’s
Rajarambapu Institute of Technology (Polytechnic)
Lohegaon, Pune
(Approved by AICTE New Delhi, DTE Govt. of Maharashtra & Affiliated to MSBTE)

Here's a brief explanation of the pins:

KESP RITP Lohegaon Pune-47 Page 18


 D0 to D13: These are digital I/O pins that can be used for input or output operations.

 A0 to A6: These are analog input pins for reading analog voltage levels (0 to 5V).

 AREF: Analog Reference pin for setting the analog reference voltage.

 VIN: Input voltage to the Nano (typically 7-12V when using an external power supply).

 5V: Output of the 5V voltage regulator, used to power external components.

 3.3V: Output of the 3.3V voltage regulator, used for low-power devices.

 GND: Ground pins for completing electrical circuits.

 RX0, TX0, RX1, TX1: Serial communication pins (RX0 and TX0 are also used for programming and
debugging)

Kasegaon Education Society’s


Rajarambapu Institute of Technology (Polytechnic)
Lohegaon, Pune
(Approved by AICTE New Delhi, DTE Govt. of Maharashtra & Affiliated to MSBTE)

Pin Pin Name Details


Category

KESP RITP Lohegaon Pune-47 Page 19


Power Vin, 3.3V, 5V, GND Vin: Input voltage to Arduino when using an external power
source (6-12V).
5V: Regulated power supply used to power microcontroller and
other components on the board.
3.3V: 3.3V supply generated by on-board voltage regulator.
Maximum current draw is 50mA.
GND: Ground pins

Reset Reset Resets the microcontroller.

Analog Pins A0 – A7 Used to measure analog voltage in the range of 0-5V

Input/Output Digital Pins D0 - D13 Can be used as input or output pins. 0V (low) and 5V (high)
Pins

Serial Rx, Tx Used to receive and transmit TTL serial data.

External 2, 3 To trigger an interrupt.


Interrupts

PWM 3, 5, 6, 9, 11 Provides 8-bit PWM output.

SPI 10 (SS), 11 (MOSI), 12 Used for SPI communication.


(MISO) and 13 (SCK)

Inbuilt LED 13 To turn on the inbuilt LED.

IIC A4 (SDA), A5 (SCA) Used for TWI communication.

AREF AREF To provide a reference voltage for input voltage.

Kasegaon Education Society’s


Rajarambapu Institute of Technology (Polytechnic)
Lohegaon, Pune
(Approved by AICTE New Delhi, DTE Govt. of Maharashtra & Affiliated to MSBTE)

PROPOSED SYSTEM
KESP RITP Lohegaon Pune-47 Page 20
The proposed system is to design a portable device which resembles a normal jacket. It consists of WIFI
microcontroller, WIFI/GPS modules, GSM modules,Shock circuit modules and Push buttons. The prototype
includes two independent system controlled using switch. When switch is pressed the device will get activated,
immediately the location of the victim will be tracked with the help of GPS and emergency message along with
latitude and longitude value will be sent to stored contacts every one minute with updated location... When
second switch is pressed coordinates which can be used to find exact location using GOOGLE MAPS. The
circuit consists of two switches which functions differently to give different output and activate the circuit. The
circuits include GPS, GSM, Shock circuit . The GPS module is connected to the RX pin of the microcontroller
through its TX pin and sends the location via the GSM module .The GSM module which is connected to the TX
pin of the microcontroller through its RX pin.. When switch one is pressed all these feature i.e. location , LED
modules and the buzzer start working simultaneously, and when switch two is pressed only the location is send
to the emergency contacts.

Result: In this system Push button is pressed GSM and GPS should ON. After pressing second push
button camera must ON and send the streaming to authorized person. GPS module must send live
location to authority

Kasegaon Education Society’s


Rajarambapu Institute of Technology (Polytechnic)
Lohegaon, Pune
(Approved by AICTE New Delhi, DTE Govt. of Maharashtra & Affiliated to MSBTE)

LITERATURE SURVEY

KESP RITP Lohegaon Pune-47 Page 21


Electronic jacket for women safety: Women safety application using android mobile. In this
paper system can show exact location to relatives, parents, friends and track every time interval.
[1] Emergency panic button using microcontroller. In this paper panic button is used for
protection while emergency situation occurs.
[2] AVR microcontroller based wearable jacket for women safety In this paper unified
combination of wearable jacket and mobile technology for safety of women in the society. This
system helps to alert family members and people closest to the victim by using buzzer, GPS,
GSM module.
[3] All in one intelligent safety system for women security in this paper the authors have
reviewed of various existing systems on women security.

FLOW CHARTS

KESP RITP Lohegaon Pune-47 Page 22


FIG.

Kasegaon Education Society’s


Rajarambapu Institute of Technology (Polytechnic)
Lohegaon, Pune
(Approved by AICTE New Delhi, DTE Govt. of Maharashtra & Affiliated to MSBTE)

KESP RITP Lohegaon Pune-47 Page 23


FIG.

Kasegaon Education Society’s


Rajarambapu Institute of Technology (Polytechnic)
Lohegaon, Pune
(Approved by AICTE New Delhi, DTE Govt. of Maharashtra & Affiliated to MSBTE)

KESP RITP Lohegaon Pune-47 Page 24


SOURCE CODE:
CAMERA :-

#include "esp_camera.h"
#include <WiFi.h>
#include "esp_timer.h"
#include "img_converters.h"
#include "Arduino.h"
#include "fb_gfx.h"
#include "soc/soc.h" //disable brownout problems
#include "soc/rtc_cntl_reg.h" //disable brownout problems
#include "esp_http_server.h"
//Replace with your network credentials
const char* ssid = "RIT";
const char* password = "1234567890";
#define PART_BOUNDARY "123456789000000000000987654321"
// This project was tested with the AI Thinker Model, M5STACK PSRAM Model and M5STACK WITHOUT
PSRAM
#define CAMERA_MODEL_AI_THINKER
//#define CAMERA_MODEL_M5STACK_PSRAM
//#define CAMERA_MODEL_M5STACK_WITHOUT_PSRAM
// Not tested with this model
//#define CAMERA_MODEL_WROVER_KIT
#if defined(CAMERA_MODEL_WROVER_KIT)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM -1
Kasegaon Education Society’s
Rajarambapu Institute of Technology (Polytechnic)
Lohegaon, Pune
(Approved by AICTE New Delhi, DTE Govt. of Maharashtra & Affiliated to MSBTE)

KESP RITP Lohegaon Pune-47 Page 25


#define XCLK_GPIO_NUM 21
#define SIOD_GPIO_NUM 26
#define SIOC_GPIO_NUM 27
#define Y9_GPIO_NUM 35
#define Y8_GPIO_NUM 34
#define Y7_GPIO_NUM 39
#define Y6_GPIO_NUM 36
#define Y5_GPIO_NUM 19
#define Y4_GPIO_NUM 18
#define Y3_GPIO_NUM 5
#define Y2_GPIO_NUM 4
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 23
#define PCLK_GPIO_NUM 22
#elif defined(CAMERA_MODEL_M5STACK_PSRAM)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM 15
#define XCLK_GPIO_NUM 27
#define SIOD_GPIO_NUM 25
#define SIOC_GPIO_NUM 23
#define Y9_GPIO_NUM 19
#define Y8_GPIO_NUM 36
#define Y7_GPIO_NUM 18
#define Y6_GPIO_NUM 39
#define Y5_GPIO_NUM 5
Kasegaon Education Society’s
Rajarambapu Institute of Technology (Polytechnic)
Lohegaon, Pune
(Approved by AICTE New Delhi, DTE Govt. of Maharashtra & Affiliated to MSBTE)

KESP RITP Lohegaon Pune-47 Page 26


#define Y4_GPIO_NUM 34
#define Y3_GPIO_NUM 35
#define Y2_GPIO_NUM 32
#define VSYNC_GPIO_NUM 22
#define HREF_GPIO_NUM 26
#define PCLK_GPIO_NUM 21
#elif defined(CAMERA_MODEL_M5STACK_WITHOUT_PSRAM)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM 15
#define XCLK_GPIO_NUM 27
#define SIOD_GPIO_NUM 25
#define SIOC_GPIO_NUM 23
#define Y9_GPIO_NUM 19
#define Y8_GPIO_NUM 36
#define Y7_GPIO_NUM 18
#define Y6_GPIO_NUM 39
#define Y5_GPIO_NUM 5
#define Y4_GPIO_NUM 34
#define Y3_GPIO_NUM 35
#define Y2_GPIO_NUM 17
#define VSYNC_GPIO_NUM 22
#define HREF_GPIO_NUM 26
#define PCLK_GPIO_NUM 21
#elif defined(CAMERA_MODEL_AI_THINKER)
#define PWDN_GPIO_NUM 32
Kasegaon Education Society’s
Rajarambapu Institute of Technology (Polytechnic)
Lohegaon, Pune
(Approved by AICTE New Delhi, DTE Govt. of Maharashtra & Affiliated to MSBTE)

KESP RITP Lohegaon Pune-47 Page 27


#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 0
#define SIOD_GPIO_NUM 26
#define SIOC_GPIO_NUM 27
#define Y9_GPIO_NUM 35
#define Y8_GPIO_NUM 34
#define Y7_GPIO_NUM 39
#define Y6_GPIO_NUM 36

#define Y5_GPIO_NUM 21
#define Y4_GPIO_NUM 19
#define Y3_GPIO_NUM 18
#define Y2_GPIO_NUM 5
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 23
#define PCLK_GPIO_NUM 22
#else
#error "Camera model not selected"
#endif
static const char* _STREAM_CONTENT_TYPE = "multipart/x-mixed-replace;boundary="
PART_BOUNDARY;
static const char* _STREAM_BOUNDARY = "\r\n--" PART_BOUNDARY "\r\n";
static const char* _STREAM_PART = "Content-Type: image/jpeg\r\nContent-Length: %u\r\n\r\n";
httpd_handle_t stream_httpd = NULL;
static esp_err_t stream_handler(httpd_req_t *req){

Kasegaon Education Society’s


Rajarambapu Institute of Technology (Polytechnic)
Lohegaon, Pune
(Approved by AICTE New Delhi, DTE Govt. of Maharashtra & Affiliated to MSBTE)

KESP RITP Lohegaon Pune-47 Page 28


camera_fb_t * fb = NULL;
esp_err_t res = ESP_OK;
size_t _jpg_buf_len = 0;
uint8_t * _jpg_buf = NULL;
char * part_buf[64];
res = httpd_resp_set_type(req, _STREAM_CONTENT_TYPE);
if(res != ESP_OK){
return res;
}
while(true){
fb = esp_camera_fb_get();
if (!fb) {
Serial.println("Camera capture failed");
res = ESP_FAIL;
} else {
if(fb->width > 400){
if(fb->format != PIXFORMAT_JPEG){
bool jpeg_converted = frame2jpg(fb, 80, &_jpg_buf, &_jpg_buf_len);
esp_camera_fb_return(fb);
fb = NULL;
if(!jpeg_converted){
Serial.println("JPEG compression failed");
res = ESP_FAIL;
}
} else {
Kasegaon Education Society’s
Rajarambapu Institute of Technology (Polytechnic)
Lohegaon, Pune
(Approved by AICTE New Delhi, DTE Govt. of Maharashtra & Affiliated to MSBTE)

KESP RITP Lohegaon Pune-47 Page 29


_jpg_buf_len = fb->len;
_jpg_buf = fb->buf;
}
}
}
if(res == ESP_OK){
size_t hlen = snprintf((char *)part_buf, 64, _STREAM_PART, _jpg_buf_len);
res = httpd_resp_send_chunk(req, (const char *)part_buf, hlen);
}
if(res == ESP_OK){
res = httpd_resp_send_chunk(req, (const char *)_jpg_buf, _jpg_buf_len);
}
if(res == ESP_OK){
res = httpd_resp_send_chunk(req, _STREAM_BOUNDARY, strlen(_STREAM_BOUNDARY));
}
if(fb){
esp_camera_fb_return(fb);

fb = NULL;
_jpg_buf = NULL;
} else if(_jpg_buf){
free(_jpg_buf);
_jpg_buf = NULL;
}
if(res != ESP_OK){
Kasegaon Education Society’s
Rajarambapu Institute of Technology (Polytechnic)
Lohegaon, Pune
(Approved by AICTE New Delhi, DTE Govt. of Maharashtra & Affiliated to MSBTE)

KESP RITP Lohegaon Pune-47 Page 30


break;

}
//Serial.printf("MJPG: %uB\n",(uint32_t)(_jpg_buf_len));
}
return res;
}
void startCameraServer(){
httpd_config_t config = HTTPD_DEFAULT_CONFIG();
config.server_port = 80;
httpd_uri_t index_uri = {
.uri = "/",
.method = HTTP_GET,
.handler = stream_handler,
.user_ctx = NULL
};
//Serial.printf("Starting web server on port: '%d'\n", config.server_port);
if (httpd_start(&stream_httpd, &config) == ESP_OK) {
httpd_register_uri_handler(stream_httpd, &index_uri);
}}
void setup() {
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); //disable brownout detector
Serial.begin(115200);
Serial.setDebugOutput(false);
camera_config_t config;
Kasegaon Education Society’s
Rajarambapu Institute of Technology (Polytechnic)
Lohegaon, Pune
(Approved by AICTE New Delhi, DTE Govt. of Maharashtra & Affiliated to MSBTE)

KESP RITP Lohegaon Pune-47 Page 31


config.ledc_channel = LEDC_CHANNEL_0;
config.ledc_timer = LEDC_TIMER_0;
config.pin_d0 = Y2_GPIO_NUM;
config.pin_d1 = Y3_GPIO_NUM;
config.pin_d2 = Y4_GPIO_NUM;
config.pin_d3 = Y5_GPIO_NUM;
config.pin_d4 = Y6_GPIO_NUM;
config.pin_d5 = Y7_GPIO_NUM;
config.pin_d6 = Y8_GPIO_NUM;
config.pin_d7 = Y9_GPIO_NUM;
config.pin_xclk = XCLK_GPIO_NUM;
config.pin_pclk = PCLK_GPIO_NUM;
config.pin_vsync = VSYNC_GPIO_NUM;
config.pin_href = HREF_GPIO_NUM;
config.pin_sscb_sda = SIOD_GPIO_NUM;
config.pin_sscb_scl = SIOC_GPIO_NUM;
config.pin_pwdn = PWDN_GPIO_NUM;
config.pin_reset = RESET_GPIO_NUM;
config.xclk_freq_hz = 20000000;
config.pixel_format = PIXFORMAT_JPEG;
if(psramFound()){
config.frame_size = FRAMESIZE_UXGA;
config.jpeg_quality = 10;
config.fb_count = 2;
} else {
Kasegaon Education Society’s
Rajarambapu Institute of Technology (Polytechnic)
Lohegaon, Pune
(Approved by AICTE New Delhi, DTE Govt. of Maharashtra & Affiliated to MSBTE)

KESP RITP Lohegaon Pune-47 Page 32


config.frame_size = FRAMESIZE_SVGA;
config.jpeg_quality = 12;
config.fb_count = 1;
}
// Camera init
esp_err_t err = esp_camera_init(&config);
if (err != ESP_OK) {
Serial.printf("Camera init failed with error 0x%x", err);
return;
}
// Wi-Fi connection
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.print("Camera Stream Ready! Go to: http://");
Serial.print(WiFi.localIP());
// Start streaming web server
startCameraServer();
}void loop() {
delay(1);
}
Kasegaon Education Society’s
Rajarambapu Institute of Technology (Polytechnic)
Lohegaon, Pune
(Approved by AICTE New Delhi, DTE Govt. of Maharashtra & Affiliated to MSBTE)

KESP RITP Lohegaon Pune-47 Page 33


GPS:
#include <TinyGPS++.h> // library for GPS module
#include <SoftwareSerial.h>
TinyGPSPlus gps; // The TinyGPS++ object
SoftwareSerial ss(2, 3); //rx,tx
float latitude , longitude;
String lat_str , lng_str;
void setup()
{
Serial.begin(9600);
ss.begin(9600);
}
void loop()
{
while (ss.available() > 0) //while data is available
if (gps.encode(ss.read())) //read gps data
{
if (gps.location.isValid()) //check whether gps location is valid
{
latitude = gps.location.lat();
Serial.print("Lat=");
lat_str = String(latitude , 6); // latitude location is stored in a string
Serial.println(lat_str);
longitude = gps.location.lng();
lng_str = String(longitude , 6); //longitude location is stored in a string
Kasegaon Education Society’s
Rajarambapu Institute of Technology (Polytechnic)
Lohegaon, Pune
(Approved by AICTE New Delhi, DTE Govt. of Maharashtra & Affiliated to MSBTE)

KESP RITP Lohegaon Pune-47 Page 34


Serial.print("Lan=");
Serial.println(lng_str);
}
}

Kasegaon Education Society’s


Rajarambapu Institute of Technology (Polytechnic)
Lohegaon, Pune
(Approved by AICTE New Delhi, DTE Govt. of Maharashtra & Affiliated to MSBTE)

KESP RITP Lohegaon Pune-47 Page 35


GSM

#include<SoftwareSerial.h>

SoftwareSerial GSM(2,3);

void setup()

//Begin nodemcu serial-0 channel

Serial.begin(9600);

GSM.begin(9600);

pinMode(A0,INPUT_PULLUP);

}void loop()

int a=digitalRead(A0);

if(a==0)

Serial.println("Sending SMS");

GSM.print("AT"); //Start Configuring GSM Module

delay(1000); //One second delay

GSM.println();

GSM.println("AT+CMGF=1"); // Set GSM in text mode

delay(1000); // One second delay

GSM.println();

GSM.print("AT+CMGS="); // Enter the receiver number

GSM.print("\"+919890390840\"");

Kasegaon Education Society’s


Rajarambapu Institute of Technology (Polytechnic)
Lohegaon, Pune
(Approved by AICTE New Delhi, DTE Govt. of Maharashtra & Affiliated to MSBTE)

KESP RITP Lohegaon Pune-47 Page 36


GSM.println();

delay(1000);

GSM.print("Im in danger heres my coordinates: 18.6130478, 73.9424217"); // SMS body - Sms


Text//18.675230863196386, 73.8923327094054//

delay(1000);

GSM.println();

GSM.write(26); //CTRL+Z Command to send text and end session

delay(3000);

GSM.print("AT"); //Start Configuring GSM Module

delay(1000); //One second delay

GSM.println();

GSM.println("AT+CMGF=1"); // Set GSM in text mode

delay(1000); // One second delay

GSM.println();

GSM.print("AT+CMGS="); // Enter the receiver number

GSM.print("\"+919370641004\"");

GSM.println();

delay(1000);

GSM.print("Im in danger heres my coordinates: 18.6130478, 73.9424217"); // SMS body - Sms


Text//18.675230863196386, 73.8923327094054//

delay(1000);

GSM.println();

GSM.write(26);

delay(3000);

Kasegaon Education Society’s


Rajarambapu Institute of Technology (Polytechnic)
Lohegaon, Pune
(Approved by AICTE New Delhi, DTE Govt. of Maharashtra & Affiliated to MSBTE)

KESP RITP Lohegaon Pune-47 Page 37


GSM.print("AT"); //Start Configuring GSM Module

delay(1000); //One second delay

GSM.println();

GSM.println("AT+CMGF=1"); // Set GSM in text mode

delay(1000); // One second delay

GSM.println();

GSM.print("AT+CMGS="); // Enter the receiver number

GSM.print("\"+917068877575\"");

GSM.println();

delay(1000);

GSM.print("My life is in danger heres my coordinates: 18.6130478, 73.9424217"); // SMS body - Sms
Text//18.675230863196386, 73.8923327094054//

delay(1000);

GSM.println();

GSM.write(26);

delay(3000);

GSM.print("AT"); //Start Configuring GSM Module

delay(1000); //One second delay

GSM.println();

GSM.println("AT+CMGF=1"); // Set GSM in text mode

delay(1000); // One second delay

GSM.println();

GSM.print("AT+CMGS="); // Enter the receiver number

Kasegaon Education Society’s


Rajarambapu Institute of Technology (Polytechnic)
Lohegaon, Pune
(Approved by AICTE New Delhi, DTE Govt. of Maharashtra & Affiliated to MSBTE)

KESP RITP Lohegaon Pune-47 Page 38


GSM.print("\"+918788390551\"");

GSM.println();

delay(1000);

GSM.print("Im in danger heres my coordinates: 18.6130478, 73.9424217"); // SMS body - Sms


Text//18.675230863196386, 73.8923327094054//

delay(1000);

GSM.println();

GSM.write(26);

Serial.println("SMS Sent");

} //Just send the text ones and halt

Kasegaon Education Society’s


Rajarambapu Institute of Technology (Polytechnic)
Lohegaon, Pune
(Approved by AICTE New Delhi, DTE Govt. of Maharashtra & Affiliated to MSBTE)

KESP RITP Lohegaon Pune-47 Page 39


IMPLEMENTATION
PCB

FIG.

FIG.PROCESS OF CLEANING PCB


Kasegaon Education Society’s
Rajarambapu Institute of Technology (Polytechnic)
Lohegaon, Pune
(Approved by AICTE New Delhi, DTE Govt. of Maharashtra & Affiliated to MSBTE)

KESP RITP Lohegaon Pune-47 Page 40


FIG. UPLOADING SOURCE CODE OF LIVE STREAMING IN ARDUINO NANO

FIG.ASSEMBLED MODULES

KESP RITP Lohegaon Pune-47 Page 41


Proposed work:
We can test our develop project between two computers one as a sender and one as a receiver.

O We are going to provide security by using digital steganography.

Literature survey:
Digital watermarking
The information to be embedded in a signal is called a digital watermark, Digital watermarking is the method of
embedding data into digital multimedia content. This is used to verify the credibility of the content or to
recognize the identity of the digital content's owner.

There are two types of digital watermarking: Visible Digital Watermarking, Invisible Digital Watermarking.
It is the act of hiding a message related to a digital signal within the signal itself. It is a concept closely related
to steganography, in that they both hide a message inside a digital signal.

Network steganography
Network steganography is an ever-growing research topic as the idea of hiding information attracts many
researchers. It is a rapidly evolving topic with suggestions and proposals how one can exploit
a network protocol to enable a secret communication, and how it can be detected and prevented. It discusses
techniques that encode hidden information in the timing of protocol messages, also referred to as timing covert
channels. Timing channels are always noisy because of the timing inaccuracies at the covert sender and
receiver. The intentional retransmissions caused by RSTEG should be kept at a reasonable level to avoid
detection.

Printed steganography
Steganography methods are proposed for the authentication of the holder's photo in an ICAO-consistent (travel)
document. The embedded message is heavily influenced by the print-scan process, as the electronic image is
first printed to be included into the document (or identity card) and is scanned next to constitute the reference
template in an automatic face verification procedure. Two sufficiently robust steganography methods are
KESP RITP Lohegaon Pune-47 Page 42
designed, modifications of the “Fujitsu method” and the “triangle net” method. Test results demonstrate the
feasibility in biometric verification and high authentication quality of proposed approach.

Text steganography
This technique is considered as most difficult steganography technique. In this data is compression is encodes
one representation into another. So it is difficult to decrypt it. Text steganography is a sub part
of steganography that hides the message behind other cover text file. Moreover, hiding the text behind HTML
coding of web pages makes the detection of steganography impractical as web pages are a fundamental
building blocks of the internet. Steganography can be classified into image, text, audio and video steganography
depending on the cover media used to embed secret data.

We are proposing digital steganography by including the new features.

We can test our develop project between two computers one as a sender and one as a receiver.

We are going to provide security by using digital steganography.

Our project, DIGITAL STEGANOGRAPHY solution for transmitting secret formation without affecting
unintended users. Steganography uses multimedia data as a covering medium (Covering secret information). By
using steganography data (secret information) can hided with in data (multimedia data, here multimedia data is
an image) and it can be sent anywhere to transfer the message easily without giving any suspicion to others.

Digital Steganography Project is a java based software application designed to send secured information
without effecting any users. In this project we will use multimedia as covering medium. Modules are explained
below.In this project there are two modules, namely

“Making stegano Medium” and “Getting secret information from stegano medium”

Steganography is the art of hiding the fact that communication is taking place, by hiding information in other
information. Many different carrier file formats can be used, but digital images are the most popular because of
their frequency on the internet. For hiding secret information in images, there exists a large variety of
steganography techniques some are more complex than others and all of them have respective strong and weak
points.

Different applications may require absolute invisibility of the secret information, while others require a large
secret message to be hidden. This project report intends to give an overview of image steganography, its uses
and techniques. It also attempts to identify the requirements of a good steganography algorithm and briefly
reflects on which steganography techniques are more suitable for which applications.

Steganography is the practice of hiding private or sensitive information within something that appears to be
nothing out to the usual. Steganography is often confused with cryptology because the two are similar in the
way that they both are used to protect important information. The difference between two is that steganography
involves hiding information so it appears that no information is hidden at all.

KESP RITP Lohegaon Pune-47 Page 43


Proposed detailed methodology of solving the identifying problem:
We are proposing digital steganography by including the new features.

We can test our develop project between two computers one as a sender and one as a receiver.

Overall description:
KESP RITP Lohegaon Pune-47 Page 44
Language used in project:
In our project advanced java language is used.

History of project:
Stegoanalysis Attacking techniques for steganography were also developed. When compared to
cryptanalysis, stegoanalysis is a more challenging task for the analyst, because ciphertext can
easily be identified by looking at it. Whereas a message hidden in an image cannot be
determined or even look suspicious to the eye of the analyst. There are three attacks possible
which are considered as steganalysis: Visual attack, Structural attack and Statistical attack . The
simplest form of steganalysis is visual attack, in which the analyst’s attack is by observing
subjected file with naked eyes. The first rule of good steganography is to keep the stego-image
unchanged. Despite of that, removing some parts of the images that were not altered and just
focus on the altered parts make the visual attack a successful one. Therefore the main idea of
this attack is to identify which parts of the stego-image are to be considered. The study of image
says that, in an image, the bits with value 1 are almost equal to bits with value That is there are
approximately equal number of 0’s and 1’s in an image. Embedding of some plain data will
disprove this fundamental rule; but if the embedded data is encrypted, then the fundamental rule
will remain the same. Structural attacks mainly focus on the high level properties of a particular
method or algorithm. However, when we remove parts of the image that are not altered as a
result of embedding a message, and instead concentrate on the likely areas of embedding in
isolation, it is usually possible to observe signs of manipulation. The ‘Hide & Seek’
steganographic algorithm can be applied only to images whose size is 320 × 480 pixels, which
is an example of this attack. In this case, an analyst can consider all the images satisfying those
size specifications as a suspicious image to perform his attack.

Objective of project
Using a multilevel approach, the main objective of this project is to provide high level security
to sensitive digital data against steganalysis techniques, while keeping the operational time low.
This objective can be achieved by encrypting and authenticating the image that has user’s
sensitive data and then embedding the resultant document on to a carrier.

KESP RITP Lohegaon Pune-47 Page 45


System requirement:
Software requirement:
O Front End: Java (jdk1.4.1 and above)

O OS :Windows 10

O Software : Netbeans IDE(8.0.2)

O Back End: Oracle

Hardware Specification:
KESP RITP Lohegaon Pune-47 Page 46
O 40 GB hard disk space.

O 256 MB RAM or more.

O Cache memory :512KB

Modules: In our project two modules are used. First module is embedded and second module is decoded.

KESP RITP Lohegaon Pune-47 Page 47


Fig 2: steganography modules

Advantages and Disadvantages:


Advantages Disadvantages
Hard to detect. Original image is very Message is hard to recover if image is subject to attack such
similar to altered image. Embedded data as translation and rotation.
resembles Gaussian noise.
KESP RITP Lohegaon Pune-47 Page 48
Hard to detect as message and fundamental Significant damage to picture appearance. Message difficult
image data share same range. to recover.
Altered picture closely resembles original. Relatively easy to detect, as our project has shown.
Not susceptible to attacks such as rotation
and translation.
None Image is distorted. Message easily lost if picture subject to
compression such as JPEG.

APPLICATION AREAS

 Military applications.
 Theoretical mathematical aspects dealing with decoding or finding information.
Additionally.
 The technology has many applications for legitimate business.
 Personal purposes.
KESP RITP Lohegaon Pune-47 Page 49
 network security,
 Fighting crime.
 terrorism

Other applications of concealing data, of varying levels of complexity and sophistication, exist
and can be readily applied. Organizations increasingly consider steganography as a useful
business tool, and the number of carriers is increasing. For example, database developers use
steganography to place identifiers in database relationships [Agrawal et al., 2003]. In general,
steganography can be used either independently or in combination with other technologies. It is
a powerful approach to prevent unwanted detection of messages, simply by denying third
parties knowledge of the presence or location of protected information.

System Architecture
Architecture Figure 4 represents the architecture that is implemented. The modules of the
stenographic tool are also included in the architecture. The user can either be the sender or the
receiver.

KESP RITP Lohegaon Pune-47 Page 50


Fig 3: system architecture

A user is able to do all the operations as shown in figure 4 manually or automatically by using
auto-mode. Both the manual and auto-mode follows the same system flow.

Testing : Testing is a process of executing a program with the aim of finding error. To make our software
perform well it should be error free. If testing is done successfully it will remove all the errors from the
software.

Types of Testing:-

1. Unit Testing

KESP RITP Lohegaon Pune-47 Page 51


It focuses on smallest unit of software design. In this we test an individual unit or group of inter related units. It
is often done by programmer by using sample input and observing its corresponding outputs.

2. Integration Testing

The objective is to take unit tested components and build a program structure that has been dictated by design.
Integration testing is testing in which a group of components are combined to produce output.

3. Regression Testing

Every time new module is added leads to changes in program. This type of testing make sure that whole
component works properly even after adding components to the complete program.

4. Smoke Testing

This test is done to make sure that software under testing is ready or stable for further testing
It is called smoke test as testing initial pass is done to check if it did not catch the fire or smoked in the initial
switch on.

5. Alpha Testing

This is a type of validation testing. It is a type of acceptance testing which is done before the product is released
to customers. It is typically done by QA people.

6. Beta Testing

The beta test is conducted at one or more customer sites by the end-user of the software. This version is released
for the limited number of users for testing in real time environment.

7. System Testing

In this software is tested such that it works fine for different operating system. It is covered under the black box
testing technique. In this we just focus on required input and output without focusing on internal working. IN
this we have security testing, recovery testing, stress testing and performance testing.

8. Stress Testing

In this we give unfavorable conditions to the system and check how they perform in those conditions.

9. Performance Testing

KESP RITP Lohegaon Pune-47 Page 52


It is designed to test the run-time performance of software within the context of an integrated system. It is used
to test speed and effectiveness of program.

Fig 4: types of testing

System Implementation:
Algorithms:
Encryption Process

• Input: Secret_Message, original image , Secret_image;

• Convert Secret_information into image;

• Transfer Secret_Message into JPG_File;

• While sending the message secrete image is provided in the encrypted form.

• Encode Message to image;

• Output: Stego_Image;

KESP RITP Lohegaon Pune-47 Page 53


• End

Decryption Process

• Input: Stego_Image;

• Convert Secret image into original information;

• After Compare Secret image then gives the secrete message;

• Decode ;

• Convert image to secret_Message;

• Output Secret_Message;

• End

Flowcharts:

Start

Enter the : Secret_Message, original image ,


Secret_image;

• Convert Secret_information into image;

• Transfer Secret_Message into JPG_File;

• While sending the message secrete image is


provided in the encrypted form.

KESP RITP Lohegaon Pune-47 Page 54


Stego_Image;

end

ENCRYPTION

Start

Enter the :Secret_image;

Convert Secret image into original information;

After Compare Secret image then gives the secrete


message;

Decode, Convert image to secret_Message;,

Secret_Message

KESP RITP Lohegaon Pune-47 Page 55


end

DECRYPTION

Use case diagram:

KESP RITP Lohegaon Pune-47 Page 56


Activity diagram:

KESP RITP Lohegaon Pune-47 Page 57


Class diagram:

Source code
KESP RITP Lohegaon Pune-47 Page 58
//EmbedMessage.java
import java.awt.image.*;

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import javax.imageio.*;

public class EmbedMessage extends JFrame implements ActionListener

JButton open = new JButton("Open"), embed = new JButton("Embed"),

save = new JButton("Save into new file"), reset = new JButton("Reset");

JTextArea message = new JTextArea(10,3);

BufferedImage sourceImage = null, embeddedImage = null;

JSplitPane sp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);

JScrollPane originalPane = new JScrollPane(),

embeddedPane = new JScrollPane();

public EmbedMessage() {

super("Embed stegonographic message in image");

assembleInterface();

// this.setBounds(GraphicsEnvironment.getLocalGraphicsEnvironment().

// getMaximumWindowBounds());

this.setSize(500, 500);

this.setLocationRelativeTo(null);

this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);

KESP RITP Lohegaon Pune-47 Page 59


this.setVisible(true);

sp.setDividerLocation(0.5);

this.validate();

private void assembleInterface() {

JPanel p = new JPanel(new FlowLayout());

p.add(open);

p.add(embed);

p.add(save);

p.add(reset);

this.getContentPane().add(p, BorderLayout.SOUTH);

open.addActionListener(this);

embed.addActionListener(this);

save.addActionListener(this);

reset.addActionListener(this);

open.setMnemonic('O');

embed.setMnemonic('E');

save.setMnemonic('S');

reset.setMnemonic('R');

p = new JPanel(new GridLayout(1,1));

p.add(new JScrollPane(message));

message.setFont(new Font("Arial",Font.BOLD,20));

p.setBorder(BorderFactory.createTitledBorder("Message to be embedded"));

this.getContentPane().add(p, BorderLayout.NORTH);

KESP RITP Lohegaon Pune-47 Page 60


sp.setLeftComponent(originalPane);

sp.setRightComponent(embeddedPane);

originalPane.setBorder(BorderFactory.createTitledBorder("Original Image"));

embeddedPane.setBorder(BorderFactory.createTitledBorder("Steganographed Image"));

this.getContentPane().add(sp, BorderLayout.CENTER);

public void actionPerformed(ActionEvent ae) {

Object o = ae.getSource();

if(o == open)

openImage();

else if(o == embed)

embedMessage();

else if(o == save)

saveImage();

else if(o == reset)

resetInterface();

private java.io.File showFileDialog(final boolean open) {

JFileChooser fc = new JFileChooser("Open an image");

javax.swing.filechooser.FileFilter ff = new javax.swing.filechooser.FileFilter() {

public boolean accept(java.io.File f) {

String name = f.getName().toLowerCase();

if(open)

return f.isDirectory() || name.endsWith(".jpg") || name.endsWith(".jpeg") ||

KESP RITP Lohegaon Pune-47 Page 61


name.endsWith(".png") || name.endsWith(".gif") || name.endsWith(".tiff") ||

name.endsWith(".bmp") || name.endsWith(".dib");

return f.isDirectory() || name.endsWith(".png") || name.endsWith(".bmp");

public String getDescription() {

if(open)

return "Image (*.jpg, *.jpeg, *.png, *.gif, *.tiff, *.bmp, *.dib)";

return "Image (*.png, *.bmp)";

};

fc.setAcceptAllFileFilterUsed(false);

fc.addChoosableFileFilter(ff);

java.io.File f = null;

if(open && fc.showOpenDialog(this) == fc.APPROVE_OPTION)

f = fc.getSelectedFile();

else if(!open && fc.showSaveDialog(this) == fc.APPROVE_OPTION)

f = fc.getSelectedFile();

return f;

private void openImage() {

java.io.File f = showFileDialog(true);

try {

sourceImage = ImageIO.read(f);

JLabel l = new JLabel(new ImageIcon(sourceImage));

originalPane.getViewport().add(l);

KESP RITP Lohegaon Pune-47 Page 62


this.validate();

} catch(Exception ex) { ex.printStackTrace(); }

private void embedMessage() {

String mess = message.getText();

embeddedImage = sourceImage.getSubimage(0,0,

sourceImage.getWidth(),sourceImage.getHeight());

embedMessage(embeddedImage, mess);

JLabel l = new JLabel(new ImageIcon(embeddedImage));

embeddedPane.getViewport().add(l);

this.validate();

private void embedMessage(BufferedImage img, String mess) {

int messageLength = mess.length();

int imageWidth = img.getWidth(), imageHeight = img.getHeight(),

imageSize = imageWidth * imageHeight;

if(messageLength * 8 + 32 > imageSize) {

JOptionPane.showMessageDialog(this, "Message is too long for the chosen image",

"Message too long!", JOptionPane.ERROR_MESSAGE);

return;

embedInteger(img, messageLength, 0, 0);

byte b[] = mess.getBytes();


KESP RITP Lohegaon Pune-47 Page 63
for(int i=0; i<b.length; i++)

embedByte(img, b[i], i*8+32, 0);

private void embedInteger(BufferedImage img, int n, int start, int storageBit) {

int maxX = img.getWidth(), maxY = img.getHeight(),

startX = start/maxY, startY = start - startX*maxY, count=0;

for(int i=startX; i<maxX && count<32; i++) {

for(int j=startY; j<maxY && count<32; j++) {

int rgb = img.getRGB(i, j), bit = getBitValue(n, count);

rgb = setBitValue(rgb, storageBit, bit);

img.setRGB(i, j, rgb);

count++;

private void embedByte(BufferedImage img, byte b, int start, int storageBit) {

int maxX = img.getWidth(), maxY = img.getHeight(),

startX = start/maxY, startY = start - startX*maxY, count=0;

for(int i=startX; i<maxX && count<8; i++) {

for(int j=startY; j<maxY && count<8; j++) {

int rgb = img.getRGB(i, j), bit = getBitValue(b, count);

rgb = setBitValue(rgb, storageBit, bit);

img.setRGB(i, j, rgb);

count++;

KESP RITP Lohegaon Pune-47 Page 64


}

private void saveImage() {

if(embeddedImage == null) {

JOptionPane.showMessageDialog(this, "No message has been embedded!",

"Nothing to save", JOptionPane.ERROR_MESSAGE);

return;

java.io.File f = showFileDialog(false);

String name = f.getName();

String ext = name.substring(name.lastIndexOf(".")+1).toLowerCase();

if(!ext.equals("png") && !ext.equals("bmp") && !ext.equals("dib")) {

ext = "png";

f = new java.io.File(f.getAbsolutePath()+".png");

try {

if(f.exists()) f.delete();

ImageIO.write(embeddedImage, ext.toUpperCase(), f);

} catch(Exception ex) { ex.printStackTrace(); }

private void resetInterface() {

message.setText("");

originalPane.getViewport().removeAll();

KESP RITP Lohegaon Pune-47 Page 65


embeddedPane.getViewport().removeAll();

sourceImage = null;

embeddedImage = null;

sp.setDividerLocation(0.5);

this.validate();

private int getBitValue(int n, int location) {

int v = n & (int) Math.round(Math.pow(2, location));

return v==0?0:1;

private int setBitValue(int n, int location, int bit) {

int toggle = (int) Math.pow(2, location), bv = getBitValue(n, location);

if(bv == bit)

return n;

if(bv == 0 && bit == 1)

n |= toggle;

else if(bv == 1 && bit == 0)

n ^= toggle;

return n;

public static void main(String arg[]) {

new EmbedMessage();

}
KESP RITP Lohegaon Pune-47 Page 66
//DecodeMessage.java
import java.awt.image.*;

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import javax.imageio.*;

public class DecodeMessage extends JFrame implements ActionListener

JButton open = new JButton("Open"), decode = new JButton("Decode"),

reset = new JButton("Reset");

JTextArea message = new JTextArea(10,3);

BufferedImage image = null;

JScrollPane imagePane = new JScrollPane();

KESP RITP Lohegaon Pune-47 Page 67


public DecodeMessage() {

super("Decode stegonographic message in image");

assembleInterface();

this.setDefaultCloseOperation(EXIT_ON_CLOSE);

this.setBounds(GraphicsEnvironment.getLocalGraphicsEnvironment().

getMaximumWindowBounds());

this.setVisible(true);

private void assembleInterface() {

JPanel p = new JPanel(new FlowLayout());

p.add(open);

p.add(decode);

p.add(reset);

this.getContentPane().add(p, BorderLayout.NORTH);

open.addActionListener(this);

decode.addActionListener(this);

reset.addActionListener(this);

open.setMnemonic('O');

decode.setMnemonic('D');

reset.setMnemonic('R');

p = new JPanel(new GridLayout(1,1));

p.add(new JScrollPane(message));

message.setFont(new Font("Arial",Font.BOLD,20));
KESP RITP Lohegaon Pune-47 Page 68
p.setBorder(BorderFactory.createTitledBorder("Decoded message"));

message.setEditable(false);

this.getContentPane().add(p, BorderLayout.SOUTH);

imagePane.setBorder(BorderFactory.createTitledBorder("Steganographed Image"));

this.getContentPane().add(imagePane, BorderLayout.CENTER);

public void actionPerformed(ActionEvent ae) {

Object o = ae.getSource();

if(o == open)

openImage();

else if(o == decode)

decodeMessage();

else if(o == reset)

resetInterface();

private java.io.File showFileDialog(boolean open) {

JFileChooser fc = new JFileChooser("Open an image");

javax.swing.filechooser.FileFilter ff = new javax.swing.filechooser.FileFilter() {

public boolean accept(java.io.File f) {

String name = f.getName().toLowerCase();

return f.isDirectory() || name.endsWith(".png") || name.endsWith(".bmp");

public String getDescription() {

return "Image (*.png, *.bmp)";

KESP RITP Lohegaon Pune-47 Page 69


}

};

fc.setAcceptAllFileFilterUsed(false);

fc.addChoosableFileFilter(ff);

java.io.File f = null;

if(open && fc.showOpenDialog(this) == fc.APPROVE_OPTION)

f = fc.getSelectedFile();

else if(!open && fc.showSaveDialog(this) == fc.APPROVE_OPTION)

f = fc.getSelectedFile();

return f;

private void openImage() {

java.io.File f = showFileDialog(true);

try {

image = ImageIO.read(f);

JLabel l = new JLabel(new ImageIcon(image));

imagePane.getViewport().add(l);

this.validate();

} catch(Exception ex) { ex.printStackTrace(); }

private void decodeMessage() {

int len = extractInteger(image, 0, 0);

byte b[] = new byte[len];

for(int i=0; i<len; i++)


KESP RITP Lohegaon Pune-47 Page 70
b[i] = extractByte(image, i*8+32, 0);

message.setText(new String(b));

private int extractInteger(BufferedImage img, int start, int storageBit) {

int maxX = img.getWidth(), maxY = img.getHeight(),

startX = start/maxY, startY = start - startX*maxY, count=0;

int length = 0;

for(int i=startX; i<maxX && count<32; i++) {

for(int j=startY; j<maxY && count<32; j++) {

int rgb = img.getRGB(i, j), bit = getBitValue(rgb, storageBit);

length = setBitValue(length, count, bit);

count++;

return length;

private byte extractByte(BufferedImage img, int start, int storageBit) {

int maxX = img.getWidth(), maxY = img.getHeight(),

startX = start/maxY, startY = start - startX*maxY, count=0;

byte b = 0;

for(int i=startX; i<maxX && count<8; i++) {

for(int j=startY; j<maxY && count<8; j++) {

int rgb = img.getRGB(i, j), bit = getBitValue(rgb, storageBit);

b = (byte)setBitValue(b, count, bit);

KESP RITP Lohegaon Pune-47 Page 71


count++;

return b;

private void resetInterface() {

message.setText("");

imagePane.getViewport().removeAll();

image = null;

this.validate();

private int getBitValue(int n, int location) {

int v = n & (int) Math.round(Math.pow(2, location));

return v==0?0:1;

private int setBitValue(int n, int location, int bit) {

int toggle = (int) Math.pow(2, location), bv = getBitValue(n, location);

if(bv == bit)

return n;

if(bv == 0 && bit == 1)

n |= toggle;

else if(bv == 1 && bit == 0)

n ^= toggle;

return n;
KESP RITP Lohegaon Pune-47 Page 72
}

public static void main(String arg[]) {

new DecodeMessage();

KESP RITP Lohegaon Pune-47 Page 73


Result : OUTPUT: As a Sender Side Encryption

KESP RITP Lohegaon Pune-47 Page 74


KESP RITP Lohegaon Pune-47 Page 75
OUTPUT: as a receiver side

Project Scope

KESP RITP Lohegaon Pune-47 Page 76


The primary idea behind developing this project is to protect confidential data from an
intruder’s counter-attacks and to block the intruder through various levels in his/her attacks. A
new tool has been developed with a combination of cryptographic encryption and
steganographic encryption for its implementation. The developed steganographic tool has a
sender’s segment that can take a message and a cover image as input and give a stego-image as
output that has message embedded in it. On the other hand, it also has a receiver’s segment
where the receiver inputs the stego-image is used by the sender as input to get the sender’s
message as output. The project is tested with various inputs and made sure that the generated
stego-image has no noise are data loss.

Future scope

As a part of security, the pixels of the cover image are filtered both according to their position
and the threshold limit. Because of this, the space availability of data insertion could become

KESP RITP Lohegaon Pune-47 Page 77


very less. Therefore, the embedding information should be small for successful embedding.
New ideas could be developed on increasing the space availability in the cover image to insert
as much data as possible.

Reference:
• http://ijcsit.com/docs/Volume%206/vol6issue01/ijcsit20150601152.pdf

• https://searchsecurity.techtarget.com/definition/steganography

KESP RITP Lohegaon Pune-47 Page 78


• https://www.researchgate.net/publication/301790999_Literature_
Review_On_Digital_Image_Steganography_and_Cryptography_Algorithms

• http://programmer2programmer.net/live_projects/project_7/steganography.aspx

Conclusion
The proposed Digital Steganography project provides a GUI, user-friendly software system through which
secret information can be easily transmitted without hackers knowing anything about it. Attaining all Java
features, this system is platform independent and flexible. We have briefly explained and defined
steganography, which is in my opinion an effective tool to do so many things regarding security or reliability in
any field of communication .what we mean that, this technique can be used in any section in real life, military,
businesses, educational, governments and more. Also, we have shown various tools and how they function well.
KESP RITP Lohegaon Pune-47 Page 79
KESP RITP Lohegaon Pune-47 Page 80

You might also like