Académique Documents
Professionnel Documents
Culture Documents
DECLARATION
We hereby declare that submitted is our own work and that, to the best of our
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.
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.
Date:
iii
ACKNOWLEDGEMENT
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
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
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
viii
List of figures
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
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:
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.
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.
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)
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.
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.
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.
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
14
- When device placed on flat surface it will measure 0g on X and Y axis and +1g on Z axis.
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.
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
17
the module has a backlight LED. Supply to this LED is provided through these pins.
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
18
Shift the cursor right
0x06 40 us
(e.g. data gets written in an incrementing order, left to right)
D7 D6 D5 D4 D3 D2 D1 D0
0 0 1 DL N F - -
19
o 1 = 8-bit
o 0 = 1 line
o 1 = 2 line
F: Character Font
o 0 = 5x8 dots
o 1 = 5x10 dots
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
21
Fig. 2.4- RF Module
Pin Description:
RF Transmitter:
Pin
Function Name
No
RF Receiver:
Pin
Function Name
No
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.
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:
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.
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
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
.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
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.
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)
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:
Channel Mono
35
Fig. 2.12 Speaker Interfacing with Arduino Uno
CHAPTER 3. IMPLEMENTATON
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:
37
PCB circuit of the transmitter is given below:
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.
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
#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);
}
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);
}
#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);
}
}
#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() {
}
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>
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);
[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