Professional Documents
Culture Documents
BUPE KIBONA PROJECT Biomedical 2020
BUPE KIBONA PROJECT Biomedical 2020
Project report submitted as partial fulfillment of the requirements for the Diploma in
Electrical and Biomedical Engineering.
Date 2020
i
DECLARATION
I declare that this project is my own work and all the contents presented are original
except which stated by the references and that the same work has not been submitted for
award of Ordinary Diploma.
Signature …………………………
Candidate name BUPE T KIBONA
Date 2015/2016
Signature …………………………
Supervisor name Mr. MASUD MBELWA
Date ………………………….
i
CERTIFICATION
This certifies that the accompanying dissertation by BUPE KIBONA has been accepted
in partial fulfillment of the requirement for the Diploma in electrical and biomedical
engineering at Arusha technical college.
………………………. …………………..
MR.MASUD MBELWA Date.
ii
DEDICATION
I dedicate this project work to my family and friends who have supported me throughout
the process. I will always appreciate all they have done, without their caring and support
it would not have been possible.
iii
ACKNOWLEDGMENT
There are many people who have helped me directly or indirectly in the successful
completion of my project. I would like to take this opportunity to thank one and all. First
of all I would like to express my deep sense of gratitude towards my project supervisor
Mr. Masudi Mbelwa, for always being available whenever I require his guidance as well
as for motivating me throughout the project work.
I am also grateful to Mr. Daniel Wilson for his invaluable guidance during my project. I
would like to express my deep gratitude towards teaching and nonteaching staff for
giving their invaluable suggestions and co operations for doing my project.
I would like to thank all my friends for their help and constructive criticism during my
project period.
Finally, I am very much indebted to my parents for their moral support and
encouragement to achieve higher goals. I have no words to express my gratitude and still
I am very thankful to my parents who have shown me this world and for every support
they gave me.
iv
ABSTRACT
The aim of the project was to design a microcontroller based automated Body Mass
Index (BMI)calculator with LCD display, which calculates the body mass index using
the two basic parameters that are weight and height. The hardware of the project consists
of a load cell or a weighing mechanism, which is used to calculate the body weight of a
person, and a built in height calculating mechanism, which is used to calculate the height
of a person. The weight of the person is calculated in Kilograms and the height in meters
in accordance of the BMI standard formula. The microcontroller based automated Body
Mass Index calculator is a useful device when it comes to controlling your weight and
maintaining a healthy lifestyle. The calculated weight of the person through load cell,
converts the mechanical force into electrical signals that can be easily obtain after
processing through microcontroller. While the height of the person is calculated by the
ultrasound sensor with built-in transmit and receive circuitry as when it transits the
ultrasound signal by transmitter, it reflect back to the receiver after striking the object or
person and height is then calculated by multiplying the speed of the ultrasound signal
and the time taken by the it to return back to the sensor. All this data is manipulated
through microcontroller and then the result is displayed on the LCD display.
v
TABLE OF CONTENTS
DECLARATION.......................................................................................................................................... i
CERTIFICATION ...................................................................................................................................... ii
DEDICATION............................................................................................................................................ iii
ACKNOWLEDGMENT ........................................................................................................................... iv
ABSTRACT ................................................................................................................................................. v
LIST OF ABBREVIATION.................................................................................................................... viii
LIST OF FIGURES ................................................................................................................................... ix
CHAPTER ONE ......................................................................................................................................... 1
1.1. INTRODUCTION........................................................................................................................... 1
1.2. problem statement .......................................................................................................................... 1
1.3. OBJECTIVES ................................................................................................................................. 2
1.3.1 Main objectives................................................................................................................................... 2
1.3.2 Specific objectives .............................................................................................................................. 2
1.4 SIGNIFICANCE OF THE PROJECT ............................................................................................... 2
CHAPTER TWO ........................................................................................................................................ 3
2.0 LITERATURE REVIEW .................................................................................................................... 3
2.1 EXISTING SYSTEM............................................................................................................................ 3
2.1.1 BLOCK DIAGRAM OF EXSITING SYSTEM .............................................................................. 3
2.1.2 DISADVANTAGE OF EXISTING SYSTEM ................................................................................. 3
2.2 PROPOSED SYSTEM ......................................................................................................................... 3
2.2.1 BLOCK DIAGRAM OF PROPOSED SYSTEM ........................................................................... 4
2.2.2 SIGNIFICANCE OF THE PROPOSED SYSYTEM ..................................................................... 4
2.3 HARDWARE PARTS OF PROPOSED SYSTEM ............................................................................ 4
2.3.1 ULTRASONIC SENSOR .................................................................................................................. 4
2.3.2 CONTROLLER ................................................................................................................................. 5
2.3.3 16x2 LCD Module .............................................................................................................................. 6
2.3.4 BUZZER ............................................................................................................................................. 7
2.3.4.1 Buzzer Features and Specifications .................................................................................................. 8
2.3.5 LIGHT EMITTING DIODE (LED) ................................................................................................. 8
2.3.6 LOAD CELL ...................................................................................................................................... 8
2.3.7 BUTTONS .......................................................................................................................................... 9
CHAPTER THREE .................................................................................................................................. 10
vi
3.1 METHODOLOGY ............................................................................................................................. 10
3.1 Literature review ................................................................................................................................ 10
3.2 Data Collection .................................................................................................................................... 10
3.3 Data Analysis ....................................................................................................................................... 10
3.4 System Design and Simulation ........................................................................................................... 10
3.5 Building Prototype .............................................................................................................................. 11
3.6 Prototype testing ................................................................................................................................. 11
3.7 Report Writing .................................................................................................................................... 11
CHAPTER FOUR ..................................................................................................................................... 12
4.1 DATA COLLECTION ....................................................................................................................... 12
4.2. Introduction of Data Collection ................................................................................................... 12
4.2.1. Primary Data Collection........................................................................................................... 12
4.2.2. Secondary Data Collection ....................................................................................................... 12
4.2.3. TECHINICAL DATA .............................................................................................................. 14
CHAPTER FIVE ...................................................................................................................................... 15
5.1 DATA ANALYSIS .............................................................................................................................. 15
5.1.1 Microcontroller Unit (MCU)........................................................................................................... 15
5.1.2 Liquid Crystal (LCD) 16x2 ............................................................................................................ 16
5.1.4 Load cell sensor (5kg) ...................................................................................................................... 17
5.1.5 Ultrasonic sensor .............................................................................................................................. 18
5.1.6 Buzzer................................................................................................................................................ 19
5.1.7 POWER SUPPLY ............................................................................................................................ 20
5.1.8. Linear power supply design: .................................................................................................... 21
CHAPTER SIX ......................................................................................................................................... 22
6.1. RESULTS ...................................................................................................................................... 22
CHAPTER SEVEN ................................................................................................................................... 23
7.1. CONCULUSON AND RECOMMENDATION ......................................................................... 23
APPENDEX ............................................................................................................................................... 24
SOURCE CODE ....................................................................................................................................... 24
REFERENCES ........................................................................................................................................... 32
vii
LIST OF ABBREVIATION
MCU– MICROCONTROLLER
viii
LIST OF FIGURES
Figure 1 block diagram of existing system ..................................................................................... 3
Figure 2 block diagram of proposed system ................................................................................... 4
Figure 3 figure of Ultrasonic sensor............................................................................................... 5
Figure 4 general View of Atmega 328p .......................................................................................... 6
Figure 5 General View of LCD ....................................................................................................... 7
Figure 6 General View of Buzzer ................................................................................................... 7
Figure 7 General view of LED ........................................................................................................ 8
Figure 8 View of load cell ............................................................................................................... 9
Figure 9 View of keypad ................................................................................................................. 9
Figure 10 buzzer switching circuit................................................................................................ 19
Figure 11 circuit diagram of automatic BMI calculator .............................................................. 21
Figure 12 circuit simulation of automatic BMI calculator ........................................................... 22
ix
CHAPTER ONE
1.1. INTRODUCTION
Body Mass Index (BMI) can approximately calculate the total fats of the person present
in the body. It is based on the two variables such as the height and the weight of the
person. The most common way of calculating it is by dividing ones ‘mass in kilograms
or pounds by the square of the stature in meters or inches. Present BMI calculators are
based on the BMI-for-age chart that contains the height, the weight, and the age brackets
in determining the approximate BMI value and it classification.
As technology rises, online BMI calculators became available through the internet. This
requires the height and the weight of the user, and some asks for age and gender too.
After filling up the information’s needed, just click the calculate button and then the
BMI will be determined. To find out the BMI classification (underweight, normal,
overweight and obese), there is a reference chart wherein the range of the designated
category will be based. Because of this, manual calculation can now be eliminated.
1
1.3. OBJECTIVES
2
CHAPTER TWO
2.0 LITERATURE REVIEW
In this part will explain about existing system and proposed system by using reference of
block diagram
2.1 EXISTING SYSTEM
The existing system of BMI is measured locally by nurses whereby they measure
separate weight by using weight scale then take the reading also they measure height by
using stadiometer and take the record and finally calculate BMI manually, this system
consume more time and may lead to loss of information of patient
2.1.1 BLOCK DIAGRAM OF EXSITING SYSTEM
3
2.2.1 BLOCK DIAGRAM OF PROPOSED SYSTEM
4
Figure 3 figure of Ultrasonic sensor
To generate the ultrasonic wave, ultrasonic sensor uses a vibrating device known as a
transducer to emit ultrasonic pulses that travel in a cone-shaped beam. The range of an
ultrasonic sensor is determined by the frequency of vibration of the transducer.
Ultrasonic sensors work best when positioned in front of materials that readily reflect
ultrasonic waves, such as metal, plastic and glass. This enables the sensor to give an
accurate reading at a greater distance from the object in front of it. However, when the
sensor is placed in front of an object that readily absorbs ultrasonic waves, such as fiber
material, the sensor must move closer to the object to give an accurate reading. The
angle of the object also has an impact on the accuracy of the reading, with a flat surface
at a right angle to the sensor offering the longest sensing range. This accuracy decreases
with a change in the angle of an object in relation to the sensor.
2.3.2 CONTROLLER
This is the processing system which sends out information to the output according to the
instructions and signal received.
5
Figure 4 general View of Atmega 328p
Description:
i. Microcontroller Atmel ATmega328
ii. Operating voltage of 5V
iii. Maximum supply voltage 6 to 20V
iv. Digital I/O pins 14 (of which 6 provide PWM output)
v. DC current per I/O pin 40 mA
vi. DC current for 3.3V pin 50 mA
vii. Flash memory 32KB of which 0.5KB is used by Boot loader
viii. SRAM 2KB, EEPROM 1KB
In this project Atmega will be used because
i. Number of pin required.
ii. It is simple to program, and to interface with other components.
iii. Availability.
iv. It is less cost fully
6
LCD modules are very commonly used in most embedded projects, the reason being its
cheap price, availability and programmer friendly. LCD is named so because; it has 16
Columns and 2 Rows.
2.3.4 BUZZER
This is the alerting system when BMI of patient is underweight or overweight, it will
provide a beep sound together with an LCD it will the BMI value.
7
2.3.4.1 Buzzer Features and Specifications
Rated Voltage: 5V DC
8
Figure 8 View of load cell
2.3.7 BUTTONS
Is input device in microprocessor application which will be used to enter gender, age
also to start a device to work
9
CHAPTER THREE
3.1 METHODOLOGY
This chapter contains descriptions about different methods to be taken in order to
accomplish this project. The following are the descriptions about methods which will be
undertaken in order to fully address the objectives of this project.
i. Literature Review
ii. Data collection
iii. Data analysis
iv. Simulation
v. Building prototype
vi. Testing the prototype
vii. Report writing
10
3.5 Building Prototype
It involves building of the prototype so as to implement the system. In this section the
electronic components and power supply are all placed under a single board in order to
come with a prototype for a proposed system.
11
CHAPTER FOUR
12
Through data collected I get to know that if your BMI is:
Below 18.5- underweight range
Between 18.5 and 25-normal weight range
Between 25 and 30-ovrweight range
Greater 30-obese range
GRAPH TO SHOW STANDARD BMI VALUE
13
4.2.3. TECHINICAL DATA
The technical data was obtained through literature review, reading books and internet
browsing. Which help in description of components to be used in the project in terms of
costs, affordability and how to interface with the circuit
14
CHAPTER FIVE
15
5.1.2 Liquid Crystal (LCD) 16x2
Liquid Crystal display module will be used to display an output of the system sent from
microcontroller
LCD modules are very commonly used in most embedded projects because it’s cheap in
price, availability, it easy to program. LCD is named so because; it has 16 Columns and
2 Row
16
Features of 16×2 LCD module
i. Operating Voltage is 4.7V to 5.3V
ii. Current consumption is 1mA without backlight
iii. Alphanumeric LCD display module, meaning can display alphabets and numbers
iv. Consists of two rows and each row can print 16 characters
v. It can also display any custom generated characters
Excitation voltage is a known constant and output voltage is variable depending on the
shape of the strain gauges. If all resistors are balanced, meaning then is zero. If the
resistance in even one of the resistors changes, then will likewise change. The change
in can be measured and interpreted using Ohm's law. Ohm's law states that the current
(measured in amperes) running through a conductor between two points is directly
proportional to the voltage across the two points. Resistance (measured in Ohms) is
introduced as the constant in this relationship,
17
When applied to the 4 legs of the Wheatstone bridge circuit, the resulting equation is:
Vout = [(R3/(R3+R4) - R2/(R1+R2))] *Vin
Reason to use 20 kg load cell
It’s less expensive
Availability
Affordability
18
5.1.6 Buzzer
Is the device that used to alert something. In the proposed system buzzer is used for
alerting when BMI of patient is underweight or overweight, it will provide a beep sound
together with an LCD it will display the BMI value. It is very small and compact 2-pin
structure hence can be easily used on PCBs, It’s less expensive, it available and
affordable.
Buzzer can be used by simply powering it using a DC power supply ranging from 4V to
9V. A simple 9V battery can also be used, but it is recommended to use a regulated +5V
or +6V DC supply. The buzzer is normally associated with a switching circuit to turn
ON or turn OFF the buzzer at required time and require interval.
Microcontroller can deliver maximum current of 20mA but the load (buzzer) need
40mA Therefore a switching circuit based on transistor 2n222 was designed
i.e. (𝛽𝐷𝐶 = 100) is selected. This is because there is more than enough base current to
saturate the transistor. Selecting a base resistance,
𝑅𝐵 = 1 kΩ and taking 𝑉𝐵𝐸 = 0.7 V, from the base loop,
𝑉𝐵𝐵 = 𝐼𝐵𝑅𝐵 + 𝑉𝐵𝐸
𝐼𝐵 = (𝑉𝐵𝐵 − 𝑉𝐵𝐸) / 𝑅𝐵
= (5 – 0.7) V / 1 kΩ
= 0.43 mA
19
Thus,
𝐼𝐶 = 𝛽𝐷𝐶 𝐼𝐵 (2)
= 10 0x 0.43 mA
= 43 mA
Therefore, we can deliver 40mA by switching external power supply
20
5.1.8. Linear power supply design:
The transformer in Fig 1 has a single input and a single output. The output will be rated
for voltage and current (Ex: 12VAC @ 2A). Note: 12VAC is the RMS voltage. The
peak voltage is 12*1.41 = 17V and the peak-to-peak voltage is 34V. The input will have
a voltage rating (usually and 240V for Europe). The input current depends on the output
current. Energy is conserved. Ex: with an output of 12V@2A a 240V input would draw
2A.
21
CHAPTER SIX
6.1.RESULTS
This section deals with the testing, evaluation and assembling of components in relation
to the design circuit. In order to verify the correct functionality of the system, all
components were tested individually and each of the sub unit was built on the board and
monitored before it was finally transformed to main construction board. This was done
in order to verify its workability. The entire circuit was arranged logically according to
design specification. The project was implemented using suitable component obtained
from the design. The complete circuit diagram of the an automatic based microcontroller
body mass index calculator is shown in Figure 10. The Controller Unit (MCU)
ATmega328. is used to suit the design. This was selected base on the function it
performs and the number of pins it has. The written program was burned into
Microcontroller Unit (MCU) ATmega328 . Power supply of 5V was also design for
powering the circuit. The component was first tested on the breadboard before
transferring the Vero board for the soldering.
The results of the various tests performed above suggested that the system sub-units are
effectively designed and when coupled will give a satisfactory result as with regard to
the system as a whole.
22
CHAPTER SEVEN
23
APPENDEX
SOURCE CODE
#include <LiquidCrystal.h>
#include <SPI.h>
#include <SD.h>
#include <Wire.h>
LiquidCrystal lcd(8,9,10,11,12,13);
#define Buzzer 5
#define trigPin 7
#define echoPin 6
#define Button A2
const int chipSelect = 4;
const int analogInPin = A5; // Analog input pin, connected to pressure sensor
const int analogButton = A0; // Button
//Variables to change
float inputVolt = 0; // Voltage read from pressure sensor (in bits, 0 to 1023)
float volt_0 = 2.5; //Initial voltage
float volt = 0; // Voltage (converted from 0-255 to 0-5)
float pressure_psi = 0; // Pressure value calculated from voltage, in psi
float pressure_pa = 0; // Pressure converted to Pa
float massFlow = 0; // Mass flow rate calculated from pressure
float volFlow = 0; // Calculated from mass flow rate
float volume = 0; // Integral of flow rate over time
//Constants
float vs = 5 ; // Voltage powering pressure sensor
float rho = 1.225; // Density of air in kg/m3
float area_1 = 0.000415; // Surface area in m2
float area_2 = 0.0000283; // Surface area in m2
float dt = 0;
24
int button =9; // Value of button
const char Vol[]={"Volumes"};
//Initialize the library with the numbers of the interface pins
//LiquidCrystal lcd(8,9,10,11,12,13);
float mass,H,BMI,value;
char sClr=0,sCrn=0,Key=0,i;
int Counter, age;
int duration, distance; //to measure the distance and time taken
void setup() {
//Configuration
pinMode(Button,INPUT);
pinMode(Buzzer,OUTPUT);
pinMode(trigPin,OUTPUT);
pinMode(echoPin,INPUT);
digitalWrite(Buzzer,LOW);
lcd.begin(16, 2);
Serial.begin(9600);
//Initiallization
lcd.setCursor(0, 0);
lcd.print("Configuring..");
lcd.setCursor(0, 1);
for(char i=0;i<10;i++){
lcd.print('.');
delay(100);
}
lcd.print("OK");
delay(100);
lcd.clear();
}//Setup function
//Main function
25
void loop() {
//********Sensor reading and quantization ********
//********Display ********
if(sCrn<4){
if(sClr!=1)
lcd.clear();
sClr=1;
lcd.setCursor(0, 0);
lcd.print("press reset");
lcd.setCursor(0, 1);
lcd.print("for new ID");
delay(50);
}else{
if(sClr!=2)
lcd.clear();
sClr=2;
lcd.setCursor(1,0);
lcd.print("**WELCOME.**");
lcd.setCursor(0,1);
lcd.print("Press # for set.");
delay(50);
lcd.setCursor(0,2);
}sCrn++;
if(sCrn>6)
sCrn=0; //********Display ********
//LOGIC
//Button press
ButtonP();
if(Key==1){
Key=0;
26
lcd.clear();
sClr=3;
lcd.setCursor(1,0);
lcd.print("ENTER ID NUMBER");
lcd.setCursor(0,1);
lcd.write(126);
lcd.setCursor(2,1);
lcd.print("2020");
lcd.setCursor(6,1);
lcd.print(Counter);
while(1){
ButtonP();
if(Key==2){
Counter++;
if(Counter>=200)
Counter=200;
lcd.setCursor(6,1);
lcd.print(Counter);Key=0;
delay(50);
}else if(Key==3){
Counter--;
if(Counter<=0)
Counter=0;
lcd.setCursor(6,1);
lcd.print(Counter);Key=0;
delay(200);
}else if(Key==1)
break;
}delay(50);
lcd.clear(); Key=0;
27
for(i=1;i<=1;i++){
Key=0;
lcd.print("ENTER AGE: ");
lcd.print(i);
lcd.setCursor(0,1);
lcd.print("> ");
lcd.setCursor(3,1);
while(1){
ButtonP();
if(Key==2){
age++;
if(age>=100)
age=100;
if(Key==3){
age--;}
Key=0
lcd.setCursor(3,1);
if(age<0) age=0;
lcd.print(age);
delay(50);
}else if(Key==1)
break;
}
//button = analogRead(analogButton);
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
28
// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);
// Calculating the distance
distance= duration*0.034/2;
H=distance/100;
value=analogRead(A1);
mass=map(value,0,1024,0,150);
BMI=mass/(H*H)
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);
// Calculating the distance
distance= duration*0.034/2;
H=distance/100;
value=analogRead(A3);
mass=map(value,0,1024,0,150);
BMI=mass/(H*H);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("BMI =");
lcd.print(BMI);
lcd.print("Kg/M2");
delay(1000);
} Key=0;
}
29
delay(50);//Button press
}
void ButtonP(){
int Volt=analogRead(Button);
if(Volt>300){
digitalWrite(Buzzer,HIGH);
delay(300);
digitalWrite(Buzzer,LOW);
if(Volt>900) Key=1;
else if(Volt>400) Key=2;
else Key=3;
}
}//Button press
30
31
REFERENCES
Mei Z, Grummer-Strawn LM, Pietrobelli A, Goulding A, Goran MI, Dietz WH. Validity
of body mass index compared with other bodycomposition screening indexes for the
assessment of body fatness. American Journal of Clinical Nutrition 2002; 7:597–985.
BMI Formula: An Overview, Using the Metric System. Written by/reviewed by: Arthur
Schoenstadt, MD
Michael Snyder, M.D. (2010). A Life without Dieting. Hay House, Inc.
32