You are on page 1of 42

ARUSHA TECHNICAL COLLEGE

DEPARTMENT OF ELECTRICAL ENGINEERING

AUTOMATIC BODY MASS INDEX CALCULATOR

Project report submitted as partial fulfillment of the requirements for the Diploma in
Electrical and Biomedical Engineering.

Author’s name: Bupe T Kibona

Author’s admission number: 17030602009

Program attended: Biomedical

Supervisor’s name: Mr. Masudi Mbelwa

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

LCD – LIQUID CRYSTAL DISPLAY

MCU– MICROCONTROLLER

LEDs– LIGHT EMITTING DIODE

BMI–BODY MASS INDEX

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.2. problem statement


Recently, BMI is measured locally by nurses whereby they measure 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.
But these automatic BMI calculator it will measure both weight and height then
automatically calculate the BMI of a patient also store and display the parameter on
LCD. Hence, solving the problem of time consuming, manual calculation and loss of
data

1
1.3. OBJECTIVES

1.3.1 Main objectives


To design and develop a Microcontroller based automated Body Mass Index Calculator.
1.3.2 Specific objectives
i. To design a Microcontroller based BMI calculator with notification
through buzzer and LEDs by means of a microcontroller
ii. To test and assess the accuracy, reliability and functionality of the device
including every parts and components use
iii. To design and stimulate the designed circuit
1.4 SIGNIFICANCE OF THE PROJECT
i. It will save time consuming, because the device perform all functions that
were supposed to be performed by human
ii. It will store parameters permanently
iii. It will help doctors to improve their working with more efficiency
iv. Its inexpensiveness and easy of calculating health risks related to obesity

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

Figure 1 block diagram of existing system

2.1.2 DISADVANTAGE OF EXISTING SYSTEM


 It consume time
 It lead to loss of information of patient
 Manual calculation of BMI
2.2 PROPOSED SYSTEM
The proposed system of automatic BMI calculator it will measure both weight and
height at once then automatically calculate the BMI of a patient and display the
parameter on LCD Hence, solving the problem of time consuming and loss of data since
data will stored on memory

3
2.2.1 BLOCK DIAGRAM OF PROPOSED SYSTEM

Figure 2 block diagram of proposed system

2.2.2 SIGNIFICANCE OF THE PROPOSED SYSYTEM


1. It will save time consuming, because the device perform all functions that were
supposed to be performed by human
2. It will store parameters permanently
3. It will help doctors to improve their working with more efficiency
4. Its inexpensiveness and easy of calculating health risks related to obesity

2.3 HARDWARE PARTS OF PROPOSED SYSTEM

2.3.1 ULTRASONIC SENSOR


Ultrasonic sensor is an electronic device that emits an acoustic wave beyond the upper
range of human hearing called the audible range ( 20 hertz to 20 kilohertz), and
determines the distance between the sensor and an object based on the time it takes to
send the signal and receive the echo.

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

2.3.3 16x2 LCD Module


Liquid Crystal display module are used to display an output of the system, the output
displayed are in both numerical value and alphabetical or readable words.

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.

Figure 5 General View of LCD


2.3.3.1 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
 It can also display any custom generated character

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.

Figure 6 General View of Buzzer

7
2.3.4.1 Buzzer Features and Specifications
 Rated Voltage: 5V DC

 Operating Voltage: 4-8V DC


 Rated current: <30mA
 Sound Type: Continuous Beep
 Resonant Frequency: ~50 Hz

2.3.5 LIGHT EMITTING DIODE (LED)


Is a semiconductor light source that emits light when current flow through it. It’s an
indication system to show that patient weight is overweight or underweight. It will emit
light when buzzer provide beep sound

Figure 7 General view of LED

2.3.6 LOAD CELL


Is a transducer which is used to convert mechanical force into a measurable electrical
output, anything which needs to be weighed probably uses a load cell.

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

Figure 9 View of keypad

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

3.1 Literature review


