Vous êtes sur la page 1sur 64

i

DECLARATION

We hereby declare that submitted is our own work and that, to the best of our

knowledge and belief, it contains no material previously published or written by

another person nor material which to a substantial extent has been accepted for

the award of any other degree or diploma of the university or other institute of

higher learning, except where due acknowledgment has been made in the text.

Name Roll No. Signature

Ankita Gupta 1410931001

Date:

ii
Certificate

This is to certified that Ankita Gupta have carried out the research work
presented in this project entitled “Motion Based Message Conveyer For
Patients” for the award of Bachelor of Technology from Dr. A. P. J. Abdul
Kalam Technical University, Lucknow under my supervision. The project
embodies result of original work and studies carried out by Students them self
and the contents of the project do not form the basis for the award of any other
degree to the candidate or to anybody else.

(Mrs. Anjali Vashistha ) (Dr. Mohd. Saood)

Assistant Professor Head of the Department

ECE Department EN & EC Department

ACET, Aligarh ACET, Aligarh

Date:

iii
ACKNOWLEDGEMENT

First of all, a very deep appreciation to my project supervisor, Ms. Anjali


Vashistha for his patient and enthusiasm when guide me for this project and
also the opportunity she gave allowed me to learn how to build my project. I
had been exposed with some knowledge about how to build the system
controlling hardware using microcontroller. By this knowledge, I had able to
write a set of system to send message wirelessly using hand motions.
Throughout this project, I had been trained to handle whole project, solve for
tasks, learn new microcontroller platform, how to write a proper technical
report, how to present the work and etc.
Also, I want to thank all faculty members of the department for providing
support and blessings.
I would also like to thank Head of Department Dr. Mohammad Saood for his
constant support and guidance to complete this project.

iv
TABLE OF CONTENT

ABSTRACT (vi)
LIST OF TABLES (vii)
LIST OF FIGURES (VIII)

1
CHAPTER 1: INTRODUCTION
1
1.1 Introduction 1
1.2 Basic Block Daigram 2
1.3 Subproject 2
1.4 Motivation For Project 2
1.5 Objective Of Project

CHAPTER 2: LITERATURE REVIEW 3

2.1 Hardware Development 3


2.1.1 Arduino 3
2.1.2 Accelerometer (MPU6050) 13
2.1.3 LCDModule 15
2.1.4 RF Module 20
2.1.5 SD Module 22
2.1.6 Speaker 24

2.2 Software Development 25

2.3 Interfacing 28
2.3.2 Accelerometer (MPU6050) 28
2.3.3 LCD Module 29
2.3.4 RF Module 31
2.3.5 SD Module 33
2.3.6 Speaker 34

CHAPTER 3: IMPLEMENTATION

CHAPTER 4: CONCLUSION AND FUTURE WORK 39


v
APPENDIX 1 40
46
APPENDIX 2
53
REFRENCES

vi
ABSTRACT

The main aim of the project is to implement a low cost reliable system
which will help to establish communication between paralytic or disabled
patients and a nurse. A patient can easily send messages to the nurse by just
tilting an accelerometer connected to a body part capable of movement. This
angle of tilt is sent to a central controller which then initiates communication
between the patient (transmitter) and nurse (receiver) and also decides which
message is to be transmitted based on the tilt angle. Each patient will have such
a device installed on or around his body and all such patients will be centrally
linked to the receiver at the nurse side. Along with this an audio system is
connected with the transmitter, as if the message is not seen due to some reason
then the message can be heard as an audio. Our project provides a reliable,
effective and simple yet important solution to various issues faced by nurses in
traditionally communicating with disabled patients.

vii
List of tables

S.NO. Name Page no.


Table 2.1 Summary of Arduino Uno 7
Table 2.2 Summary of Arduino Nano 10
Table 2.3 LCD 16x2 Basic Commands 18
Table 2.4 LCD Data Pin Configuration 18
Table 2.5 RF Transmitter Pin Configuration 21
Table 2.6 RF Receiver Pin Configuration 21
Table 2.7 SD Card Pin Configuration 23
Table 2.8 Dimensions of .wav audio File 34

viii
List of figures

S.No. Name Page No.


Fig. 1.1.1 Block diagram of transmitter 1
Fig. 1.1.2 Block diagram of receiver 2
Fig. 2.1 ATmega 328 pin Mapping 4
Fig. 2.1.1 Arduino uno microcontroller board 6
Fig. 2.1.2 Pin configuration of arduino uno 8
Fig. 2.1.3 Arduino nano microcontroller board 9
Fig. 2.1.4 Arduino nano pin configuration 12
Fig. 2.2 MPU 6050 13
Fig. 2.3 LCD display module 15
Fig. 2.3.1 LCD Display module pin configuration 17
Fig. 2.4 RF module 20
Fig. 2.5 SD module 22
Fig. 2.5.1 SD card pin configuration 23
Fig. 2.6 Speaker 24
Fig. 2.7 Arduino IDE software 25
Fig. 2.8 MPU6050 Interfacing with arduino nano 28
Fig. 2.9 LCD interfacing with arduino uno 29
Fig. 2.10 Transmitter interfacing with arduino uno 31
Fig. 2.10.1 Receiver interfacing with arduino uno 32
Fig. 2.11 SD card module interfacing with arduino uno 33
Fig. 2.12 Speaker interfacing with arduino uno 34
Fig. 3.1 Motion of the hand 35
Fig. 3.2 Serial moniter Showing readings of MPU6050 sensor 35
Fig. 3.3 Transmitter circuit connections 36
Fig. 3.3.1 Transmitter Circuit 36
Fig. 3..4 Receiver circuit connections 38
Fig. 3.4.1 Receiver ciruit 38

1
CHAPTER 1: INTRODUCTION

1.1 Introduction
Among the large number of advancements done in the medical sector, very few
actually focus on helping patients with disabilities to communicate. Although monitoring
systems make it easier for doctors to collect and observe a patient’s vitals, there aren’t many
options for actual verbal communication for disabled patients. Here we propose a simple yet
effective way to solve this age old problem. The main purpose is to replace the conventional
approach of patient-nurse communication with modern technologies that provide a much
faster and reliable way to do so. In the current scenario, the patient has to be dependent on a
family member or mostly a ward boy both of which have to attend to the patient constantly.
Our objective is to make such patients independent to communicate with the nurse by
the simple task of tilting a device located on his finger or any other part of the body that is
capable of movement. This will not only help the patient but also ease out the nurse’s job. As
a single nurse is responsible for a number of patients, the time required for each nurse to visit
every patient to meet his needs will be saved. After the patient sends the message the nurse
can remotely monitor their requests and provide assistance without any further delay.

1.2 Basic Block Diagram


Transmitter: The transmitter section consists of an accelerometer sensor, arduino
nano microcontroller, and a RF transmitter. The accelerometer sensor readings changes with
the motion, so it detects the motion of the hand of a patient. The microcontroller takes the
input from accelerometer sensor and based on that input it transmits the data signal using rf
transmitter.

The block diagram of the transmitter section is shown below:

Fig. 1.1.1- Block Diagram of Transmitter

1
Receiver: The receiver section consists of an arduino uno microcontroller, rf
transmitter, LCD display, speaker and sd card module.
The block diagram of the receiver section is shown below:

Fig. 1.1.2- Block Diagram of Reciever

1.3 SUBPROJECT
The project is divided into five major subprojects as follows:
 Sensor Feedback System: Accelerometer is used to provide feedback to the user on
alignment position.
 Wireless Communication: The accelerometer and message displaying units are
connected through wireless rf communication.
 Speaker lcd Data Signal Circuits: These circuits take input from the accelerometer
sensors and generate appropriate motor control signals based on those inputs.
 Microcontroller Programming: The microcontroller takes input from the sensor
feedback system and generates an appropriate control signals for automated control of the
robotic hand.

1.4 MOTIVATION FOR PROJECT


Our motivation to work on this project came from a disabled person who has
difficulty in communicating. So we wanted to make a device which would help such people
communicate with peoples with the motion of his hands.

1.5 OBJECTIVE OF PROJECT


Our objective is to make this device simple as well as cheap so that it could be mass
produced and can be used for a number of purposes.

2
CHAPTER 2: LITERATURE REVIEW

In today’s world population is increasing rapidly. So there is a need for proper health
care centers which need to be well maintained and developed. It not only reduced mobility of
patients from one ward to other but also increased burden on patients. Also it consumes more
space and has more power consumption. Moreover in hospitals bedside patient monitoring is
done which allows multiple patients in one room. Patient monitoring is done at individual
level. In one room one patient is there and multiple patient physiological parameters are
measured individually. If there seems to be an emergency, an alarm system informs the nurse
and the doctor. Monitoring systems make it easier for doctors to collect and observe a
patient’s vitals; there aren’t many options for actual verbal communication for patients.

2.1 Hardware development


2.1.1 ARDUINO:
Arduino is an open-source electronics platform based on easy-to-use hardware and
software. Arduino boards are able to read inputs - light on a sensor, a finger on a button, or a
Twitter message - and turn it into an output - activating a motor, turning on an LED,
publishing something online. You can tell your board what to do by sending a set of
instructions to the microcontroller on the board. To do so you use the Arduino programming
language (based on Wiring), and the Arduino Software (IDE), based on Processing.
Over the years Arduino has been the brain of thousands of projects, from everyday
objects to complex scientific instruments. A worldwide community of makers - students,
hobbyists, artists, programmers, and professionals - has gathered around this open-source
platform, their contributions have added up to an incredible amount of accessible
knowledge that can be of great help to novices and experts alike.
Arduino was born at the Ivrea Interaction Design Institute as an easy tool for fast
prototyping, aimed at students without a background in electronics and programming. As
soon as it reached a wider community, the Arduino board started changing to adapt to new
needs and challenges, differentiating its offer from simple 8-bit boards to products
for IoT applications, wearable, 3D printing, and embedded environments. All Arduino boards
are completely open-source, empowering users to build them independently and eventually
adapt them to their particular needs. The software, too, is open-source, and it is growing
through the contributions of users worldwide.
Arduino is used because its simple and accessible user experience, Arduino has been
used in thousands of different projects and applications. The Arduino software is easy-to-use
for beginners, yet flexible enough for advanced users. It runs on Mac, Windows, and Linux.
Teachers and students use it to build low cost scientific instruments, to prove chemistry and
physics principles, or to get started with programming and robotics. Designers and architects
build interactive prototypes, audioians and artists use it for installations and to experiment
with new audioal instruments. Makers, of course, use it to build many of the projects
exhibited at the Maker Faire, for example. Arduino is a key tool to learn new things. Anyone
- children, hobbyists, artists, programmers - can start tinkering just following the step by step
instructions of a kit, or sharing ideas online with other members of the Arduino community.
There are many other microcontrollers and microcontroller platforms available for
physical computing. Parallax Basic Stamp, Netmedia's BX-24, Phidgets, MIT's Handyboard,
3
and many others offer similar functionality. All of these tools take the messy details of
microcontroller programming and wrap it up in an easy-to-use package. Arduino also
simplifies the process of working with microcontrollers, but it offers some advantage for
teachers, students, and interested amateurs over other systems:
 Inexpensive - Arduino boards are relatively inexpensive compared to other
microcontroller platforms. The least expensive version of the Arduino module can be
assembled by hand, and even the pre-assembled Arduino modules cost less than $50
 Cross-platform - The Arduino Software (IDE) runs on Windows, Macintosh OSX,
and Linux operating systems. Most microcontroller systems are limited to Windows.
 Simple, clear programming environment - The Arduino Software (IDE) is easy-to-
use for beginners, yet flexible enough for advanced users to take advantage of as well. For
teachers, it's conveniently based on the Processing programming environment, so students
learning to program in that environment will be familiar with how the Arduino IDE works.
 Open source and extensible software - The Arduino software is published as open
source tools, available for extension by experienced programmers. The language can be
expanded through C++ libraries, and people wanting to understand the technical details can
make the leap from Arduino to the AVR C programming language on which it's based.
Similarly, you can add AVR-C code directly into your Arduino programs if you want to.
 Open source and extensible hardware - The plans of the Arduino boards are