This method provides a knowledge for the project since it gives the introduction
knowledge of many project performed before. It involves the study of the existing
systems, their working principles, operation, as well as advantages and disadvantages.

3.2 Data Collection


This involves collection of data to be used for accomplishment of the designing of the
intended device. These data will be used to obtain the design parameters and
components of the system.

3.3 Data Analysis


This section includes analysis of the collected data which will be used in the design to
come up with suitable values of components, integrated circuits together with power
supplies for the proposed system.

3.4 System Design and Simulation


This involves the designing of required circuit of the proposed system. It also contains
simulation of the system in order to observe the result before implementing the complete
circuit prototype.

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.

3.6 Prototype testing


After the prototype building the system is to be tested so as see if it works as how it is
intended to do. Under this section the prototype will be subjected to real phenomenon
condition to see if the desired outputs are produced as required.

3.7 Report Writing


The report will finally be written to explain what have been done from the start of the
project to the end of it showing clearly what have been real achieved.

11
CHAPTER FOUR

4.1 DATA COLLECTION

4.2. Introduction of Data Collection


Data collection is the process of gathering and measuring information on variables of
interest, in an established systematic fashion that enables one to answer stated research
questions, test hypotheses, and evaluate outcome

4.2.1. Primary Data Collection


Primary data are collected from hospital which is ST.ELIZABETH HOSPITAL.
Currently at ST ELIZABETH HOSPITAL, BMI is measured locally by nurses whereby
they measure separate weight by using weight scale also they measure height by using
stadiometer and take the record, finally they calculate BMI manually, this system
consume more time and may lead to loss of information of patient so through that I came
up with idea of designing AUTOMATIC BODY MASS INDEX CALCULATOR which
will eliminate complication in manual calculation of BMI.

4.2.2. Secondary Data Collection


Secondary data are collected using three main methods
i. Observations
Data collected by this method including observing on how BMI is obtained by using two
device weight scale and stadiometer in hospital
ii. Questioners
Data collated by asking oral questions to hospital staff members especially in reception
area who are found to be the first front liner users of weight scale and stadiometer so as
to obtain BMI Questions asked included how they obtain weight and height so as to
calculate BMI
iii. Reading books
This included reading differences references books concerning with how to calculate
BODY MASS INDEX

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

Height (no shoes)

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

S/N ITEM DERAIL/DESCRIPTION QUANTITY


1 LOAD CELL Measuring of weight 20 kg 1
2 LIQUID CRYSTAL Display (16x2) 1
(LCD)
3 MICROCONTROLLER MCU based on Atmel ATMEGA 328 1
processor,5V Supply
4 UTRASONIC SENSOR Measuring of height(1cm to 200cm) 1
5 POWER SUPPLY Buck converter’s(5v supply) 1

Table 1 device description

14
CHAPTER FIVE

5.1 DATA ANALYSIS


Data analysis provides mechanisms to process the collected data so as to obtain
appropriate system designs which will lead to the fulfillment of the main objective. In
this project quantitative techniques for data analysis will be used. This will include
finding the appropriate required analyzed values for the system, which will help to
design a required pill remainder which sends message to the patient when the time to
take medicine reaches.
Due to data collected the following are the analysis of the data collected;

5.1.1 Microcontroller Unit (MCU)


MCU will be used as control unit of designed circuit it will receive signal from load cell
and ultrasonic sensor compile them and provide output to the LCD
Technical detail of MCU
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
Reason to use Microcontroller Unit (MCU) ATmega328.
i. It is simple to program, and to interface with other components.
ii. Number of pin required
iii. Availability.
iv. It is less cost fully
v. It supports the data up to eight (8) bits.
vi. ATmega-328 has 32KB internal built in memory.

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

Pin Name: Description