published under a Creative Commons license, so experienced circuit designers can make
their own version of the module, extending it and improving it. Even relatively inexperienced
users can build the breadboard version of the module in order to understand how it works and
save money.
The microcontrollers are typically programmed using a dialect of features from the
pro-gramming languages C and C++. In addition to using traditional compiler tool chains, the
Arduino project provides an integrated development environment (IDE) based on the
Processing language project.Most Arduino boards consist of an Atmel 8-bit AVR mi-
crocontroller (ATmega8, ATmega168, ATmega328, ATmega1280.
Most boards include a 5 V linear regulator and a 16 MHz crystal oscillator or ceramic
resonator. Some designs, such as the LilyPad, run at 8 MHz and dispense with the onboard
voltage regulator due to specific form-factor restrictions.
Here is the Pin Diagram of Arduino Atmega328:

Fig. 2.1- ATmega328 Pin Mapping


4
Pin Descriptions:
 VCC : Digital supply voltage
 GND : Ground
 Port B (PB7): Port B is an 8-bit bi-directional I/O port with internal pull-up resistors
(selected for each bit). The Port B output bufers have symmetrical drive characteristics with
both high sink and source capability. As inputs, Port B pins that are externally pulled low will
source current if the pull-up resistors are activated. The Port B pins are tristated when a reset
condition becomes active, even if the clock is not running. Depending on the clock se-lection
fuse settings, PB7 can be used as output from the inverting Oscillator amplifier.
 PB6: Depending on the clock selection fuse settings, PB6 can be used as input to the
inverting Oscillator ampli er and input to the internal clock operating circuit.
 Port C (PC5): Port C is a 7-bit bi-directional I/O port with internal pull-up resistors
(selected for each bit). The output bufers have symmetrical drive characteristics with both
high sink and source capability. As inputs, Port C pins that are externally pulled low will
source current if the pull-up resistors are activated. The Port C pins are tri-stated when a reset
condition becomes active, even if the clock is not running.
 PC6: PC6 is used as an I/O pin. Note that the electrical charac-teristics of PC6 di er
from those of the other pins of Port C.; PC6 is used as a Reset input. A low level on this pin
for longer than the minimum pulse length will generate a Reset, even if the clock is not
running.
 Port D (PD7): Port D is an 8-bit bi-directional I/O port with in-ternal pull-up
resistors (selected for each bit). The Port D output bu ers have symmetrical drive
characteristics with both high sink and source capability. As inputs, Port D pins that are
externally pulled low will source current if the pull-up resistors are activated. The Port D pins
are tri-stated when a reset condition becomes active, even if the clock is not running.
 AVcc: AVCC is the supply voltage pin for the A/D Converter. It should be externally
connected to VCC, even if the ADC is not used. If the ADC is used, it should be connected to
VCC through a low-pass filter. Note that PC6...4 use digital supply voltage.
 AREF: AREF is the analog reference pin for the A/D Converter.

Functions:
Digital I/O: There are basically three functions used in digital i/o.

 Pin Mode (): Con gures the specified pin to behave either as an input or an output.

 Digital Write (): Write a high or a low value to a digital pin. If the pin is con gured as
an input, writing a high value with digital Write () will enable an internal 20K pull-up
resistor. Writing low will disable the pull-up. The pull-up resistor is enough to light an led
dimly, so if LEDs appear to work, but very dimly, this is a likely cause. The remedy is to set
the pin to an output with the pin Mode () function.
 Digital Read (): Reads the value from a specified digital pin, either high or low.

Analog I/O: In analog i/o there are also three functions to take input from accelerometer
which are
5
 Analog Reference (): Con gures the reference voltage used for ana-log input (i.e. the
value used as the top of the input range). The options are:
 Default :The default analog reference of 5 volts (on 5V Arduino boards) or 3.3 volts
(on 3.3V Arduino boards)

Internal: An built-in reference, equal to 1.1 volts on the ATmega168 or ATmega328 and 2.56
volts on theATmega8 (not available on the Arduino Mega)

 Internal 1V1: A built-in 1.1V reference (Arduino Mega only)


 Internal 2V56: A built-in 2.56V reference (Arduino Mega only)
 External: The voltage applied to the AREF pin (0 to 5V only) is used as the reference.

2.1.1.1 ARDUINO UNO:


The Arduino Uno R3 is a microcontroller board based on the ATmega328 (datasheet). It
has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a
16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset
button. It contains everything needed to support the microcontroller; simply connect it to a
computer with a USB cable or power it with a AC-to-DC adapter or battery to get started.

Fig. 2.1.1- Arduino Uno Microcontroller Board.

The uno differs from all preceding boards in that it does not use the FTDI USB-to-
serial driver chip. Instead, it features the Atmega16U2 (Atmega8U2 up to version R2)
programmed as a USB-to-serialconverter.

6
Revision 2 of the Uno board has a resistor pulling the 8U2 HWB line to ground, making it
easiertoputinto DFUmode.

Summary:

Microcontroller

ATmega328
Operating Voltage 5V
Input Voltage (recommended) 7-12V
Input Voltage (limits) 6-20V
Digital I/O Pins 14 (of which 6 provide PWM output)
Analog Input Pins 6
DC Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 32 KB (ATmega328) of which 0.5 KB used by
bootloader
SRAM 2 KB (ATmega328)
EEPROM 1 KB (ATmega328)
Clock Speed 16 MHz

7
Table 2.1- Summary of Arduino uno

Power:
The Arduino Uno can be powered via the USB connection or with an external power
supply. The power source is selected automatically.External (non-USB) power can come
either from an AC-to-DC adapter (wall-wart) or battery. The adapter can be connected by
plugging a 2.1mm center-positive plug into the board's power jack. Leads from a battery can
be inserted in the Gnd and Vin pin headers of the POWER connector.The board can operate
on an external supply of 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may
supply less than five volts and the board may be unstable. If using more than 12V, the voltage
regulator may overheat and damage the board. The recommended range is 7 to 12 volts.
The power pins are as follows:
 VIN. The input voltage to the Arduino board when it's using an external power source
(as opposed to 5 volts from the USB connection or other regulated power source). You can
supply voltage through this pin, or, if supplying voltage via the power jack, access it through
this pin.
 5V. The regulated power supply used to power the microcontroller and other
components on the board. This can come either from VIN via an on-board regulator, or be
supplied by USB or another regulated 5V supply.
 3V3. A 3.3 volt supply generated by the on-board regulator. Maximum current draw
is 50 mA.
 GND. Ground pins.

Memory:
The ATmega328 has 32 KB (with 0.5 KB used for the bootloader). It also has 2 KB
of SRAM and 1 KB of EEPROM (which can be read and written with the EEPROM library.
Input and Output:
Each of the 14 digital pins on the Uno can be used as an input or output,
using pinMode(), digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each
pin can provide or receive a maximum of 40 mA and has an internal pull-up resistor
(disconnected by default) of 20-50 kOhms. In addition, some pins have specialized functions:

8
Fig. 2.1.2- Pin Configuration of Arduino Uno

 Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data.
These pins are connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial
chip.
 External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on
a low value, a rising or falling edge, or a change in value. See the attachInterrupt() function
for details.

 PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with


the analogWrite() function.
 SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI
communication using the SPI library.
 LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH
value, the LED is on, when the pin is LOW, it's off.
The Uno has 6 analog inputs, labeled A0 through A5, each of which provide 10 bits of
resolution (i.e. 1024 different values). By default they measure from ground to 5 volts,
though is it possible to change the upper end of their range using the AREF pin and
the analogReference() function. Additionally, some pins have specialized functionality:
 TWI: A4 or SDA pin and A5 or SCL pin. Support TWI communication using
the Wire library.

There are a couple of other pins on the board:


 AREF. Reference voltage for the analog inputs. Used with analogread().
 Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset
button to shields which block the one on the board.

9
Communication:
The Arduino Uno has a number of facilities for communicating with a computer,
another Arduino, or other microcontrollers. The ATmega328 provides UART TTL (5V) serial
communication, which is available on digital pins 0 (RX) and 1 (TX). An ATmega16U2 on
the board channels this serial communication over USB and appears as a virtual com port to
software on the computer. The '16U2 firmware uses the standard USB COM drivers, and no
external driver is needed. However, on Windows, a .inf file is required. The Arduino software
includes a serial monitor which allows simple textual data to be sent to and from the Arduino
board. The RX and TX LEDs on the board will flash when data is being transmitted via the
USB-to-serial chip and USB connection to the computer (but not for serial communication
on pins 0 and 1).
A SoftwareSerial library allows for serial communication on any of the Uno's digital
pins.
The ATmega328 also supports I2C (TWI) and SPI communication. The Arduino
software includes a Wire library to simplify use of the I2C bus. For SPI communication, use
the SPI library.
USB over current protection:
The Arduino Uno has a resettable poly-fuse that protects your computer's USB ports
from shorts and over current. Although most computers provide their own internal protection,
the fuse provides an extra layer of protection. If more than 500mA is applied to the USB port,
the fuse will automatically break the connection until the short or overload is removed.
Physical characteristics:
The maximum length and width of the Uno PCB are 2.7 and 2.1 inches respectively,
with the USB connector and power jack extending beyond the former dimension. Four screw
holes allow the board to be attached to a surface or case. Note that the distance between
digital pins 7 and 8 is 160mil (0.16"), not an even multiple of the 100mil spacing of the other
pins.

2.1.1.2 ARDUINO
NANO:
The Arduino Nano
is a small, complete, and
breadboard- friendly board
based on the ATmega328
(Arduino Nano 3.0) or
ATmega168 (Arduino Nano
2.x). It has more or less
the same functionality of
the Arduino Duemilanove,
but in a different
package. It lacks only a
10
DC power jack, and works with a Mini-B USB cable instead of a standard one. The Nano
was designed and is being produced by Gravitech.

Fig. 2.1.3- Arduino Nano Microcontroller Board


Summary:
Microcontroller Atmel ATmega168 or ATmega328
Operating Voltage (logic level)- 5V
Input Voltage (recommended) - 7-12 V
Input Voltage (limits) - 6-20 V
Digital I/O Pins - 14 (of which 6 provide PWM output)
Analog Input Pins - 8
DC Current per I/O Pin - 40 Ma
Flash Memory - 16 KB (ATmega168) or 32 KB (ATmega328) of which 2 KB used by
bootloader
SRAM - 512 bytes (ATmega168) or 1 KB (ATmega328)
EEPROM - 512 bytes (ATmega168) or 1 KB (ATmega328)
Clock Speed - 16 MHz
Dimensions - 0.73" x 1.70"
Table 2.2- Summary of Arduino Nano
Power:
The Arduino Nano can be powered via the Mini-B USB connection, 6-20V
unregulated external power supply (pin 30), or 5V regulated external power supply (pin 27).
The power source is automatically selected to the highest voltage source. The FTDI
FT232RL chip on the Nano is only powered if the board is being powered over USB. As a
result, when running on external (non-USB) power, the 3.3V output (which is supplied by the
FTDI chip) is not available and the RX and TX LEDs will flicker if digital pins 0 or 1 are
high.

11
Memory:
The ATmega168 has 16 KB of flash memory for storing code (of which 2 KB is used
for the bootloader); the ATmega328 has 32 KB, (also with 2 KB used for the bootloader).
The ATmega168 has 1 KB of SRAM and 512 bytes of EEPROM (which can be read and
written with the EEPROM library); the ATmega328 has 2 KB of SRAM and 1 KB of
EEPROM.

Input and output pins:


Each of the 14 digital pins on the Nano can be used as an input or output, using
pinMode(), digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each pin can
provide or receive a maximum of 40 mA and has an internal pull-up resistor (disconnected by
default) of 20-50 kOhms. In addition, some pins have specialized functions:

 Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data.
These pins are connected to the corresponding pins of the FTDI USB-to-TTL Serial chip.
 External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on
a low value, a rising or falling edge, or a change in value. See the attachInterrupt() function
for details.
 PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite()
function.
 SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI
communication, which, although provided by the underlying hardware, is not currently
included in the Arduino language.
 LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH
value, the LED is on, when the pin is LOW, it's off. The Nano has 8 analog inputs, each of
which provide 10 bits of resolution (i.e. 1024 different values). By default they measure from
ground to 5 volts, though is it possible to change the upper end of their range using the
analogReference() function. Additionally, some pins have specialized functionality:
 I2 C: 4 (SDA) and 5 (SCL). Support I2 C (TWI) communication using the Wire
library (documentation on the Wiring website). There are a couple of other pins on the
board:
 AREF. Reference voltage for the analog inputs. Used with analogReference().
 Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset
button to shields which block the one on the board.

Pin configuration of arduino nano microcontroller board are shown in the figure below:

12
Fig. 2.1.4- Arduino Nano pin configuration

Communication:
The Arduino Nano has a number of facilities for communicating with a computer,
another Arduino, or other microcontrollers. The ATmega168 and ATmega328 provide UART
TTL (5V) serial communication, which is available on digital pins 0 (RX) and 1 (TX). An
FTDI FT232RL on the board channels this serial communication over USB and the FTDI
drivers (included with the Arduino software) provide a virtual com port to software on the
computer. The Arduino software includes a serial monitor which allows simple textual data to
be sent to and from the Arduino board. The RX and TX LEDs on the board will flash when
data is being transmitted via the FTDI chip and USB connection to the computer (but not for
serial communication on pins 0 and 1). A SoftwareSerial library allows for serial
communication on any of the Nano's digital pins. The ATmega168 and ATmega328 also
support I2C (TWI) and SPI communication. The Arduino software includes a Wire library to
simplify use of the I2C bus.
Programming:
The Arduino Nano can be programmed with the Arduino software (download). Select
"Arduino Diecimila, Duemilanove, or Nano w/ ATmega168" or "Arduino Duemilanove or
Nano w/ ATmega328" from the Tools > Board menu (according to the microcontroller on
your board.
The ATmega168 or ATmega328 on the Arduino Nano comes preburned with a
bootloader that allows you to upload new code to it without the use of an external hardware
programmer. It communicates using the original STK500 protocol (reference, C header files).
You can also bypass the bootloader and program the microcontroller through the ICSP.

13
2.1.2 MPU 6050

MPU6050 sensor module is complete 6-axis Motion Tracking Device. It combines 3-


axis Gyroscope, 3-axis Accelerometer and Digital Motion Processor all in small package. It
has I2C bus interface to communicate with the microcontrollers.It has Auxiliary I2C bus to
communicate with other sensor devices like 3-axis Magnetometer, Pressure sensor etc.If 3-
axis Magnetometer is connected to auxiliary I2C bus, then MPU6050 can provide complete
9-axis Motion Fusion output.

Fig. 2.2- MPU6050

Here we are using only accelerometer sensor of MPU6050.


3-Axis Accelerometer:
The MPU6050 consist 3-axis Accelerometer with Micro Electro Mechanical (MEMs)
technology. It used to detect angle of tilt or inclination along the X, Y and Z axes as shown in
below figure.

- Acceleration along the axes deflects the movable mass.


- This displacement of moving plate (mass) unbalances the differential capacitor which
results in sensor output. Output amplitude is proportional to acceleration.
- 16-bit ADC is used to get digitized output.
- The full-scale range of acceleration are +/- 2g, +/- 4g, +/- 8g, +/- 16g.
- It measured in g (gravity force) unit.

14
- When device placed on flat surface it will measure 0g on X and Y axis and +1g on Z axis.

DMP (Digital Motion Processor):


The embedded Digital Motion Processor (DMP) is used to compute motion
processing algorithms. It takes data from gyroscope, accelerometer and additional 3rd party
sensor such as magnetometer and processes the data. It provides motion data like roll, pitch,
yaw angles, landscape and portrait sense etc. It minimizes the processes of host in computing
motion data. The resulting data can be read from DMP registers.
.
MPU-6050 Module pin configuration:
The MPU-6050 module has 8 pins,
 INT: Interrupt digital output pin.
 AD0: I2C Slave Address LSB pin. This is 0th bit in 7-bit slave address of device. If
connected to VCC then it is read as logic one and slave address changes.
 XCL: Auxiliary Serial Clock pin. This pin is used to connect other I2C interface
enabled sensors SCL pin to MPU-6050.
 XDA: Auxiliary Serial Data pin. This pin is used to connect other I2C interface
enabled sensors SDA pin to MPU-6050.
 SCL: Serial Clock pin. Connect this pin to microcontrollers SCL pin.
 SDA: Serial Data pin. Connect this pin to microcontrollers SDA pin.
 GND: Ground pin. Connect this pin to ground connection.
 VCC: Power supply pin. Connect this pin to +5V DC supply.
 MPU-6050 module has Slave address (When AD0 = 0, i.e. it is not connected to Vcc)
as,
 Slave Write address(SLA+W): 0xD0
 Slave Read address(SLA+R): 0xD1

Calculations:
Note that gyroscope and accelerometer sensor data of MPU6050 module consists of
16-bit raw data in 2’s complement form.
Now suppose we have selected, Accelerometer full scale range of +/- 2g with
Sensitivity Scale Factor of 16,384 LSB(Count)/g.To get sensor raw data, we need to first
perform 2’s complement on sensor data of Accelerometer and gyroscope.After getting sensor
raw data we can calculate acceleration and angular velocity by dividing sensor raw data with
their sensitivity scale factor as follows,
Accelerometer values in g (g force)
Acceleration along the X axis = (Accelerometer X axis raw data/16384) g.
Acceleration along the Y axis = (Accelerometer Y axis raw data/16384) g.
Acceleration along the Z axis = (Accelerometer Z axis raw data/16384)

15
2.1.3 LCD

A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In
this LCD each character is displayed in 5x7 pixel matrix. This LCD has two registers,
namely, Command and Data.The command register stores the command instructions given to
the LCD. A command is an instruction given to LCD to do a predefined task like initializing
it, clearing its screen, setting the cursor position, controlling display etc. The data register
stores the data to be displayed on the LCD. The data is the ASCII value of the character to be
displayed on the LCD.

Fig. 2.3- LCD Display Module

The LCDs have a parallel interface, meaning that the microcontroller has to
manipulate several interface pins at once to control the display. The interface consists of the
following pins:
A register select (RS) pin that controls where in the LCD's memory you're writing
data to. You can select either the data register, which holds what goes on the screen, or an
instruction register, which is where the LCD's controller looks for instructions on what to do
next.
A Read/Write (R/W) pin that selects reading mode or writing mode
An Enable pin that enables writing to the registers
8 data pins (D0 -D7). The states of these pins (high or low) are the bits that you're
writing to a register when you write, or the values you're reading when you read.

16
There's also a display constrast pin (Vo), power supply pins (+5V and
Gnd) and LED Backlight (Bklt+ and BKlt-) pins that you can use to power the LCD,
control the display contrast, and turn on and off the LED backlight, respectively.
The process of controlling the display involves putting the data that form the image of what
you want to display into the data registers, then putting instructions in the instruction register.
The LiquidCrystal Library simplifies this for you so you don't need to know the low-level
instructions.
The Hitachi-compatible LCDs can be controlled in two modes: 4-bit or 8-bit. The 4-
bit mode requires seven I/O pins from the Arduino, while the 8-bit mode requires 11 pins.
For displaying text on the screen, you can do most everything in 4-bit mode, so example
shows how to control a 2x16 LCD in 4-bit mode.
Features of 16×2 LCD module:
 Operating Voltage is 4.7V to 5.3V
 Current consumption is 1mA without backlight
 Alphanumeric LCD display module, meaning can display alphabets and numbers
 Consists of two rows and each row can print 16 characters.
 Each character is build by a 5×8 pixel box
 Can work on both 8-bit and 4-bit mode
 It can also display any custom generated characters
 Available in Green and Blue Backlight

Pin configuration of 16X2 LCD display module:


First two pins of LCD16x2 are used for ground and supply (+5 V).
 Pin 3 - VEE pinThis pin is used for adjusting the contrast of the display. Voltage on
this pin defines contrast on display, lower the voltage, higher the contrast. We can connect
4.7 k pot for contrast adjustment or simply connect this pin to ground to get maximum
contrast.
 Pin 4 –RS: Register Select pin
RS = 0: Data on the D0 to D7 pins is considered as a command.
RS = 1: Data on the D0 to D7 pins is considered as data to display on LCD16x2.
 Pin 5 – RW: Read / Write pin
RW = 0: Write data to the LCD
RW = 1: Read data from the LCD
 Pin 6 –E: EnableThis pin is used to latch the data present on the data pins D0 to D7.
High to low pulse with a minimum width of 450 ns is required to latch the data to the display.
 Pins 7:14 - DATA pins D0 to D7
Data pins are used to send data/command to the LCD16x2 as parallel 8 data bits.
 Pin 15:16 - LED + and LED -
Liquid Crystal Displays don’t have their own light like seven segment displays. Therefore,

17
the module has a backlight LED. Supply to this LED is provided through these pins.

Fig. 2.3.1- LCD display Module Pin COnfiguraton

LCD16x2 Commands:
While interfacing an LCD16x2 with any microcontroller, firstly we need to initialize
theLCD. For that, we need to send some commands. Similarly, to clear the display or for
changing the position we need to send commands. So basically, we can say that LCD16x2 is
controlled by using commands.
Commonly Used LCD16x2 Commands:

Code Execution
Command to LCD
(HEX) Time

0x01 Clear the display screen 1.64ms

18
Shift the cursor right
0x06 40 us
(e.g. data gets written in an incrementing order, left to right)

0x0C Display on, cursor off 40 us

0x0E Display on, cursor blinking 40 us

0x80 Force the cursor to the beginning of the 1st line 40 us

0xC0 Force the cursor to the beginning of the 2nd line 40 us

0x10 Shift cursor position to the left 40 us

0x14 Shift cursor position to the right 40 us

0x18 Shift entire display to the left 40 us

0x1C Shift entire display to the right 40 us

0x38 2 lines, 5x8 matrix, 8-bit mode 40 us

0x28 2 lines, 5x8 matrix,4-bit mode 40 us

0x30 1 line, 8-bit mode 40us

0x20 1 line, 4-bit mode 40us

Table 2.3- LCD 16x2 Commands


Now, while printing a character on LCD16x2, we need to send the ASCII code of that
character to LCD16x2. Suppose, we want to print a character ‘H’ on the LCD, then we
should send 0x48 (ASCII code of ‘H’) data to the LCD16x2. The LCD16x2 has its own
controller, which does the printing job on the LCD16x2.

4-bit Mode Configuration:


Only four GPIO pins are connected to LCD data (D4-D7) pin which helps to save
GPIO pins. By default, LCD16x2 is in 8-bit mode. To use LCD16x2 in 4-bit mode, we need
to send some commands for LCD initialization and configuration. To send these commands
following data formats should follow.

D7 D6 D5 D4 D3 D2 D1 D0

0 0 1 DL N F - -

Table 2.4- LCD Data Pins Configuration

 DL: InterfaceData length


o 0 =4-bit

19
o 1 = 8-bit

 N: Number of display lines

o 0 = 1 line

o 1 = 2 line

 F: Character Font

o 0 = 5x8 dots

o 1 = 5x10 dots

 D1:D0: These bits are set to 0.


 D7:D6: These bits are set to 0.
 D5: This bit should set to 1.

CGRAM:
LCD16x2 has memory space of 64 bytes called as CGRAM (character generator
RAM). It is used to make custom patterns. We just have to write custom pixel values in this
memory space.

20
2.1.4 RFMODULE

The RF module, as the name suggests, operates at Radio Frequency. The


corresponding frequency range varies between 30 kHz & 300 GHz. In this RF system, the
digital data is represented as variations in the amplitude of carrier wave. This kind of
modulation is known as Amplitude Shift Keying (ASK).

Transmission through RF is better than IR (infrared) because of many reasons. Firstly,


signals through RF can travel through larger distances making it suitable for long range
applications. Also, while IR mostly operates in line-of-sight mode, RF signals can travel even
when there is an obstruction between transmitter & receiver. Next, RF transmission is more
strong and reliable than IR transmission. RF communication uses a specific frequency unlike
IR signals which are affected by other IR emitting sources.

21
Fig. 2.4- RF Module

This RF module comprises of an RF Transmitter and an RF Receiver. The


transmitter/receiver (Tx/Rx) pair operates at a frequency of 434 MHz. An RF transmitter
receives serial data and transmits it wirelessly through RF through its antenna connected at
pin4. The transmission occurs at the rate of 1Kbps - 10Kbps.The transmitted data is received
by an RF receiver operating at the same frequency as that of the transmitter.

Pin Description:
RF Transmitter:

Pin
Function Name
No

1 Ground (0V) Ground

2 Serial data input pin Data

3 Supply voltage; 5V Vcc

4 Antenna output pin ANT

Table 2.5- RF Transmitter Pin Configuration

RF Receiver:

Pin
Function Name
No

1 Ground (0V) Ground

2 Serial data output pin Data

3 Linear output pin; not connected NC

4 Supply voltage; 5V Vcc

5 Supply voltage; 5V Vcc

6 Ground (0V) Ground


22
7 Ground (0V) Ground

8 Antenna input pin ANT

Table 2.6- RF Receiver Pin Configuration

2.1.5 SD MODULE

The SD Card Module is a simple solution for transferring data to and from a standard
SD card. The pinout is directly compatible with Arduino, but can also be used with other
microcontrollers. This module has SPI interface which is compatible with any sd card and it
use 5V or 3.3V power supply which is compatible with Arduino UNO/Mega.SD module has
various applications such as data logger, audio, video, graphics.

Fig. 2.5- SD Module

Specification:
 Operating voltage 5V
 SPI Communication method
 SD card Socket
23
 Supports FAT16 and FAT32
 Support 2gb to 4gb
Sd card module is used here to save the audio of message which patient is conveying.
In the receiver section when data signal is received then according tp the received
data signal microntroller performs the tasks i.e. to display the message which the patient is
trying to convey and to play the audio of that message, so the audio which will be played on
the speaker is saved in the sd card. The sd card is inserted in the sd card module, and the sd
card module communicates with the arduino through SPI communication. Through SPI
communication arduino is able to read the audio file saved in the sd card and hence is able to
play it.

Hardware Connections:
The SD Card Module should be connected to Arduino Uno has follows:

SD Card Module Pins Arduino pins


 Vcc 5V
 GND GND
 MOSI Pin 11
 MISO Pin 12
 CLK Pin 13
 CS Pin 4
Table 2.7- SD Card pin confriguration

The pin configuration of sd card is shown in the fig below:

Fig. 2.5.1- SD Card Pin Configuration

24
2.1.6 Speaker

Speakers are transducers that convert electromagnetic waves into sound waves. The
speakers receive audio input from a device such as a computer or an audio receiver. This
input may be either in analog or digital form. Analog speakers simply amplify the analog
electromagnetic waves into sound waves. Since sound waves are produced in analog form,
digital speakers must first convert the digital input to an analog signal, then generate the
sound waves.

Fig. 2.6- Speaker (8ohm 0.5W)

The sound produced by speakers is defined by frequency and amplitude. The


frequency determines how high or low the pitch of the sound is. For example, a soprano
singer's voice produces high frequency sound waves, while a bass guitar or kick drum
25
generates sounds in the low frequency range. A speaker system's ability to accurately
reproduce sound frequencies is a good indicator of how clear the audio will be. Many
speakers include multiple speaker cones for different frequency ranges, which helps produce
more accurate sounds for each range.

2.2 SOFTWARE

The software used here for programming the arduino microcontroller board is
Arduino IDE.The Arduino Integrated Development Environment contains a text editor for
writing code, a message area, a text console, a toolbar with buttons for common functions
and a series of menus. It connects to the Arduino and Genuino hardware to upload programs
and communicate with them.

26
Fig. 2.7- Arduino IDE Software

Writing Sketches:
Programs written using Arduino Software (IDE) are called sketches. These sketches
are written in the text editor and are saved with the file extension .ino. The editor has features
for cutting/pasting and for searching/replacing text. The message area gives feedback while
saving and exporting and also displays errors. The console displays text output by the
Arduino Software (IDE), including complete error messages and other information. The
bottom righthand corner of the window displays the configured board and serial port. The
toolbar buttons allow you to verify and upload programs, create, open, and save sketches, and
open the serial monitor.
 Verify:
Checks your code for errors compiling it.
 Upload :
Compiles your code and uploads it to the configured board. See uploading below for details.
 New :
Creates a new sketch.
 Open :
Presents a menu of all the sketches in your sketchbook. Clicking one will open it within the
current window overwriting its content.
 SerialMonitor :
Opens the serial monitor.

Sketch:
 Verify/Compile :
Checks your sketch for errors compiling it; it will report memory usage for code and
variables in the console area.
 Upload :
Compiles and loads the binary file onto the configured board through the configured Port.
 UploadUsingProgrammer :
This will overwrite the bootloader on the board; you will need to use Tools > Burn
Bootloader to restore it and be able to Upload to USB serial port again. However, it allows
you to use the full capacity of the Flash memory for your sketch. Please note that this
command will NOT burn the fuses. To do so a Tools -> Burn Bootloader command must be
executed.
 ExportCompiledBinary :
Saves a .hex file that may be kept as archive or sent to the board using other tools.
 ShowSketchFolder :
Opens the current sketch folder.
 IncludeLibrary :
Adds a library to your sketch by inserting #include statements at the start of your code. For
more details, see libraries below. Additionally, from this menu item you can access the
Library Manager and import new libraries from .zip files.

27
 AddFile:
Adds a source file to the sketch (it will be copied from its current location). The new file
appears in a new tab in the sketch window. Files can be removed from the sketch using the
tab menu accessible clicking on the small triangle icon below the serial monitor one on the
right side o the toolbar.
 Tools:
 AutoFormat :
This formats your code nicely: i.e. indents it so that opening and closing curly braces line up,
and that the statements inside curly braces are indented more.
 ArchiveSketch :
Archives a copy of the current sketch in .zip format. The archive is placed in the same
directory as the sketch.
 FixEncoding&Reload :
Fixes possible discrepancies between the editor char map encoding and other operating
systems char maps.
 SerialMonitor :
Opens the serial monitor window and initiates the exchange of data with any connected board
on the currently selected Port. This usually resets the board, if the board supports Reset over
serial port opening.
 Board :
Select the board that you're using. Port
This menu contains all the serial devices (real or virtual) on your machine. It should
automatically refresh every time you open the top-level tools menu.
 Programmer :
For selecting a harware programmer when programming a board or chip and not using the
onboard USB-serial connection. Normally you won't need this, but if you're burning a
bootloader to a new microcontroller, you will use this.
 BurnBootloader :
The items in this menu allow you to burn a bootloader onto the microcontroller on an
Arduino board. This is not required for normal use of an Arduino or Genuino board but is
useful if you purchase a new ATmega microcontroller (which normally come without a
bootloader). Ensure that you've selected the correct board from the Boards menu before
burning the bootloader on the target board. This command also set the right fuses.
Sketchbook:
The Arduino Software (IDE) uses the concept of a sketchbook: a standard place to
store your programs (or sketches). The sketches in your sketchbook can be opened from
the File > Sketchbook menu or from the Open button on the toolbar. The first time you run
the Arduino software, it will automatically create a directory for your sketchbook. You can
view or change the location of the sketchbook location from with the Preferences dialog.
Uploading:
Before uploading your sketch, you need to select the correct items from the Tools >
Board and Tools > Port menus.

28
Libraries:
Libraries provide extra functionality for use in sketches, e.g. working with hardware
or manipulating data. To use a library in a sketch, select it from the Sketch > Import
Library menu. This will insert one or more #include statements at the top of the sketch and
compile the library with your sketch. Because libraries are uploaded to the board with your
sketch, they increase the amount of space it takes up. If a sketch no longer needs a library,
simply delete its #includestatements from the top of your code.
.

2.3 INTERFACING

2.3.1 MPU 6050


A microcontroller can communicate with this module using I2C communication
protocol. Various parameters can be found by reading values from addresses of certain
registers using I2C communication.

Fig. 2.8- MPU6050 interfacing with arduino nano

Pin Connections:
29
The MPU6050 comminacates with arduino nano microcontroller using I2C.
The SCL and SDA pins are predefined in arduino nano, A5 is SCl pin and A4 is SDA pin.
The SCl pin of MPU6050 is connected to the A5 of arduino nano and SCI pin is connected to
the A4 of the arduino nano, VCC is connected to +5 volts and GND is connected to GND of
arduino nano and INT of mpu6050 is connected to D2 of arduino nano.

2.3.2 Lcd

The Liquid Crystal Library allows you to control LCD displays that are compatible
with the Hitachi HD44780 driver. There are many of them out there, and you can usually tell
them by the 16-pin interface.
This example sketch shows how to use the display() and noDisplay() methods to turn
on and off the display. The text to be displayed will still be preserved when you use
noDisplay() so it's a quick way to blank the display without losing everything on it

Fig. 2.9- LCD Interfacing with Arduino Uno

.Hardware Required:
 Arduino or Genuino Board

30
 LCD Screen (compatible with Hitachi HD44780 driver)
 pin headers to solder to the LCD display pins
 10k ohm potentiometer
 220 ohm resistor
 hook-up wires
 breadboard
Circuit:
Before wiring the LCD screen to your Arduino or Genuino board we suggest to solder
a pin header strip to the 14 (or 16) pin count connector of the LCD screen, as you can see in
the image above.To wire your LCD screen to your board, connect the following pins:
 LCD RS pin to digital pin 12
 LCD Enable pin to digital pin 11
 LCD D4 pin to digital pin 5
 LCD D5 pin to digital pin 4
 LCD D6 pin to digital pin 3
 LCD D7 pin to digital pin 2
Additionally, wire a 10k pot to +5V and GND, with it's wiper (output) to LCD
screens VO pin (pin3). A 220 ohm resistor is used to power the backlight of the display,
usually on pin 15 and 16 of the LCD connector.

31
2.3.3 RF MODULE

The library used for rf module to communicate with arduino microcontroller is


radiowire.

Transmitter:
The transmitter part consists of Arduino UNO and the 434 MHz Transmitter module.
An external LED can be used but on board LED would be sufficient. The design of the
Transmitter part is as follows.
The RF Transmitter Module consists of 4 – pins: VCC, GND, Data and Antenna. VCC and
GND pins are connected to 5V and ground respectively. The data pin is connected to any of
the digital input / output pin of Arduino. Here, it is connected to Pin 12.The antenna pin must
be connected to an antenna which is nothing but a wire wound in the form of a coil.
We are using the on board LED for demonstration but an external LED along with current
limiting resistor can be used.

32
Fig. 2.10- Transmitter Interfacing with Arduino Uno

Receiver Part:
The receiver part consists of Arduino UNO and the 434 MHz Receiver module. An
external LED can be used along with a current limiting resistor but on board LED would be
sufficient. The design of the Receiver part is as follows.

The RF Receiver Module consists of 4 – pins: VCC, GND, Data and Antenna. VCC and
GND pins are connected to 3.3V pin of the Arduino and ground respectively. The data pin is
connected to Pin 12 of the Arduino. An antenna similar to the transmitter module is
connected to the antenna pin of the 434 MHz Receiver module. The on board LED which is
connected to the 13th pin of Arduino is used in the project although an external LED can
always be used.

Fig. 2.10.1- Receiver Interfacing with Arduino Uno

33
2.3.4 Sd module

This module uses the standard SPI interface for communication, which involve SPI
buses, MISO, MOSI, SCK, and a CS signal pin. through programming, the data can easily be
read and wrote into SD Card by using the Arduino or other microcontrollers.
 CS (chip select)
 SCK (serial clock)
 MOSI (master out slave in)
 VCC (3.3V or 5V)
 GND (ground)

Fig. 2.11- SD Card Module Interfacing with Arduino uno

Pin configuration:

34
 Vcc - 5V
 Gnd - Gnd
 MOSI - pin 11
 MISO - pin 12
 CLK - pin 13
 CS - pin 4
2.3.5 Speaker

The Arduino in the circuit shown below loads the .wav files from the micro-SD card.
It then generates a signal and outputs it through the speaker connected to digital pin 9. This
allows the speaker to create sounds and play audio. In this tutorial, I have programmed the
Arduino audio player to play "Rain Over Me” by Pitbull and Marc Anthony.
The .wav files used in this circuit have a slight limitation in playing audio. Since a transistor
is used as an amplifier, it cannot read complex .wav files. Therefore, the .wav files should be
converted to have these dimensions:

Samples Per second(Hz) 16000

Channel Mono

Bits Per Sample 8

MOSI pin 11 on Arduino Uno

MISO pin 12 on Arduino Uno

CLK pin 13 on Arduino Uno

CS Depends on your SD card shield or module

Table 2.8- Dimensions of .wav audio file


Pin 4 is used here for consistency with this

35
Fig. 2.12 Speaker Interfacing with Arduino Uno
CHAPTER 3. IMPLEMENTATON

The patient/disabled person is told to move his hand in particular direction to


communicate and send a respective message.

Transmitter section:
The accelerometer is placed on the hand of the patient/disabled person, the
accelerometer then detects the motion of the hand of the patient.The motion of the hand is
upward, downward, right tilt and left tilt.

36
Fig. 3.1- Motion of the hand (upward, downward, right tilt and left tilt)
The image shows how accelerometer sensors(MPU6050) takes reading:

Fig. 3.2- Serial Moniter showing readings of MPU6050 sensor


The readi1ng of the accelerometer (i.e. the readings of x-axis, y-axis, z-axis) changes
respective to the motion of the hand, if the reading of any of these axis is equal to or greater than
a particular value then the microcontroller sends the particular data through transmitter.
The transmitter circuit is shown below

Fig. 3.3 Transmitter circuit connections

37
PCB circuit of the transmitter is given below:

Fig. 3.3.1- Transmitter circui


We have programmed the arduino to transmit the signal if the reading of the accelerometer is
as follows:

When the hand is moved upward:


if (gForceX >= 0.2 && gForceY <= 0.4 && gForceY >= -0.4 && gForceX >= -0.4)then ‘1’
is transmitted.
When the hand is moved downward:
If (gForceX <= -0.2 && gForceY <= 0.4 && gForceY >= -0.4 && gForceX <= 0.4)then ‘2’
is transmitted.
When the hand is tilted right:
If (gForceY >= 0.2 && gForceX <= 0.4 && gForceY >= -0.4 && gForceX >= -0.4)then ‘3’
is transmitted.
When the hand is tilted left:
If (gForceY <= -0.2 && gForceX <= 0.4 && gForceY <= 0.4 && gForceX >= -0.4)then ‘4’
is transmitted.
These readings are based on the motion of the hand of the patient, if hand is parallel to the
ground then readings of accelerometer are i.e. the readings of x-axis, y-axis, z-axis are
zero(gForceX = 0 && gForceY = 0 && gForceZ = 0).
Here, gForceX is the reading of x-axis and gForceY is the reading of y-axis.

38
Receiver section:
The receiver side is kept near the person to whom the patient wants to
communicate.The receiver recieves the data transmitted by the transmitter, based on the received
data microcontroller performs the specific task.The task is to display the message that the patient
wants to convey and same audio of the message is played.

Tasks performed according to the message received are as follows:

When ‘1’ is received:


Message displayed – “ I am hungry “
Audio played – “ I am hungry ”
When ‘2’ is received:
Message displayed – “ I am thirsty ”
Audio played – “ I am thirsty “
When ‘3’ is received:
Message received – “ Need help “
Audio played – “ Need help “
When ‘4’ is received:
Message received – “ Not feeling well “
Audio played – “ Not feeling well “
The receiver circuit is shown below:

Fig. 3.4- Receiver circuit


39
Pcb circuit of the receiver is shown below:

Fig. 3.3.4- Receiver circuit

CHAPTER 4. CONCLUSION AND FUTURE SCOPE

This device has made conveyance of message possible only by the motion of a body part.
The ease of message conveyance is the main advantage of this system along with the real time
user defined medicine alarm. By implementing this system a simple device for paralyzed or
disabled people can be achieved without the use of complex form of inputs. The prototype we
have made is fully functional but restricted to a small area of operation. For a large area and
transmission distance the type of communication used have to be more effective and faster. Our
system successfully proves that this system is an excellent approach to be implemented at
hospitals for patient-nurse communication. The project can be further developed into an
automatic wheel chair wherein the wheelchair will be moved just by hand gesture. Also, along
with only message transmission other data like body temperature, pulse rate etc. can also be
transmitted to the nurse so that a real time record of all the patients is maintained.
In this project, the communication with the patient is successfully simulated and verified
interfacing of I/O device like Accelerometer with Arduino Uno Microcontroller.

It is observed that Arduino Uno gives us more efficient I/O interfacing options. Consuming less
power and occupying less space. It is also observed that the cost to the end customers is also less
compare to other microcontroller and microprocessors.
Future scope:

40
We will Interface the voice recording system. We will transfer voice message to the
doctor. The related information is in the form of voice message directly sent to the doctor.
We will also use the Android Application, by using the Arduino application the real time patient’s
health status updates will give to the doctor. Then the doctor will give immediate solutions to the
nurse or on the status of the patient’s health.
We will use the Wi-Fi system for communication. By using Wi-Fi system we will expand the
communication distance. We will transmit and receive message through the long distance.

APPENDIX 1

Code for interfacing of MPU6050 with arduino microcontroller:

For reading the values of accelerometer and gyroscope:

#include <Wire.h>
long accelX, accelY, accelZ;
float gForceX, gForceY, gForceZ;
long gyroX, gyroY, gyroZ;
float rotX, rotY, rotZ;
void setup() {
Serial.begin(9600);
Wire.begin();
setupMPU();
}
41
void loop() {
recordAccelRegisters();
recordGyroRegisters();
printData();
delay(100);
}
void setupMPU(){
Wire.beginTransmission(0b1101000;
AC0 low/high datasheet sec. 9.2)
Wire.write(0x6B);
Wire.write(0b00000000);
Wire.endTransmission();
Wire.beginTransmission(0b1101000);
Wire.write(0x1B);
Wire.write(0x00000000);
Wire.endTransmission();
Wire.beginTransmission(0b1101000);
Wire.write(0x1C);
Wire.write(0b00000000);
Wire.endTransmission();
}
void recordAccelRegisters() {
Wire.beginTransmission(0b1101000);
Wire.write(0x3B);
Wire.endTransmission();
Wire.requestFrom(0b1101000,6);
while(Wire.available() < 6);
accelX = Wire.read()<<8|Wire.read();
accelY = Wire.read()<<8|Wire.read();
accelZ = Wire.read()<<8|Wire.read();
processAccelData();
}
void processAccelData(){
gForceX = accelX / 16384.0;
gForceY = accelY / 16384.0;
gForceZ = accelZ / 16384.0;
42
}
void recordGyroRegisters() {
Wire.beginTransmission(0b1101000);
Wire.write(0x43);
Wire.endTransmission();
Wire.requestFrom(0b1101000,6);
while(Wire.available() < 6);
gyroX = Wire.read()<<8|Wire.read();
gyroY = Wire.read()<<8|Wire.read();
gyroZ = Wire.read()<<8|Wire.read();
processGyroData();
}
void processGyroData() {
rotX = gyroX / 131.0;
rotY = gyroY / 131.0;
rotZ = gyroZ / 131.0;
}
void printData() {
Serial.print("Gyro (deg)");
Serial.print(" X=");
Serial.print(rotX);
Serial.print(" Y=");
Serial.print(rotY);
Serial.print(" Z=");
Serial.print(rotZ);
Serial.print(" Accel (g)");
Serial.print(" X=");
Serial.print(gForceX);
Serial.print(" Y=");
Serial.print(gForceY);
Serial.print(" Z=");
Serial.println(gForceZ);
}

Code for interfacing of LCD display module with arduino microcontroller:

43
#include <LiquidCrystal.h>
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup()
{
lcd.begin(16, 2);
lcd.print("hello, world!");
}
void loop()
{
lcd.noDisplay();
delay(500);
lcd.display();
delay(500);
}

Code for interfacing of Rf Transmitter module with arduino microcontroller:

#include <RH_ASK.h>
#include <SPI.h>
RH_ASK driver;

void setup()
{
Serial.begin(9600);
if (!driver.init())
Serial.println("init failed");
}

void loop(){
const char *msg = "hello";
driver.send((uint8_t *)msg, strlen(msg));
driver.waitPacketSent();
delay(200);
}
44
Code for interfacing of Rf Receiver module with arduino microcontroller:

#include <RH_ASK.h>
#include <SPI.h>
RH_ASK driver;
void setup()
{
Serial.begin(9600);
if (!driver.init())
Serial.println("init failed");
}
void loop()
{
uint8_t buf[RH_ASK_MAX_MESSAGE_LEN];
uint8_t buflen = sizeof(buf);

if (driver.recv(buf, &buflen))
{
int i;
driver.printBuffer("Got:", buf, buflen);
}
}

Code for interfacing of SD card module with arduino microcontroller:

For reading the files that are saved in SD card

#include <SPI.h>
#include <SD.h>
File myFile;

void setup() {
Serial.begin(9600);
while (!Serial) {
;
45
}
Serial.print("Initializing SD card...");
if (!SD.begin(4)) {
Serial.println("initialization failed!");
return;
}
Serial.println("initialization done.");
if (SD.exists("example.txt")) {
Serial.println("example.txt exists.");
} else {
Serial.println("example.txt doesn't exist.");
}
Serial.println("Creating example.txt...");
myFile = SD.open("example.txt", FILE_WRITE);
myFile.close();

if (SD.exists("example.txt")) {
Serial.println("example.txt exists.");
} else {
Serial.println("example.txt doesn't exist.");
}
Serial.println("Removing example.txt...");
SD.remove("example.txt");

if (SD.exists("example.txt")) {
Serial.println("example.txt exists.");
} else {
Serial.println("example.txt doesn't exist.");
}
}
void loop() {
}

Code for interfacing of Speaker with arduino microcontroller:

46
To read the audio file from SD card and play it on speaker

#include "SD.h"
#define SD_ChipSelectPin 4
#include "TMRpcm.h"
#include "SPI.h"

TMRpcm tmrpcm;

void setup(){
tmrpcm.speakerPin = 9;
Serial.begin(9600);
if (!SD.begin(SD_ChipSelectPin)) {
Serial.println("SD fail");
return;
}

tmrpcm.setVolume(6);
tmrpcm.play("rain.wav");
}
APPENDIX 2

Transmitter code:
#include <RH_ASK.h>
#include <SPI.h>
#include <Wire.h>

long accelX, accelY, accelZ;


float gForceX, gForceY, gForceZ;

long gyroX, gyroY, gyroZ;


float rotX, rotY, rotZ;

RH_ASK driver;
// RH_ASK driver(2000, 2, 4, 5);

47
void setup()
{
Serial.begin(9600);

Wire.begin();
setupMPU();

if (!driver.init())
Serial.println("init failed");
}

void loop()
{
recordAccelRegisters();
recordGyroRegisters();
printData();
delay(100);

if(gForceX >= 0.2 && gForceY <= 0.4 && gForceY >= -0.4 && gForceX >= -0.4){
const char *msg = "1";
driver.send((uint8_t *)msg, strlen(msg));
driver.waitPacketSent();
delay(200);
}

if(gForceX <= -0.2 && gForceY <= 0.4 && gForceY >= -0.4 && gForceX <= 0.4){
const char *msg = "2";
driver.send((uint8_t *)msg, strlen(msg));
driver.waitPacketSent();
delay(200);
}

if(gForceY >= 0.2 && gForceX <= 0.4 && gForceY >= -0.4 && gForceX >= -0.4){
const char *msg = "3";
driver.send((uint8_t *)msg, strlen(msg));
driver.waitPacketSent();
48
delay(200);
}

if(gForceY <= -0.2 && gForceX <= 0.4 && gForceY <= 0.4 && gForceX >= -0.4){
const char *msg = "4";
driver.send((uint8_t *)msg, strlen(msg));
driver.waitPacketSent();
delay(200);
}
if(gForceY >= -0.2 && gForceX <= 0.2 && gForceY <= 0.2 && gForceX >= -0.2){
const char *msg = "5";
driver.send((uint8_t *)msg, strlen(msg));
driver.waitPacketSent();
delay(200);
}
}

void setupMPU(){
Wire.beginTransmission(0b1101000); //This is the I2C address of the MPU
(b1101000/b1101001 for AC0 low/high datasheet sec. 9.2)
Wire.write(0x6B); //Accessing the register 6B - Power Management (Sec. 4.28)
Wire.write(0b00000000); //Setting SLEEP register to 0. (Required; see Note on p. 9)
Wire.endTransmission();
Wire.beginTransmission(0b1101000); //I2C address of the MPU
Wire.write(0x1B); //Accessing the register 1B - Gyroscope Configuration (Sec. 4.4)
Wire.write(0x00000000); //Setting the gyro to full scale +/- 250deg./s
Wire.endTransmission();
Wire.beginTransmission(0b1101000); //I2C address of the MPU
Wire.write(0x1C); //Accessing the register 1C - Acccelerometer Configuration (Sec. 4.5)
Wire.write(0b00000000); //Setting the accel to +/- 2g
Wire.endTransmission();
}

void recordAccelRegisters() {
Wire.beginTransmission(0b1101000); //I2C address of the MPU
Wire.write(0x3B); //Starting register for Accel Readings
49
Wire.endTransmission();
Wire.requestFrom(0b1101000,6); //Request Accel Registers (3B - 40)
while(Wire.available() < 6);
accelX = Wire.read()<<8|Wire.read(); //Store first two bytes into accelX
accelY = Wire.read()<<8|Wire.read(); //Store middle two bytes into accelY
accelZ = Wire.read()<<8|Wire.read(); //Store last two bytes into accelZ
processAccelData();
}

void processAccelData(){
gForceX = accelX / 16384.0;
gForceY = accelY / 16384.0;
gForceZ = accelZ / 16384.0;
}

void recordGyroRegisters() {
Wire.beginTransmission(0b1101000); //I2C address of the MPU
Wire.write(0x43); //Starting register for Gyro Readings
Wire.endTransmission();
Wire.requestFrom(0b1101000,6); //Request Gyro Registers (43 - 48)
while(Wire.available() < 6);
gyroX = Wire.read()<<8|Wire.read(); //Store first two bytes into accelX
gyroY = Wire.read()<<8|Wire.read(); //Store middle two bytes into accelY
gyroZ = Wire.read()<<8|Wire.read(); //Store last two bytes into accelZ
processGyroData();
}

void processGyroData() {
rotX = gyroX / 131.0;
rotY = gyroY / 131.0;
rotZ = gyroZ / 131.0;
}

void printData() {
Serial.print("Gyro (deg)");
Serial.print(" X=");
50
Serial.print(rotX);
Serial.print(" Y=");
Serial.print(rotY);
Serial.print(" Z=");
Serial.print(rotZ);
Serial.print(" Accel (g)");
Serial.print(" X=");
Serial.print(gForceX);
Serial.print(" Y=");
Serial.print(gForceY);
Serial.print(" Z=");
Serial.println(gForceZ);
}

Receiver code:
#include <RH_ASK.h>
#include <SPI.h>
#include <VirtualWire.h>
#include <LiquidCrystal.h>
#include <SD.h>
#define SD_ChipSelectPin 4
#include <TMRpcm.h>
TMRpcm tmrpcm;
const int rs = 8, en = 10, d4 = 6, d5 = 5, d6 = 7, d7 = 3;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
boolean x = false;
RH_ASK driver;
void audio1(){
tmrpcm.play("11.wav");
x = true;
}
void audio2(){
tmrpcm.play("22.wav");
x = true;
}
51
void audio3(){
tmrpcm.play("33.wav");
x = true;
}
void audio4(){
tmrpcm.play("44.wav");
x = true;
}
void upward(){
lcd.setCursor(0, 0);
lcd.print(" I AM HUNGRY ");
lcd.setCursor(0, 1);
lcd.print("________________");
delay(500);
}
void downward(){
lcd.setCursor(0, 0);
lcd.print(" I AM THIRSTY ");
lcd.setCursor(0, 1);
lcd.print("________________");
delay(500);
}
void right(){
lcd.setCursor(0, 0);
lcd.print(" NEED HELP ");
lcd.setCursor(0, 1);
lcd.print("________________");
delay(500);
}
void left(){
lcd.setCursor(0, 0);
lcd.print("NOT FEELING WELL");
lcd.setCursor(0, 1);
lcd.print("________________");
delay(500);
}
52
void clearLCD(){
lcd.clear();
}
void setup()
{
Serial.begin(9600); // Debugging only
tmrpcm.speakerPin = 9;
lcd.begin(16, 2);

if (!driver.init()){
Serial.println("init failed");
}
if (!SD.begin(SD_ChipSelectPin)) {
Serial.println("SD fail");
return; // don't do anything more if not

}
else{
Serial.println("SD ok");
}
}

void loop()
{
uint8_t buf[RH_ASK_MAX_MESSAGE_LEN];
uint8_t buflen = sizeof(buf);

if (driver.recv(buf, &buflen)) // Non-blocking


{
int i;
for (i = 0; i < buflen; i++){
if(buf[i] == '1') {
upward();
if(x == false){ audio1();}
}
if(buf[i] == '2'){
53
downward();
if(x == false){ audio2();}
}
if(buf[i] == '3'){
right();
if(x == false){ audio3();}
}
if(buf[i] == '4') {
left();
if(x == false){ audio4();}
}
if(buf[i] == '5'){
clearLCD();
x = false;
}
}
}
}
REFRENCES

[1] Shreedeep Gangopadhyay; Somsubhra Mukherjee; Soumya Chatterjee, Intelligent gesture


controlled wireless wheelchair for the physically handicapped, Proceedings of Fifth IRAJ
International Conference, 15th September 2013, Pune, India
https://www.pjrc.com/teensy/td_libs_Time.htm

[2] Ronald Arroyo, B .E .E .E. Clinical Engineer, control and communication devices for the
severely disabled, Bioengineering Research Service Veterans Administration Prosthetics Centre
252 Seventh Avenue New York, New York 10001
http://playground.arduino.cc/Code/DateTime

[3] YVONNE MAY NOLAN B.E., control and communication for physically disabled people,
based on vestigial signals from the body

[4] D. Vishnu Vardhan1 , P. Penchala Prasad, Hand Gesture Recognition Application for
Physically Disabled People, International Journal of Science and Research (IJSR), Volume 3
Issue 8, August 2014
http://www.makeuseof.com/tag/how-and-why-to-add-a-real-time-clock-to-arduino/

54
55

Vous aimerez peut-être aussi