Vss (Ground) Ground pin connected to system ground
Vdd (+5 Volt) Powers the LCD with +5V (4.7V – 5.3V)
VE (Contrast V) Decides the contrast level of display. Grounded to get maximum
contrast.
Register Select Connected to Microcontroller to shift between command/data
register
Read/Write Used to read or write data. Normally grounded to write data to LCD
Enable Connected to Microcontroller Pin
Data Pin 0 These LCD’s can also operate on 4-bit mode and will be free.
Data Pin 1 These LCD’s can also operate on 4-bit mode and will be free.
Data Pin 2 These LCD’s can also operate on 4-bit mode and will be free.
Data Pin 3 These LCD’s can also operate on 4-bit mode and will be free.
Data Pin 4 They can be connected to Microcontroller to send 8-bit data.
Data Pin 5 They can be connected to Microcontroller to send 8-bit data.
Data Pin 6 They can be connected to Microcontroller to send 8-bit data.
Data Pin 7 They can be connected to Microcontroller to send 8-bit data.
LED Positive Backlight LED pin positive terminal
LED Negative Backlight LED pin negative terminal
Table 2 pin configuration of LCD

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

5.1.4 Load cell sensor (5kg)


In this project the load cell sensor is used to measure the weight by convert the load
force acting on it into electronic signal. Wheatstone bridge Load cell is a sensor whose
resistance varies with applied force; It converts force, pressure, tension, weight, etc., into
a change in electrical resistance which can then be measured

A Wheatstone bridge is a configuration of four balanced resistors with a known


excitation voltage applied as shown below:

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

5.1.5 Ultrasonic sensor


In this project ultrasonic sensor is used to measure distance in height .It transmit the
magnetic pulse towards the forward direction or in front to detect any obstacles and
receive the “echo” reflected by a target the range of the target is determined by the time
lagging between transmitted pulse and received echo. Its distance measuring range is
about 2cm to 400cm. this sensor consists of four pins which are
1 Vcc: connect to 5v dc.
2 Trigger
3 Echo
4 Gnd
DISTANCE CALCULATION
Distance can be calculated by the following formulae;
Distance L=1/2* T* C
Where L is distance
T is time between emission and reception
C is sonic speed
NB; the value is multiplied by 1/2 because T is time for go and return distance.

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

Figure 10 buzzer switching circuit

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

Buzzer Features and Specifications


i. Rated Voltage: 5V DC
ii. Operating Voltage: 4-5V DC
iii. Rated current: <40mA
iv. Sound Type: Continuous Beep

5.1.7 POWER SUPPLY


Steps for Designing a Linear Power Supply:
i. Determine the output voltage and current needed (Ex: 5V@1A)
ii. Pick a linear regulator with that can handle the required current (Ex: LM7805)
iii. Pick rectifier diodes that can handle the required current (Ex: 1N4007)
iv. Pick filter capacitors that limit the rectifier ripple to a reasonable value (Ex:
0.25V ripple @ 1A)
v. Pick a transformer with a secondary voltage rating to accommodate all the
voltage drops
vi. Add a fuse to the primary side of the transformer (and a heat sink if needed) for
the regulator

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.

Figure 11 circuit diagram of automatic BMI calculator

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.

Figure 12 circuit simulation of automatic BMI calculator

22
CHAPTER SEVEN

7.1.CONCULUSON AND RECOMMENDATION


An automatic based microcontroller body mass index calculator will be profitable to
both patients and the doctors. Thus, at my point of view I conclude and recommend that
it should be applied at all concerned sectors as it is time saving, stores parameters, most
of all will help doctors improve their working activities at higher standards.

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.

Garrow JS and Webster J. Quetelet's index (W/H2) as a measure of fatness. International


Journal of Obesity 1985; 9:147–153.

BMI Formula: An Overview, Using the Metric System. Written by/reviewed by: Arthur
Schoenstadt, MD

Clinical Guidelines on the Identification, Evaluation, and Treatment of Overweight and


Obesity in Adults.

Michael Snyder, M.D. (2010). A Life without Dieting. Hay House, Inc.

32

You might also like